based on https://docs.digitalocean.com/products/droplets/how-to/track-performance/#retrieve-performance-data-via-api I’m using get_droplet_cpu_metrics from python. I see the response has data like
[1759276800, ‘2341741.67’] [1759277016, ‘2341821.27’] [1759277232, ‘2341982.4699999997’] [1759277448, ‘2342070.5’] [1759277664, ‘2342244.26’] [1759277880, ‘2342407.7800000003’] [1759278096, ‘2342589.83’] [1759278312, ‘2342787.4400000004’] [1759278528, ‘2342873.01’] [1759278744, ‘2343055.73’] [1759278960, ‘2343297.16’] [1759279176, ‘2343484.9299999997’] [1759279392, ‘2343662.73’] [1759279608, ‘2343761.48’] [1759279824, ‘2343958.73’] [1759280040, ‘2344179.69’] [1759280256, ‘2344215.2199999997’] [1759280472, ‘2344323.87’] [1759280688, ‘2344429.52’] [1759280904, ‘2344636.58’]
the first value looks like an epoch time
What is the second value?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Accepted Answer
Hi there,
The first value is the timestamp in epoch time, and the second value is the cumulative CPU time in milliseconds. To get the actual CPU usage, you need to calculate the difference between consecutive points and divide by the time interval.
You can check an example of how to do this here: https://www.digitalocean.com/community/questions/calculating-cpu-usage-from-the-monitoring-api
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.