good evening i need an api request that returns me the status of a sensor by device ip and sensor name, how the request will be and i need the response as booelan.
Article Comments
Attention: This article is a record of a conversation with the Paessler support team. The information in this conversation is not updated to preserve the historical record. As a result, some of the information or recommendations in this conversation might be out of date.
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.
Sep, 2016 - Permalink
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:
Lets say the device in question has the ID 2099 and you now need a sensor list for that device. That looks like
If you prefer an XML output over CSV, replace table.csv with table.xml.
Sep, 2016 - Permalink