Subject: | Nagios::StatusLog - warnings exist when "Nagios::StatusLog::serviceproblems()" method is called without arguments. |
Date: | Thu, 14 Nov 2013 10:42:12 -0500 |
To: | bug-Nagios-Object [...] rt.cpan.org |
From: | Jeffrey Ilgen <jeffrey.ilgen [...] wallstreetsystems.com> |
When I call "Nagios::StatusLog::serviceproblems()", I get the following
warnings along with the services that I'm expecting.
Show quoted text
-------------------BEGIN WARNINGS-----------------------------
Use of uninitialized value $host in hash element at
/usr/local/share/perl5/Nagios/StatusLog.pm line 644.
Use of uninitialized value $service in hash element at
/usr/local/share/perl5/Nagios/StatusLog.pm line 644.
Use of uninitialized value $host in hash element at
/usr/local/share/perl5/Nagios/StatusLog.pm line 645.
Use of uninitialized value $service in hash element at
/usr/local/share/perl5/Nagios/StatusLog.pm line 645.
Use of uninitialized value in numeric eq (==) at
/usr/local/share/perl5/Nagios/StatusLog.pm line 649.
-------------------END WARNINGS---------------------------------
I've come up with a suggested fix which seems to work for me. I basically
just check to see if the arguments were passed or not I'm just not sure if
the warnings should be happening or not.
Nagios/StatusLog.pm
644,645c644,647
< $self->{SERVICE}{$host}{$service}{__parent} = $self;
< Scalar::Util::weaken($self->{SERVICE}{$host}{$service}{__parent});
---
> if ( $host && $service ) {
> $self->{SERVICE}{$host}{$service}{__parent} = $self;
> Scalar::Util::weaken($self->{SERVICE}{$host}{$service}{__parent});
> }
Regards,
Jeff Ilgen, Wallstreet Systems