Dear Cineco
This is a bit more complicated. The PRTG API identifies a sensor by its object ID. The status is not provided as boolean, is is encoded with an integer where value 3 is up, while other statuses are not up (down, warning, paused and so on.)
Devices are identified by their object ID as well. If you put the IP into the settings tab instead of the host name, you can iterate over each device and look for the ID in question. Using the object ID found, you can create a sensor list just for this device and look for a name. The relevant documentation is available via the PRTG webinterface, menu Setup | PRTG API.
Here is an example call for the device list:
/api/table.csv?content=devices&columns=objid,name,host,probegroupdevice=text,status&count=*
Lets say the device in question has the ID 2099 and you now need a sensor list for that device. That looks like
/api/table.csv?id=2099&content=sensors&columns=objid,device=text,sensor=htmllong,status,message,lastvalue,comments&count=*
If you prefer an XML output over CSV, replace table.csv with table.xml.
Add comment