Forum Discussion

MartinO's avatar
MartinO
Icon for Contributor rankContributor
2 months ago

CPU utilisation data in bulk from API

How can I get server device CPU or Memory utilisation data from the API in bulk. I can get this from individual servers by specifying the device_id (i.e. /api/device/<device_id>/performance_data/838/data?duration=24h) but there must be a faster and less system taxing way? The documentation specifies how to get performance data in bulk (Requesting Performance Data from the API in Bulk (sciencelogic.com)), but not for all servers where class_type=linux as an example.

 

  • Hi Martin,

    This is the correct way to get the data, the RestAPI does not have a faster method. What I've seen before is that this use case to have the devices that you want to get the data from in a Device Group. There is a Device Group API (/api/device_group/guid) that provides the Device ID's, it lists out the first part of the URI:

    So your code can get that list and loop through them to get the /performance_data/838/data?duration=24h part. 

  • Hi Martin,

    This is the correct way to get the data, the RestAPI does not have a faster method. What I've seen before is that this use case to have the devices that you want to get the data from in a Device Group. There is a Device Group API (/api/device_group/guid) that provides the Device ID's, it lists out the first part of the URI:

    So your code can get that list and loop through them to get the /performance_data/838/data?duration=24h part. 

    • MartinO's avatar
      MartinO
      Icon for Contributor rankContributor

      Hi Eric,

      Thanks for confirming. I'm looping through the devices to get the stats for each device now. I also have to specify different performance data id's for the same metric depending on the OS. i.e. Linux CPU utilisation =5548 and Windows CPU utilisation =4445.

      I was hoping I could do something similar to when getting disk utilisation metrics: I.e. /api/data_performance_raw/device/filesystem?duration=24h&data_fields=d_used_percent.

      Either way, It's good to know that I'm doing it the correct way.

      Thanks!

       

      • EricChambers's avatar
        EricChambers
        Icon for Employee rankEmployee

        Yes, I agree with you there. Unfortunately CPU is a "per vendor" type of metric whereas file system utilization is normalized across all vendor sources. That may change eventually, but for now you have it correct.