lausser / check_nwc_health

nwc = network component. This plugin checks lots of aspects of routers, switches, wlan controllers, firewalls,.....
http://labs.consol.de/nagios/check_nwc_health
GNU General Public License v2.0
146 stars 88 forks source link

Can't use string ("") as a HASH ref while "strict refs" in use at /usr/local/share/perl5/Net/Ping.pm #300

Open bakkc opened 2 years ago

bakkc commented 2 years ago

Hi Gerard, after moving form centos6 to rhel8 we encounter the following issue with the plugin with the following command: check_nwc_health --hostname xxx.xxx.xxx.xxx --protocol 2c --community something --mode connect-vips --verbose Can't use string ("") as a HASH ref while "strict refs" in use at /usr/local/share/perl5/Net/Ping.pm line 1418. Issue reproduced with Ping.pm 2.55 and 2.74

lausser commented 1 year ago

There should be the code:

    foreach (@{$self->{vips}}) {
      $ping->port_number($_->{ltmVirtualServPort});
      my $now = time;
      $ping->ping_syn($_->{ltmVirtualServAddr},
          inet_aton($_->{ltmVirtualServAddr}),
          $now, $now + 2);
    }

Can you check if $_->{ltmVirtualServAddr} is perhaps undef or does not have a valid ip address value?

bakkc commented 1 year ago

Hi Gerhard, thaks for repying. Perl is not really my thing, how can i debug the script to gather the info? ( like set -x in bash/ksh )

If i'm correct the --mode connect-vips should connect to the F5 (-H ip adres/management ip ) and connect to each virtual server ? Otherwise maybe i'm confusing the fuctionality of the check.

P.S. in the --help mode there is a double line "watch-vips (Watch load balancer vips)"

lausser commented 1 year ago

Insert a line:

   foreach (@{$self->{vips}}) {
      printf "%s\n", Data::Dumper::Dumper($_);
      $ping->port_number($_->{ltmVirtualServPort});
bakkc commented 1 year ago

Hi Gergard, below the output.

$VAR1 = bless( { 'ltmVirtualServEnabled' => 'true', 'ltmVirtualServGtmScore' => 0, 'ltmVirtualServActualPvaAccel' => 'none', 'ltmVirtualServWildmask' => '255.255.255.255', 'ltmVirtualServConnLimit' => 0, 'ltmVirtualServIpProto' => 6, 'indices' => [ '18', '47', '67', '111', '109', '109', '111', '110', '47', '65', '79', '86', '80', '78', '95', '83', '83', '84', '80' ], 'ltmVirtualServTranslatePort' => 'true', 'ltmVirtualServSnatpoolName' => '', 'ltmVirtualServSnatType' => 'none', 'ltmVirtualServDefaultPool' => '/Common/ANICENAME', 'ltmVirtualServSourceAddressTranslationType' => 'automap', 'ltmVirtualServAvailabilityState' => 'none', 'ltmVirtualServName' => '/Common/ANICENAME', 'ltmVirtualServWildmaskType' => 'ipv4', 'ltmVirtualServLasthopPoolName' => '', 'ltmVirtualServRclass' => '', 'ltmVirtualServTranslateAddr' => 'true', 'ltmVirtualServPort' => 443, 'ltmVirtualServListedEnabledVlans' => 'false', 'ltmVirtualServFallbackPersist' => '', 'ltmVirtualServAddr' => '172.16.1.72', 'ltmVirtualServDisabledParentType' => 0, 'ltmVirtualServEnabledState' => 'none', 'flat_indices' => '18.47.67.111.109.109.111.110.47.65.79.86.80.78.95.83.83.84.80', 'ltmVirtualServType' => 'poolbased', 'ltmVirtualServAddrType' => 'ipv4', 'ltmVirtualServCmpEnabled' => 'true', 'ltmVirtualServSfFlags' => 'disabled', 'ltmVirtualServSrcport' => 'srcportreserve', 'ltmVirtualServSourceAddressTranslationPool' => '', 'ltmVirtualServStatusReason' => '', 'ltmVirtualServVaName' => '/Common/172.16.1.72' }, 'Classes::F5::F5BIGIP::Component::VipSubsystem::VIP' );

Can't use string ("") as a HASH ref while "strict refs" in use at /usr/local/share/perl5/Net/Ping.pm line 1418.

bakkc commented 1 year ago

I have tested the same version on the old centos 6 just to compare.

$VAR1 = bless( { 'ltmVirtualServWildmask' => '255.255.255.255', 'ltmVirtualServEnabledState' => 'none', 'ltmVirtualServRclass' => '', 'ltmVirtualServListedEnabledVlans' => 'false', 'ltmVirtualServSrcport' => 'srcportreserve', 'ltmVirtualServDefaultPool' => '/Common/ANICENAME', 'ltmVirtualServConnLimit' => 0, 'ltmVirtualServType' => 'poolbased', 'flat_indices' => '18.47.67.111.109.109.111.110.47.65.79.86.80.78.95.83.83.84.80', 'ltmVirtualServAddrType' => 'ipv4', 'ltmVirtualServVaName' => '/Common/172.16.1.72', 'ltmVirtualServStatusReason' => '', 'ltmVirtualServTranslateAddr' => 'true', 'ltmVirtualServGtmScore' => 0, 'ltmVirtualServSnatpoolName' => '', 'ltmVirtualServFallbackPersist' => '', 'ltmVirtualServIpProto' => 6, 'ltmVirtualServCmpEnabled' => 'true', 'ltmVirtualServDisabledParentType' => 0, 'ltmVirtualServSourceAddressTranslationType' => 'automap', 'ltmVirtualServTranslatePort' => 'true', 'ltmVirtualServActualPvaAccel' => 'none', 'ltmVirtualServSourceAddressTranslationPool' => '', 'indices' => [ '18', '47', '67', '111', '109', '109', '111', '110', '47', '65', '79', '86', '80', '78', '95', '83', '83', '84', '80' ], 'ltmVirtualServAddr' => '172.16.1.72', 'ltmVirtualServSfFlags' => 'disabled', 'ltmVirtualServEnabled' => 'true', 'ltmVirtualServAvailabilityState' => 'none', 'ltmVirtualServName' => '/Common/ANICENAME', 'ltmVirtualServSnatType' => 'none', 'ltmVirtualServPort' => 443, 'ltmVirtualServWildmaskType' => 'ipv4', 'ltmVirtualServLasthopPoolName' => '' }, 'Classes::F5::F5BIGIP::Component::VipSubsystem::VIP' );

bakkc commented 1 year ago

I noticed that on rhel8 the check stops at the first virtual server. On the old centos it returns all the virtual servers (54 in total)