Commit a8afec84 by JR Dalrymple

test the interface list

parent 6ad4bf47
...@@ -7,8 +7,18 @@ interfaceTableOID="IF-MIB::ifDescr" ...@@ -7,8 +7,18 @@ interfaceTableOID="IF-MIB::ifDescr"
interfaceInBytesOID="IF-MIB::ifInOctets" interfaceInBytesOID="IF-MIB::ifInOctets"
interfaceOutBytesOID="IF-MIB::ifOutOctets" interfaceOutBytesOID="IF-MIB::ifOutOctets"
snmpget=`which snmpget`
snmpwalk=`which snmpwalk`
status="" status=""
usage() {
echo " Usage: $0 -i interface -l limit"
echo "$0 -h (shows this message)"
echo "Replace <interface> with the interface you want to monitor"
echo "Replace <limit> with your monthly badwidth allotment measured in bytes"
}
nagiosExit() { nagiosExit() {
echo $2 echo $2
...@@ -27,30 +37,31 @@ fi ...@@ -27,30 +37,31 @@ fi
# GET ARGS # GET ARGS
while getopts r:i:w:h o while getopts H:i:l:h o
do case "$o" in do case "$o" in
r) resetdate="$OPTARG";; H) host="$OPTARG";;
i) interface="$OPTARG";; i) interface="$OPTARG";;
w) warning="$OPTARG";; l) limit="$OPTARG";;
h) print >&2 " Usage: $0 -r date -i interface [-w warning threshold]" \ h) usage
"\n\t$0 -h (shows this message)" \ nagiosExit UNKNOWN " ";;
"\n\n\tdate should be the time you want the counters to reset" \
"\n\tit will use the format <m|d>[dd]HHMM" \
"\n\tso if you want to reset at the start of the month use m010000" \
"\n\tor if you want to reset daily at 3:00 AM use d0300" \
"\n\twarning threshold is optional and measured in bytes."
exit 1;;
esac esac
done done
shift $OPTIND-1 shift $OPTIND-1
period="$(echo "$resetdate" | cut -c1)"
case "$period" in
m | M ) monthlogic;;
d | D ) daylogic;;
* ) status="You didn't specify a valid date"
nagiosExit UNKNOWN "$status";;
esac
# Grab the list of interfaces from the host and figure out
# the index of the array we're interested in
walk="$snmpwalk -v2c -c public $host $interfaceTableOID"
echo $walk
i=0
$walk | while read line
do
interfaceList[ $i ]="$line"
(( i++ ))
done
echo ${interfaceList[@]}
nagiosExit "OK" "Wowsers, I have don't anything" nagiosExit "OK" "Wowsers, I have don't anything"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment