Nagios 3.0b5 - ePN and perl caching [SEC=UNCLASSIFIED]

Larry Low llow at telesphere.com
Fri Oct 12 19:13:20 CEST 2007


Thanks Stanley,

Using my check_ifoperstatus script.  Available from
http://www.nagiosexchange.org/Networking.53.0.html?&tx_netnagext_pi1[p_view]
=1099

I've done a few minutes of debugging and the first problem I see is the
MTIME is
not being populated.  Here is my epn_leave-msgs.log.  I added
        print LH "$filename - $mtime = ".$Cache{$filename}[MTIME]."\n";
        while (my ($key,$value) = each %Cache) {
                foreach (@$value) {
                        print LH "$key - $_\n";
                }
        }
right before it compares mtime and you will see below that MTIME is not
populated.

I also added a couple logs where MTIME is supposed to be set.
print LH "$mtime ";
        $Cache{$filename}[MTIME]                = $mtime
                                                        unless $delete ;
print LH $Cache{$filename}[MTIME]."\n";

You will see below that $mtime is fine but $Cache{$filename}[MTIME] is not.

I changed
        $Cache{$filename}[MTIME]                = $mtime
                                                        unless $delete ;
to
        $Cache{$filename}[MTIME]                = $mtime;
and the problem goes away.

I tested for $delete and it is being set to 1 every time.  What is calling
eval_file?  Is this from the nagios core?

************** epn_leave-msgs.log
/opt/nagios/libexec/check_ifoperstatus.pl - 2.96796296296296 = 
2.96796296296296 
Fri Oct 12 10:00:29 2007 eval_file: successfully compiled
"/opt/nagios/libexec/check_ifoperstatus.pl -H XXXX -C XXXX -k 0 -I -N
Gi0/0 --cacti_database=cacti_2 --cacti_password=XXXX".
Fri Oct 12 10:00:29 2007 run_package:
"/opt/nagios/libexec/check_ifoperstatus.pl
-H XXXX -C XXXX -k 0 -I -N Gi0/0 --cacti_database=cacti_2
--cacti_password=XXXX" returning (0, "OK - Interface 'Gi0/0' is
'up(1)' -  (index 1)").

/opt/nagios/libexec/check_ifoperstatus.pl - 2.96796296296296 = 
/opt/nagios/libexec/check_ifoperstatus.pl - 
/opt/nagios/libexec/check_ifoperstatus.pl - HASH(0x9267264)
/opt/nagios/libexec/check_ifoperstatus.pl - 
/opt/nagios/libexec/check_ifoperstatus.pl - CODE(0x9276778)
2.96796296296296 
Fri Oct 12 10:00:59 2007 eval_file: syntax error in
/opt/nagios/libexec/check_ifoperstatus.pl: "Subroutine print_help redefined
at
(eval 9) line 295,".
**************

<Stanley.Hopcroft <at> Dest.gov.au> writes:

> 
> Dear Larry, 
> 
> There are debugging hooks in p1.pl that would be useful to enable. 
> 
> If you are interested in helping deal with this problem please would you
> 
> 1 Back up your original copy of p1.pl (path is specified in nagios.cfg
> IIRC) 
> 
> 2 Change the DEBUG_LEVEL to 
> 
> use constant  DEBUG_LEVEL             => LEAVE_MSG | CACHE_DUMP ; 
> 
> 3 Change the DEBUG_LOG_PATH to something appropriate for your system eg 
> 
> use constant    DEBUG_LOG_PATH => '/tmp/' ; 
> 
> 4 Make p1.pl still compiles (perl -c p1.pl should be nag free; $? == 0) 
> 
> 5 Restart Nagios 
> 
> (IIRC, all this is documented in POD format in p1.pl, so perldoc p1.pl
> should show 
> 
> ... blah blah 
> 
>       Extra logging is given by setting DEBUG_LEVEL to include 
> 
>        LEAVE_MSG 
> 
>        1 opens an extra output stream in the path given by the value of 
>        DEBUG_LOG_PATH 
> 
>        2 logs messages describing the success or otherwise of the plugin
> com- 
>        pilation and the result of the plugin run. 
> 
>        An example of such messages are 
> 
>         Fri Apr 22 11:54:21 2005 eval_file: successfully compiled
> "/usr/local/nagios/libexec/check_bass ". 
>         Fri Apr 22 11:54:21 2005 run_package:
> "/usr/local/nagios/libexec/check_bass " returning ("0", "BASS
> Transaction completed Ok.
> 
>         "). 
>         Fri Apr 22 11:55:02 2005 eval_file: successfully compiled
> "/usr/local/nagios/libexec/check_ad -D production.prod -S".
> 
>         Fri Apr 22 11:55:02 2005 run_package:
> "/usr/local/nagios/libexec/check_ad -D foo.dom -S" returning ("0", "Ok.
> Expected 2 domain controllers [foo1 foo2] for "foo.dom.prod" domain from
> "1.1.2.3" DNS, found 8 [foo1 foo2 ..]
> 
>         "). 
> 
> .. blah blah 
> ) 
> 
> In my case I see 
> 
> [root <at> acisp057 bin]# perl -c p1.pl 
> p1.pl syntax OK 
> [root <at> acisp057 bin]# diff -c p1.pl.orig p1.pl 
> *** p1.pl.orig  2007-10-12 14:09:24.000000000 +1000 
> --- p1.pl       2007-10-12 14:09:56.000000000 +1000 
> *************** 
> *** 10,22 **** 
>   use constant  CACHE_DUMP              => 2 ; 
>   use constant  PLUGIN_DUMP             => 4 ; 
> 
> ! use constant  DEBUG_LEVEL             => 0 ; 
>   # use constant        DEBUG_LEVEL             => CACHE_DUMP ; 
>   # use constant        DEBUG_LEVEL             => LEAVE_MSG ; 
> ! # use constant        DEBUG_LEVEL             => LEAVE_MSG |
> CACHE_DUMP ; 
>   # use constant        DEBUG_LEVEL             => LEAVE_MSG |
> CACHE_DUMP | PLUGIN_DUMP ; 
> 
> ! use constant  DEBUG_LOG_PATH          => '/usr/local/nagios/var/' ; 
>   # use constant        DEBUG_LOG_PATH          => './' ; 
>   use constant  LEAVE_MSG_STREAM        => DEBUG_LOG_PATH .
> 'epn_leave-msgs.log' ; 
>   use constant  CACHE_DUMP_STREAM       => DEBUG_LOG_PATH .
> 'epn_cache-dump.log' ; 
> --- 10,22 ---- 
>   use constant  CACHE_DUMP              => 2 ; 
>   use constant  PLUGIN_DUMP             => 4 ; 
> 
> ! # use constant        DEBUG_LEVEL             => 0 ; 
>   # use constant        DEBUG_LEVEL             => CACHE_DUMP ; 
>   # use constant        DEBUG_LEVEL             => LEAVE_MSG ; 
> ! use constant  DEBUG_LEVEL             => LEAVE_MSG | CACHE_DUMP ; 
>   # use constant        DEBUG_LEVEL             => LEAVE_MSG |
> CACHE_DUMP | PLUGIN_DUMP ; 
> 
> ! use constant  DEBUG_LOG_PATH          => '/tmp/' ; 
>   # use constant        DEBUG_LOG_PATH          => './' ; 
>   use constant  LEAVE_MSG_STREAM        => DEBUG_LOG_PATH .
> 'epn_leave-msgs.log' ; 
>   use constant  CACHE_DUMP_STREAM       => DEBUG_LOG_PATH .
> 'epn_cache-dump.log' ; 
> 
> and 
> 
> [root <at> acisp057 nagios]# more /tmp/epn_leave-msgs.log 
> Fri Oct 12 14:17:08 2007 eval_file: successfully compiled
> "/usr/lib/nagios/plugins/check_sysUpTime -R 10.208.1.254". 
> Fri Oct 12 14:17:08 2007 run_package:
> "/usr/lib/nagios/plugins/check_sysUpTime -R 10.208.1.254" returning (0,
> "sysUpTime of router 1
> 
> 0.208.1.254 is 231 days, 18:14:31.55"). 
> Fri Oct 12 14:17:17 2007 eval_file:
> /usr/lib/nagios/plugins/check_sysUpTime already successfully compiled
> and file has not changed; 
> 
> skipping compilation. 
> Fri Oct 12 14:17:17 2007 run_package:
> "/usr/lib/nagios/plugins/check_sysUpTime -R 10.36.103.254" returning (0,
> "sysUpTime of router 
> 
> 10.36.103.254 is 269 days, 00:03:26.48"). 
> Fri Oct 12 14:17:22 2007 eval_file: successfully compiled
> "/usr/lib/nagios/plugins/check_backuplinks -N "BRUSW200"". 
> Fri Oct 12 14:17:22 2007 run_package:
> "/usr/lib/nagios/plugins/check_backuplinks -N "BRUSW200"" returning (0,
> "Ok. All links from br
> 
> usw200/10.0.254.167 to mtasw200 via Etherchannel  _are_ in "up"
> operational status. Redundant topology Ok."). 
> [root <at> acisp057 nagios]# 
> 
> Unfortch, although the log stream should be unbuffered, it wasn't being
> flushed while Nag was running. I had to restart Nag again to
> 
> get the messages flushed (when I changed the path for the log messages).
> 
> You prob should ensure that the problem plugin is scheduled frequently
> (eg each 5 mins) and let it run for about 5 check periods.
> 
> Please post the results to the list. 
> 
> Thank you, 
> 
> Yours sincerely. 
> 
> Stanley Hopcroft 
> 
> Data Communications 
> 
> 02 6211 6110 
> 0412 766 832 
> 
> Classification: UNCLASSIFIED
> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems?  Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >> http://get.splunk.com/
> _______________________________________________
> Nagios-users mailing list
> Nagios-users <at> lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/nagios-users
> ::: Please include Nagios version, plugin version (-v) and OS when
reporting
any issue. 
> ::: Messages without supporting info will risk being sent to /dev/null
> 
> 




-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list