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

Use of uninitialized value $speed_real in concatenation (.) or string at check_snmp_int.pl line 976. #54

Open zxyz opened 6 years ago

zxyz commented 6 years ago

Hello, thanks for maintaining the manubulon plugins!

I've go problems getting values for the interface speed:

./check_snmp_int.pl -2 -C public -H test.dwelle.de -n "Port-channel4"  -feS

Use of uninitialized value $speed_real in concatenation (.) or string at check_snmp_int.pl line 976.
Port-channel43:UP:1 UP: OK | 'Port-channel43_in_octet'=1267227190c 'Port-channel43_out_octet'=1689980575c 'Port-channel43_in_error'=0c 'Port-channel43_in_discard'=0c 'Port-channel43_out_error'=0c 'Port-channel43_out_discard'=0c 'Port-channel43_speed_bps'=

As you can see, there is no return value for the speed of the interface. I tried to find the error by myself, but not knowing perl I failed. The OIDs are correct and snmpwalk returns the expected values.

Interestingly the following kinda works, apart from the "No usable data on file" part:

./check_snmp_int.pl --down -fe -t 60 -g -2 -C public -H test.example.net -n "Port-channel4" -S -u -B -kq -w 80,80,50,50,1000,1000 -c 90,90,100,100,2000,2000

`Port-channel43:UP No usable data on file (14 rows) :(1 UP): UNKNOWN | 'Port-channel43_in_octet'=10238223103986c 'Port-channel43_out_octet'=58543290756809c 'Port-channel43_in_error'=0c 'Port-channel43_in_discard'=0c 'Port-channel43_out_error'=0c 'Port-channel43_out_discard'=0c 'Port-channel43_speed_bps'=20000000000`

Thanks for any help!

dnsmichi commented 6 years ago

Figure out where $speed_real is set and dump its value with e.g. Data::Dumper.

zxyz commented 6 years ago

I neared it down with a lot of print statements.

line 728:

- if (defined($o_checkperf) && $int_status == 1) {
+ if (defined($o_checkperf) || defined($o_perfs) && $int_status == 1) {

results in:

./check_snmp_int.pl -2 -C public -H test.example.net -n "Port-channel4"  -feS -g
Port-channel43:UP No usable data on file (4 rows) :(1 UP): UNKNOWN | 'Port-channel43_in_octet'=22674709984955c 'Port-channel43_out_octet'=146625280075840c 'Port-channel43_in_error'=0c 'Port-channel43_in_discard'=0c 'Port-channel43_out_error'=0c 'Port-channel43_out_discard'=0c 'Port-channel43_speed_bps'=20000000000

still the "No usable data" problem, but the interface speed is there.

phsm commented 5 years ago

I believe I've fixed this issue in my PR