Last active
December 16, 2015 12:08
-
-
Save q1x/0b1078927049c1ed0991 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# This script counts the number of returned lines from an SNMP walk. | |
# | |
COMMUNITY="$1" | |
IP="$2" | |
OID="$3" | |
FILTER="$4" | |
# Disable mibs to save time | |
export MIBS= | |
# Do the walk and count matching lines | |
snmpwalk -t 5 -On -v 2c -c "$COMMUNITY" "$IP" "$OID" | grep -v '(^$|No Such Instance currently exists at this OID$)' | grep -c "$FILTER" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment