Date created: 10/05/15 09:28:16. Last modified: 04/02/19 21:50:02

Feed from BASH, snmpget v2c & v3

This example script uses snmpget to poll a specific SNMP OID using either SNMP v2c or SNMP v3 (if the NMS can not support specifying SNMP OIDs):


# SNMP v2c
#subcount=`snmpget -v 2c -c S3cr3tStr1ng | awk {'print $NF'}`

# SNMP v3
##subcount=`snmpget -v 3 -n "" -u snmpuser -a MD5 -A "password" -x AES -X "authphrase" -l authPriv | awk {'print $NF'}`

# Specific source IP
# subcount=`snmpwalk --clientaddr= ...`
echo -n "$subcount"