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