Having Mb/s values in perfdata of check_snmp_int.pl command

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
Norshok
Posts: 5
Joined: Mon Aug 07, 2017 4:59 am

Having Mb/s values in perfdata of check_snmp_int.pl command

Post by Norshok »

Hello

I'm on Nagios XI, i used the Vmware .ova to get the install done

I am using the command below to get the actual bandwidth that go through the interfaces of a router

/usr/local/nagios/libexec/check_snmp_int.pl -H x.x.x.x -C community -2 -n eth -f -k -w 1000,1000 -c 1200,1200
eth0:UP (552.9KBps/CRIT 2507.9KBps), eth1:UP (CRIT 2466.9KBps/CRIT 8087.0KBps), eth2:UP (93.0KBps/619.8KBps):(3 UP): CRITICAL | 'eth0_in_octet'=3151058755c 'eth0_out_octet'=2254878312c 'eth1_in_octet'=626765302c 'eth1_out_octet'=634153554c 'eth2_in_octet'=1137408010c 'eth2_out_octet'=160432245c

the command is working.

But the perfdata make the graph annoying to read : "eth2_out_octet'=160432245c" , etc ...

so i would like to have those values in mb/s

i tried to use the -B -M -Y to tweak those values.

I could have the results in bytes or in bits but i could never have them in mb/s

do someone experienced this before and have a solution ?

Thanks
bolson

Re: Having Mb/s values in perfdata of check_snmp_int.pl comm

Post by bolson »

Hello Norshok,

You're correct. The check command only gives you the option of returning values in bits or bytes. If you know perl, you could do math in the script itself, ie: B / 1024 / 1024
Norshok
Posts: 5
Joined: Mon Aug 07, 2017 4:59 am

Re: Having Mb/s values in perfdata of check_snmp_int.pl comm

Post by Norshok »

Alright, It worked

$perf_out .= sprintf("%.0f",($checkperf_out_raw[0] * 8)/1024/1024) .";";
$perf_out .= ($o_warn[0]!=0) ? $o_warn[0]*$warn_factor . ";" : ";";
$perf_out .= ($o_crit[0]!=0) ? $o_crit[0]*$warn_factor . ";" : ";";
$perf_out .= "0;". $$resultf{$oid_speed[$i]} ." ";
$perf_out .= "'" . $descr[$i] ."_out_Mbps'=";
$perf_out .= sprintf("%.0f",($checkperf_out_raw[1] * 8)/1024/1024) .";";
$perf_out .= ($o_warn[1]!=0) ? $o_warn[1]*$warn_factor . ";" : ";";
$perf_out .= ($o_crit[1]!=0) ? $o_crit[1]*$warn_factor . ";" : ";";
$perf_out .= "0;". $$resultf{$oid_speed[$i]} ." ";

Thank you
bolson

Re: Having Mb/s values in perfdata of check_snmp_int.pl comm

Post by bolson »

May we close this topic?
Norshok
Posts: 5
Joined: Mon Aug 07, 2017 4:59 am

Re: Having Mb/s values in perfdata of check_snmp_int.pl comm

Post by Norshok »

Yes, thanks again for the help :)
bolson

Re: Having Mb/s values in perfdata of check_snmp_int.pl comm

Post by bolson »

Closing topic as resolved.

Thank you for using the Nagios Support Forum.
Locked