Go to All Forums

Guidance on API Usage

I was hoping the community could point me in the correct direction. I tried to go over as much of the API documentation as I could to answer my own question before I posted this question in the forum. Maybe I'm missing something completely.

At this point assume what I'm working against is a Server monitor.....
Here's what I'm trying to do. I want to be able to get the last polled performance data for CPU Used Percentage, Memory Used Percentage (I can calculate the percentage if not available in percentage form), and Disk Utilization Percentage all for a specific monitor.

 I have been able to retrieve a list of all available monitors using the current_status endpoint (https://www.site24x7.com/help/api/index.html#retrieve-current-status). The response appears to return one performance value for one specific attribute based on the monitor type of the monitor in question. For a sever monitor, the returned performance attribute appears to be "cpu_used" -- 1 out of 3 attributes I'm looking for.

Using the /reports/performance/{monitor_id} endpoint, it looks like I might be able to get extra performance data; however, this seems limited to "families" of report attributes. For example, using DISK as the report_attribute gets me a bunch of data pertaining only to disks. So if this is the endpoint I have to use to get the performance data, I'll need to make three separate calls to this endpoint per monitor Id. Is that correct? It also appears that the smallest time period I can ask for in each of these calls is a day (24-hour period). This would require that I process a lot more data than I need.
 
Can anybody think of a more efficient approach I can use to get the last polled data that I'm looking for?

Like (1) Reply
Replies (3)

Current status API will fit your need. It will fetch cpu, memory and disk stats for all server monitors. I have attached a python script to iterate and print performance metrics for all server monitors. Please run the attached python script after updating your auth token (AUTH_TOKEN = '') and examine the output and let us know whether it gives the data you are asking for.

Thanks,
Jim
Attachments
getsite24x7data.zip
Size: 0.72 KB
Like (0) Reply

Thanks Jim for your reply. I apparently didn't even notice that the /current_status/type/{monitor_type} endpoint returned the attributes array for each monitor. I find it odd that /current_status/type/{monitor_type} will return the attributes array, but neither the /current_status or the /current_status/{monitor_id} endpoints return the monitor attributes.

If I expanded my earlier statement about what I'm trying to do to say I want to get ALL the available monitors and ALL the last polled available attributes per monitor, would you still use the /current_status/type/{monitor_type} endpoint like you suggested? I assume I would have to call that endpoint multiple times to iterate through all the possible monitor types that might be in use in our environment to get all the available monitors.

Like (0) Reply

Hi Jumblo,

As you have noticed, current_status API for all monitors will return only the main attribute of each monitor and current_status/type API will return all the attributes of monitors of a particular type. 

As of now, there is no single API endpoint which will return current status of all the attributes of all the monitors. We will take this up as a feature request and will come up with an API for that. 

Thillai.
Like (0) Reply

Was this post helpful?