I am making a python script to read snmp from devices.

I know there are placeholders for snmpv2 and that they do not exist for snmpv3. What are the additional parameters I can pass to the python script for snmpv3?


Article Comments

Hi there!

There are additional parameters for SNMPv3, also.

You are able to pass the following parameters with the array "data", they are listed in the same order as in the sensor's "Settings" tab:
-snmpversion
-snmpport
-snmpuser
-snmpauthpass
-snmpencmode (encryption type)
-snmpauthmode
-snmpencpass

In order to test which parameters are passed by yourself, please find the attached python script. It simply puts out the content of the array "data".

Data.py:

# -*- coding: utf-8 -*-

import sys
import json
# get CustomSensorResult from paepy package
from paepy.ChannelDefinition import CustomSensorResult

if __name__ == "__main__":
    # interpret first command line parameter as json object
    data = json.loads(sys.argv[1])

    print(data)


Place this script into the folder "C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\python" on your core server and use it with PRTG's Python Script Sensor.

Now just activate "Write Results to Disk" in the sensor's setting and find the log in the folder "C:\ProgramData\Paessler\PRTG Network Monitor\Logs (Sensors)" on the probe, the sensor is running on. Please find the right files by looking for the numerical sensor ID in the filename. You can find the ID in the sensors "Overview" page on the right.

I hope this helps.


Kind regards
Andreas Günther, Technical Support


Apr, 2018 - Permalink

Hello,

Which python script are you mentioning? I do not see one in your answer.


Apr, 2018 - Permalink

Hi,

I forgot to attach the script, sorry. Please find it in my previous post.

Thank you!


Kind regards
Andreas Günther, Technical Support


Apr, 2018 - Permalink

Greetings,

I found the snmp data I needed in the logfile, but I also needed to select the "Transmit SNMP credentials" option for it to work (which is logical).

Thanks for the help.


Apr, 2018 - Permalink