Reputation: 438
I am trying to run a simple snmpget command using python. For example at the CLI I am using the below command. I want to know how to run this in python and store it in a variable.
snmpget -c public -v1 192.168.1.3 1.3.6.1.2.1.2.2.1.10.17
output: iso.3.6.1.2.1.2.2.1.5.17 = Gauge32: 100000000
Upvotes: 0
Views: 1466
Reputation: 883
Use python subprocess modules check_output function
from subprocess import check_output
out = check_output(["ls", "-l"])
print out
General format: check_output(["cmd", "argument1", "argument2",..."argumentN"])
Upvotes: 2
Reputation: 1009
I usually do snmpget it in java with snmp4j. In python,there is library called snimpy and SNMP library for Python. There are examples in this post Snimpy: SNMP & Python.
Upvotes: 0