SteScho / manubulon-snmp

Set of Icinga/Nagios plugins to check hosts and hardware with the SNMP protocol.
GNU General Public License v2.0
73 stars 71 forks source link

perfdata output of check_snmp_int.pl not following specs #32

Closed jcromero closed 5 years ago

jcromero commented 7 years ago

As per https://www.monitoring-plugins.org/doc/guidelines.html#AEN201 (Note 1) the perfdata has to be a list of label/value pairs separated by a space.

Sometimes, in check_snmp_int.pl, those pairs are separated by several whitespaces (specially if you are listing all the interfaces and some of them are DOWN)

The problem is that other software (influxdb writer of Icinga2, for example) is expecting only one space to parse all the pairs in perfdata, and so the parsing is not correct.

dnsmichi commented 7 years ago

Can you send in a PR which fixes the issue please? :)

jcromero commented 7 years ago

My perl knowledge is close to zero, but I think that https://github.com/dnsmichi/manubulon-snmp/blob/master/plugins/check_snmp_int.pl#L718 is the line to modify :/

dnsmichi commented 7 years ago

Hm, do you have some sample data then which I could use for further analysis? (plugin output and perfdata on the cli)

pclerie commented 7 years ago

This is the command line that produces the interface data being shown, as taken from /var/log/icinga2/debug.log:

'/usr/lib/nagios/plugins/check_snmp_int.pl' '-2' '-B' '-C' 'logisys-monitor' '-H' '172.28.5.3' '-M' '-Y' '-c' '0,600' '-d' '300' '-f' '-k' '-n' '\bpppoe0|\beth1|\btun0' '-t' '5' '-w' '300,400'

And if we enter that as is on the command line the output is:

eth1:UP  (0.0Mbps/0.0Mbps), tun0:UP  (0.0Mbps/0.0Mbps), pppoe0:UP  (0.0Mbps/0.0Mbps):(3 UP): UNKNOWN | 'eth1_in_bps'=1114;300000000;;0;100000000 'eth1_out_bps'=752;400000000;600000000;0;100000000  'tun0_in_bps'=5075;300000000;;0;0 'tun0_out_bps'=3401;400000000;600000000;0;0  'pppoe0_in_bps'=22887;300000000;;0;0 'pppoe0_out_bps'=12744;400000000;600000000;0;0

(The reason for the UNKOWN status is because I removed the parts of the output saying it could not write to the output file in /tmp.)

And the performance data from this output get written to the database as:

perfdata = E'eth1_in_bps=1761;300000000;;0;100000000 eth1_out_bps=969;400000000;600000000;0;100000000 '' ''pppoe0_in_bps''''=23036;300000000;;0;0 pppoe0_out_bps=12687;400000000;600000000;0;0 '' ''tun0_in_bps''''=4569;300000000;;0;0 tun0_out_bps=3055;400000000;600000000;0;0'

There are three things to note:

The above is part of my internal bug report. The command line above will produce counters:

Hope that helps.

Marco-Total commented 3 years ago

Hi,

i think, i have the same issue, i use the actually version from this page and use the following command

'/usr/lib64/nagios/plugins/check_snmp_int.pl' '-H' '172xx.xx.xx' '-L' 'sha,des' '-l' 'icinga2' '-X' 'XXX' '-x' 'XXX' '-Y' '-d' '60' '-e' '-f' '-kM' '-n' '48' '-w' '80,80' '-c' '90,90' '-B' '--64bits'

Perfdate Output looks very strange:

'D-Link Corporation DGS-1250-52XMP HW A1 firmware 2_01.006 Port 48_in_error'=0c

In this form i didn't get the grafana graph.

SteScho commented 3 years ago

Hi,

The problem with the spaces in the interface name - not to mention the length. I don't have a D-Link here: Are ifName or ifAlias better? Have you already tried that?

Otherwise you could think about a PR which converts the names. Convert spaces to _ and shorten the name using a regexp filter. The firmware version actually has no place in a switch port name. I thik "Port_48_in_error" would be enough. It's strange what D-Link is doing here.