I would like to know if you have the possibility of obtaining particular information by extraction, I explain. On my servers, I use the Windows Free Space sensor which lists the partitions to know what remains in free space and to which I added a tag "Disque_Mine" to find the discs that I wish to follow more particularly. I am able to extract a list of disk with a warning status but I miss information that I can not extract, the free bytes (in G-bytes) and the sum.

Could you help me ?

Here is the link that I was able to produce at the moment:

/api/table.xml?content=sensors&output=csvtable&columns=probe,device,sensor,objid,status,message&filter_status=4&filter_tags=@tag(Disque_Mine)

(PS : sorry if my english is not good)


Article Comments

Dear TIBCO

Using the column lastvalue you can show the current value of the primary channel. You can get all channels from a given sensor, this example uses sensor ID 2123:

/api/table.xml?id=2123&content=channels&columns=objid,name,lastvalue

Feb, 2017 - Permalink

Hi Arne Seifert, Thanks for your replie. With this api, it is valid only for a single sensor identified by its ID. I would like to be able to extract all the sensors for which I added a tag (Disque_Mine) and to show the channels in this extraction. Is it possible ?


Feb, 2017 - Permalink

Dear TIBCO

This cannot be done in a single call. First, you have to generate a list of sensors filtered via tag:

/api/table.xml?content=sensors&columns=objid,name&count=*&filter_tags=@tag(Disque_Mine)

In the second step you have to iterate over the objid numbers and get the channel list for each sensor.


Feb, 2017 - Permalink

After that, is it possible to output the information with an ID range to get channel information or is it only possible to do it one by one?

Because I have a hundred server to supervise and I need to leave this information there to know that this sensor (which has the tag (Disque_Mine)) is in warning and that it remains xxGo of free on xxTo in all.

You see what I mean ?


Feb, 2017 - Permalink

To get channel data, you have to do it sensor by sensor. While this is impractical for manual use, you could write a script which does that.


Feb, 2017 - Permalink

Would you have a track to give me because my server prtg is under windows and I do not master Powershell well?


Feb, 2017 - Permalink

Dear TIBCO

We have no fully-fledged example script. However the core of the script would be a line of code similar to this:

[xml]$xmlresult = (new-object System.Net.WebClient).downloadstring($url)

This command returns the table as XML object so that you can directly access the XML nodes through the object properties.

The $url variable must contain the API call. The API call should also include authentication credentials. Please read more about the API usage via the menus Setup | PRTG API, tab "HTTP API".


Feb, 2017 - Permalink

It does not help me much! I will work on it and see if I get to what I want as I do not have much time in my days to search for the solution. I will return you a return to term (I think it takes time). Thank you for your help


Feb, 2017 - Permalink

For reference, this can be done fairly easily with PrtgAPI

C:\> Get-Sensor -Tags Disque_Mine | Get-Channel *bytes*

Name                      SensorId     Id     LastValue LimitsEnabled UpperErrorLimit LowerErrorLimit
----                      --------     --     --------- ------------- --------------- ---------------
Free Bytes C:             2802          4  30,375 MByte         False
Free Bytes C:             2866          4       No data         False

The last "display value" can be retrieved via the LastValue property. To get the last value in bytes, you can access the LastValueNumeric property

Regards, lordmilko


Feb, 2018 - Permalink