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):
#!/bin/bash # SNMP v2c #subcount=`snmpget -v 2c -c S3cr3tStr1ng 10.0.0.1 1.3.6.1.4.1.9.10.24.1.1.4.1.3.2 | awk {'print $NF'}` # SNMP v3 ##subcount=`snmpget -v 3 -n "" -u snmpuser -a MD5 -A "password" -x AES -X "authphrase" -l authPriv 10.0.0.1 1.3.6.1.4.1.9.10.24.1.1.4.1.3.2 | awk {'print $NF'}`
# Specific source IP
# subcount=`snmpwalk --clientaddr=192.168.0.123 ...`
echo -n "$subcount"
Previous page: Example OIDs and commands for hardware monioring
Next page: Feed from BASH, wget/HTTP