Como plantilla de tests en Nagios por SNMP, incluyo aquí el check_snmp_cpu, check_snmp_mem y check_snmp_if_traffic.

Como única consideración, check_snmp_if_traffic devuelve los valores de performance en KBytes/s. Para unificar los criterios a Kbps en el graficado con PNP, he configurado el template nagios/share/pnp/templates/check_if_traffic.php de la siguiente forma:

<?php
#
# Plugin: check_load
# $Id: check_load.php 110 2006-12-06 12:10:59Z lingej $
#
#
$opt[1] = “–vertical-label Bits -l0  –title “Inbound traffic for $hostname / $servicedesc” “;

$def[1] =  “DEF:var1=$rrdfile:$DS[1]:AVERAGE ” ;
$def[1] .= “CDEF:sp1=var1,8,* ” ;
$def[1] .= “DEF:var2=$rrdfile:$DS[2]:AVERAGE ” ;
$def[1] .= “DEF:var3=$rrdfile:$DS[3]:AVERAGE ” ;
$def[1] .= “DEF:var4=$rrdfile:$DS[4]:AVERAGE ” ;

$def[1] .= “AREA:sp1#009933:”Bits” ” ;
$def[1] .= “GPRINT:sp1:LAST:”%6.2lf last” ” ;
$def[1] .= “GPRINT:sp1:AVERAGE:”%6.2lf avg” ” ;
$def[1] .= “GPRINT:sp1:MAX:”%6.2lf max\n” ” ;
$def[1] .= “AREA:var2#990000:”Errors ” ” ;
$def[1] .= “GPRINT:var2:LAST:”%6.2lf last” ” ;
$def[1] .= “GPRINT:var2:AVERAGE:”%6.2lf avg” ” ;
$def[1] .= “GPRINT:var2:MAX:”%6.2lf max\n” ” ;
$def[1] .= “STACK:var3#FF0000:”Discards ” ” ;
$def[1] .= “GPRINT:var3:LAST:”%6.2lf last” ” ;
$def[1] .= “GPRINT:var3:AVERAGE:”%6.2lf avg” ” ;
$def[1] .= “GPRINT:var3:MAX:”%6.2lf max\n” “;
$def[1] .= “STACK:var4#FF8800:”Unknown protos ” ” ;
$def[1] .= “GPRINT:var4:LAST:”%6.2lf last” ” ;
$def[1] .= “GPRINT:var4:AVERAGE:”%6.2lf avg” ” ;
$def[1] .= “GPRINT:var4:MAX:”%6.2lf max\n” “;

$opt[2] = “–vertical-label Bits -l0  –title “Outbound traffic for $hostname / $servicedesc” “;

$def[2] =  “DEF:var5=$rrdfile:$DS[5]:AVERAGE ” ;
$def[2] .= “CDEF:sp2=var5,8,* ” ;
$def[2] .= “DEF:var6=$rrdfile:$DS[6]:AVERAGE ” ;
$def[2] .= “DEF:var7=$rrdfile:$DS[7]:AVERAGE ” ;

$def[2] .= “AREA:sp2#009933:”Bits” ” ;
$def[2] .= “GPRINT:sp2:LAST:”%6.2lf last” ” ;
$def[2] .= “GPRINT:sp2:AVERAGE:”%6.2lf avg” ” ;
$def[2] .= “GPRINT:sp2:MAX:”%6.2lf max\n” ” ;
$def[2] .= “AREA:var6#990000:”Errors ” ” ;
$def[2] .= “GPRINT:var6:LAST:”%6.2lf last” ” ;
$def[2] .= “GPRINT:var6:AVERAGE:”%6.2lf avg” ” ;
$def[2] .= “GPRINT:var6:MAX:”%6.2lf max\n” ” ;
$def[2] .= “STACK:var7#FF0000:”Discards ” ” ;
$def[2] .= “GPRINT:var7:LAST:”%6.2lf last” ” ;
$def[2] .= “GPRINT:var7:AVERAGE:”%6.2lf avg” ” ;
$def[2] .= “GPRINT:var7:MAX:”%6.2lf max\n” “;

?>