I would like to export all snmp sensors with their snmp config values aka snmp version, community ... Can PRTG API help ?


Article Comments

Hello Lubomir,

Thank you very much for your contact.

The PRTG API won't provide you with the requested information, because information such as the SNMP version, community string etc. are stored within the "Settings" tab of a device or inherited by an parent object such as a Group or Probe.

You can try how far you come by exporting a hierarchical list of all groups, devices and sensors using the following API call: /api/table.xml?content=sensortree Afterwards, export the object IDs of your probes, groups and devices and use them to create configuration reports applying the IDs in the URL: https:/your-prtg-server/config_report_object.htm?id=%id_of_the_object% Please note that the community string will be obliterated.

Best regards,
Sebastian


Mar, 2019 - Permalink

Hi Lubomir,

You can easily do this with PrtgAPI

The SNMP settings you've specified are typically defined on devices; you can view all SNMP properties of a device using the Get-ObjectProperty cmdlet

C:\> Get-Device -Id 1001 | Get-ObjectProperty | select *snmp*

InheritSNMPCredentials   : False
SNMPVersion              : v3
SNMPCommunityStringV1    : public
SNMPCommunityStringV2    : public
SNMPv3AuthType           : SHA
SNMPv3UserName           : SNMP_v3
HasSNMPv3Password        : True
SNMPv3EncryptionType     : AES
HasSNMPv3EncryptionKey   : True
...

As PrtgAPI doesn't contain intimate knowledge of all sensor types, if you want to get the SNMP specific settings of a sensor (such as its OID), you can retrieve this information by specifying Get-ObjectProperty -Raw

Regards,

lordmilko


Mar, 2019 - Permalink

Hi lordmilko. Great !

I already made PrtgAPI ready on our system and tried some exports via this great powershell module. The point was the correct syntax :-)

Have a nice day.


Mar, 2019 - Permalink