willixix/WL-NagiosPlugins

no usable data

Opened this issue · 0 comments

Hello,

I found this plugin and trying to make it work but without success...
Always I get 'no usable data' when trying to check eth0 on my proxmox machine from my nagios server.

May be I doing something wrong and I need help with that.

So what I want and what I do...

I want for example to check eth0 on proxmox or other interfaces on device like mikrotik routers if traffic warning is 100 Mbit/s and critical if traffic is more than 200 Mbit/s (not MegaBytes ) and I want to got performance data for pnp4nagios for traffic - in/out and errors.

in Nagios commands.cfg I have added:

define command {
        command_name    check_snmp_netint
        # check eth0 speed in/out warning - 100 Mbit/s , critical 200 Mbit/s
        # check_snmp_netint!eth0!100,100,0,0,0,0!200,200,0,0,0,0
#       command_line    $USER1$/check_snmp_netint.pl -H $HOSTADDRESS$ -l $USER3$ -x "$USER4$" -X "$USER5$" -L sha,aes -N 1.3.6.1.2.1.31.1.1.1.1 -n "$ARG1$" --label -g -f -k -e -q -Y -B -M -w "$ARG2$" -c "$ARG3$" -P -T "$LASTSERVICECHECK$" -d 0
        command_line    $USER1$/check_snmp_netint.pl -H $HOSTADDRESS$ -l $USER3$ -x "$USER4$" -X "$USER5$" -L sha,aes -N 1.3.6.1.2.1.31.1.1.1.1 -n "$ARG1$" -w "$ARG2$" -c "$ARG3$" -f -q -k -e -y -M -B -P "$SERVICEPERFDATA$" -T "$LASTSERVICECHECK$ -d 120"
#       command_line    $USER1$/check_snmp_netint.pl -H $HOSTADDRESS$ -l $USER3$ -x "$USER4$" -X "$USER5$" -L sha,aes -N 1.3.6.1.2.1.31.1.1.1.1 -n "$ARG1$" -w "$ARG2$" -c "$ARG3$" -d 120 -f -q -k -e -y -M -B -P
}

in checks for my proxmox machine I have added:

define service {
        use                             generic-service,srv-pnp           ; Name of service template to use
        host_name                       pve
        service_description             TEST - eth0
        check_interval                  1
        retry_interval                  1
        max_check_attempts              5
        contact_groups                  sysadmins
        check_command                   check_snmp_netint!eth0!100,100,0,0,0,0!200,200,0,0,0,0
}

in nagios webinterface for host pve and service "TEST - eth0" I see:

--
Status Information: | eth0:UP (no usable data - 1 rows) :(1 UP): OK
--
Performance Data: | 'eth0_in_octet'=3110170352c 'eth0_out_octet'=1681965768c 'eth0_in_error'=13c 'eth0_in_discard'=76c 'eth0_out_error'=0c 'eth0_out_discard'=0c ptime=1675520736
--

As you can see: "eth0:UP (no usable data - 1 rows) :(1 UP): OK" -

In pnp4nagios i have modified php template to graph:

eth0_in_octet
eth0_out_octet
eth0_in_error
eth0_in_discard
eth0_out_error
eth0_out_discard

so here the modified php tepmplate:

<?php
#
# Plugin: check_snmp_netint.pl (COUNTER, PERCENT, and errors)
#   by William Leibzon - http://william.leibzon.org/nagios/
# (based on pnp4nagios template for check_iftraffic.pl by Joerg Linge)
# Output based on Bits/s
#
$ds_name[1] = "Network Interface Traffic (bps)";
$opt[1] = " --vertical-label \"traffic bps\" -b 1000 --title \"Network Data Traffic for $hostname\" ";
$def[1] = "DEF:var1=$RRDFILE[1]:$DS[1]:AVERAGE " ;
$def[1] .= "DEF:var2=$RRDFILE[2]:$DS[2]:AVERAGE " ;
$def[1] .= "CDEF:in_bits=var1,8,* ";
$def[1] .= "CDEF:out_bits=var2,8,* ";
$def[1] .= "LINE1:in_bits#0000ff:\"in  \" " ;
$def[1] .= "GPRINT:in_bits:LAST:\"%7.2lf %Sbit/s last\" " ;
$def[1] .= "GPRINT:in_bits:AVERAGE:\"%7.2lf %Sbit/s avg\" " ;
$def[1] .= "GPRINT:in_bits:MAX:\"%7.2lf %Sbit/s max\\n\" " ;
$def[1] .= "LINE1:out_bits#00ff00:\"out \" " ;
$def[1] .= "GPRINT:out_bits:LAST:\"%7.2lf %Sbit/s last\" " ;
$def[1] .= "GPRINT:out_bits:AVERAGE:\"%7.2lf %Sbit/s avg\" " ;
$def[1] .= "GPRINT:out_bits:MAX:\"%7.2lf %Sbit/s max\\n\" ";
if($this->MACRO['TIMET'] != ""){
    $def[1] .= "VRULE:".$this->MACRO['TIMET']."#000000:\"Last Service Check \\n\" ";
}
if ($WARN[1] != "") {
    $def[1] .= "HRULE:$WARN[1]#FF8C00:\"In-Traffic Warning on $WARN[1] \" ";
}
if ($WARN[2] != "") {
    $def[1] .= "HRULE:$WARN[2]#FFFF00:\"Out-Traffic Warning on $WARN[2] \" ";
}
if ($CRIT[1] != "") {
    $def[1] .= "HRULE:$CRIT[1]#FF008C:\"In-Traffic Critical on $CRIT[1] \" ";
}
if ($CRIT[2] != "") {
    $def[1] .= "HRULE:$CRIT[2]#FF0000:\"In-Traffic Critical on $CRIT[2] \" ";
}

$ds_name[3] = "Network Interface Errors";
$opt[3] = " --vertical-label \"# errors\" -b 1000 --title \"Network Errors for $hostname\" ";
$def[3] = "DEF:in_error=$RRDFILE[3]:$DS[3]:AVERAGE " ;
$def[3] .= "DEF:in_discard=$RRDFILE[4]:$DS[4]:AVERAGE " ;
$def[3] .= "DEF:out_error=$RRDFILE[5]:$DS[5]:AVERAGE ";
$def[3] .= "DEF:out_discard=$RRDFILE[6]:$DS[6]:AVERAGE ";
$def[3] .= "LINE1:in_error#0000ff:\"in error \\t\" " ;
$def[3] .= "GPRINT:in_error:LAST:\"%4.1lf last\" " ;
$def[3] .= "GPRINT:in_error:AVERAGE:\"%4.1lf avg\" " ;
$def[3] .= "GPRINT:in_error:MAX:\"%4.1lf max\\n\" " ;
$def[3] .= "LINE1:out_error#00ff00:\"out error \\t\" " ;
$def[3] .= "GPRINT:out_error:LAST:\"%4.1lf last\" " ;
$def[3] .= "GPRINT:out_error:AVERAGE:\"%4.1lf avg\" " ;
$def[3] .= "GPRINT:out_error:MAX:\"%4.1lf max\\n\" ";
$def[3] .= "LINE1:in_discard#ff008c:\"in discard \\t\" " ;
$def[3] .= "GPRINT:in_discard:LAST:\"%4.1lf last\" " ;
$def[3] .= "GPRINT:in_discard:AVERAGE:\"%4.1lf avg\" " ;
$def[3] .= "GPRINT:in_discard:MAX:\"%4.1lf max\\n\" " ;
$def[3] .= "LINE1:out_discard#ffff00:\"out discard \\t\" " ;
$def[3] .= "GPRINT:out_discard:LAST:\"%4.1lf last\" " ;
$def[3] .= "GPRINT:out_discard:AVERAGE:\"%4.1lf avg\" " ;
$def[3] .= "GPRINT:out_discard:MAX:\"%4.1lf max\\n\" " ;


?>

and with that I have graphics for interface eth0 on my pve server, but "no usable data - X rows" if present -

I unable to get information about the speed and there are not warning and critical states... So how can I fix that?