check_nwc_health icon indicating copy to clipboard operation
check_nwc_health copied to clipboard

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

Open bakkc opened this issue 2 years ago • 6 comments

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

bakkc avatar Jun 25 '22 08:06 bakkc

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?

lausser avatar Aug 04 '22 12:08 lausser

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)"

bakkc avatar Aug 04 '22 13:08 bakkc

Insert a line:

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

lausser avatar Aug 04 '22 13:08 lausser

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 avatar Aug 04 '22 13:08 bakkc

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 avatar Aug 04 '22 13:08 bakkc

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)

bakkc avatar Aug 04 '22 13:08 bakkc