All pastes #100813 Raw Edit

Something

public text v1 · immutable
#100813 ·published 2006-07-26 13:37 UTC
rendered paste body
#!/bin/sh
#socram[at]conexion[dot]com[dot]py

# get values $1=host $2=community $3=target from nagios
rtt1=`snmpwalk $1 -v 1 -c $2 .1.3.6.1.4.1.9.9.42.1.5.2.1.1.$3  | cut -d " " -f4`
rtt2=`snmpwalk $1 -v 1 -c $2 .1.3.6.1.4.1.9.9.42.1.5.2.1.2.$3  | cut -d " " -f4`

#let d=$rtt2/$rtt1
((delay=$rtt2/$rtt1))

# Finally Inform Nagios of what we found...
if [[ $delay = *[^0-9]* ]];
then
        echo "CRITICAL - Delay invalid NaN !"
        exit 2
else
        echo "OK - delay: $delay "
        exit 0
fi

# get out!
exit 3