Build precise queries to find exactly what you need
Press ESC to close
I wrote this script that modifies check_mrtgtraf output in order to obtain usable performance data usable by nagiosgraph.
I hope it will be useful.
Rodrigo
#!/bin/sh # parche check_mrtgtraf para que salga en nagiosgraph v_1.2 3 dic 2014 Rodrigo Avila
COMANDO=/usr/lib/nagios/plugins/check_mrtgtraf
ARCHIVO=$2 AGREGACION=$4 CRITI=$6 WARNI=$8
#valor=`/usr/lib/nagios/plugins/check_mrtgtraf -F /srv/www/htdocs/mrtg/192.168.1.1.log -a AVG -c “175000,175000” -w “165000,165000”`
valor=`$COMANDO -F $ARCHIVO -a $AGREGACION -c $CRITI -w $WARNI`
literal=`echo $valor | cut -d”|” -f1`
valorInKB=`echo $valor | cut -d”|” -f2 | cut -d”=” -f2 | cut -d “K” -f1` valorIn=`echo “scale=4 ; $valorInKB * 1024 * 8 /1 “| bc`
valorOutKB=`echo $valor | cut -d”|” -f2 | cut -d”=” -f3 | cut -d “K” -f1` valorOut=`echo “scale=4 ; $valorOutKB *1024 * 8 /1 “| bc`
# convert Bytes to bits AJUSTE=”8″
inCritiKB=`echo $CRITI | cut -d”,” -f1` inCriti=`echo “scale=2 ; $inCritiKB * $AJUSTE /1 “| bc`
#inCriti=$inCritiKB
outCritiKB=`echo $CRITI | cut -d”,” -f2` outCriti=`echo “scale=2 ;$outCritiKB * $AJUSTE /1″| bc`
#outCriti=$outCritiKB
inWarniKB=`echo $WARNI | cut -d”,” -f1` inWarni=`echo “scale=2 ; $inWarniKB * $AJUSTE /1″| bc`
#inWarni=$inWarniKB
outWarniKB=`echo $WARNI | cut -d”,” -f2` outWarni=`echo “scale=2 ;$outWarniKB * $AJUSTE /1″| bc`
#outWarni=$outWarniKB
esCritico=`echo $literal | grep “Traffic CRITICAL” | wc -l ` if [ $esCritico -eq “1” ] then echo “$literal|in=$valorIn;$inWarni;$inCriti;0 out=$valorOut;$outWarni;$outCriti;0” exit 2; fi
esWarning=`echo $literal | grep “Traffic WARNING” | wc -l ` if [ $esWarning -eq “1” ] then echo “$literal|in=$valorIn;$inWarni;$inCriti;0 out=$valorOut;$outWarni;$outCriti;0” exit 1; fi
echo “$literal|in=$valorIn;$inWarni;$inCriti;0 out=$valorOut;$outWarni;$outCriti;0” exit 0;
———————— commands.cfg: # ‘check_local_mrtgtraf’ command definition define command{ command_name check_local_mrtgtraf #RAK command_line $USER1$/check_mrtgtraf -F $ARG1$ -a $ARG2$ -w $ARG3$ -c $ARG4$ -e $ARG5$ command_line $USER1$/parche_check_mrtgtraf -F $ARG1$ -a $ARG2$ -w $ARG3$ -c $ARG4$ -e $ARG5$ } ———————- myrouter.cfg:
define service{ use generic-service host_name MYROUTER service_description Uso de ancho de banda del Enlace ISP check_command check_local_mrtgtraf!/srv/www/htdocs/mrtg/myrouter_192.168.1.1.log!AVG!276000,113750!256000,93750!10 }
We’ve completely redesigned the world’s largest repository of Nagios plugins and monitoring tools. Join thousands of users sharing monitoring solutions for servers, applications, and everything in between.
Due to our redesign, all existing accounts require a password reset to access your account again.
Ready to explore 6,100+ projects and contribute to the community?
Reset Password Create Account
Happy Monitoring!