Is there a way to get a list of all sensors and their OIDs (when they have them)? I am using API: /api/table.xml?content=sensors&output=xml&columns=objid,probe,group,device,sensor,status,tags.... but I do not find a field with the OID info when the object has a snmpcustomsensor

Thanks in advance


Article Comments

The OIDs of SNMP Custom sensors are not exposed via the /api/table.xml endpoint. These values are likely only accessible by parsing the contents of the sensor's Settings page. You can easily extract this information however using PrtgAPI

C:\> flt type eq snmpcustom | Get-Sensor | Get-ObjectProperty -Raw

name               : CPU Load
parenttags         : 
tags               : ciscoswitch cpuloadsensor
oid                : 1.3.6.1.4.1.9.9.109.1.1.1.1.5.1
channel            : CPU Load
unit               : %
factorm            : 1
factord            : 1
...

If you wish to prepare a report containing OIDs from all sensor types (not just snmpcustom) you can simply do

C:\> Get-Sensor | Get-ObjectProperty -Raw | select name,oid | Export-Csv C:\oidreport.csv -NoType

However note that other SNMP sensor types may name their raw "oid" field something slightly different

Regards,

lordmilko


May, 2018 - Permalink