slauger/check_netscaler

NTP Check shows perl warnings Use of uninitialized value

Napsty opened this issue · 1 comments

When running the plugin with ntp check command:

$ ./check_netscaler.pl -H mynetscaler -s -C ntp -u nsroot -p secret 
Use of uninitialized value in split at ./check_netscaler.pl line 1122.
Use of uninitialized value in split at ./check_netscaler.pl line 1131.
NetScaler OK - ntp: Offset -0.000324 secs, jitter=5.033, stratum=3, truechimers=1 | offset=-0.000324s;; jitter=5.033;;;0; stratum=3;;;0;16 truechimers=1;;;0;

Bad workaround: Temporarily disable perl warnings

$ grep "^use warnings" check_netscaler.pl
use warnings;

$ sudo sed -i "s/use warnings/#use warnings/" check_netscaler.pl

$ ./check_netscaler.pl -H mynetscaler -s -C ntp -u nsroot -p secret 
NetScaler OK - ntp: Offset -0.000324 secs, jitter=5.139, stratum=3, truechimers=1 | offset=-0.000324s;; jitter=5.139;;;0; stratum=3;;;0;16 truechimers=1;;;0;

Real solution: Define variables.

I'm somehow unable to reproduce this. Could you provide a fix for this?