Debugging global host event handler in Nag 3 [SEC=UNCLASSIFIED]

Stanley.Hopcroft at Dest.gov.au Stanley.Hopcroft at Dest.gov.au
Sat Jan 5 11:06:50 CET 2008


Dear Folks,

The debug options in Nag 3.x are wonderful (especially for embedded
Perl. It is no longer necessary to enable debugging in p1.pl. This Is a
MASSIVE simply MASSIVE improvement. Thank you).

(FWIW the debug options for event handlers in nagios.cfg are

debug_level=16



# DEBUG VERBOSITY
# This option determines how verbose the debug log out will be.
# Values: 0 = Brief output
#         1 = More detailed
#         2 = Very detailed

debug_verbosity=2

)

The debug file then shows the event handler being called with all the
args

[1199526258.177826] [016.1] [pid=12436] Propagating checks to immediate
non-UNREACHABLE child hosts...
[1199526258.177833] [016.1] [pid=12436] Pre-handle_host_state() Host:
acisp014, Attempt=1/10, Type=HARD, Final State=1 [1199526258.177900]
[016.1] [pid=12436] Running global event handler for host 'acisp014'..
[1199526258.177919] [2320.2] [pid=12436] Raw Command Input:
$USER2$/global_host_event_handler $HOSTNAME$ $HOSTSTATE$ $HOSTSTATETYPE$
$LASTHOSTUP$ $LASTHOSTDOWN$ $LASTHOSTUNREACHABLE$ $HOSTDOWNTIME$
[1199526258.177928] [2320.2] [pid=12436] Expanded Command Output:
$USER2$/global_host_event_handler $HOSTNAME$ $HOSTSTATE$ $HOSTSTATETYPE$
$LASTHOSTUP$ $LASTHOSTDOWN$ $LASTHOSTUNREACHABLE$ $HOSTDOWNTIME$
[1199526258.177935] [016.2] [pid=12436] Raw global host event handler
command line: $USER2$/global_host_event_handler $HOSTNAME$ $HOSTSTATE$
$HOSTSTATETYPE$ $LASTHOSTUP$ $LASTHOSTDOWN$ $LASTHOSTUNREACHABLE$
$HOSTDOWNTIME$ [1199526258.177958] [016.2] [pid=12436] Processed global
host event handler command line:
/usr/lib/nagios/plugins/eventhandlers/global_host_event_handler acisp014
DOWN HARD 1199526081 1199526258 0 0 [1199526258.213601] [016.1]
[pid=12436] Post-handle_host_state() Host: acisp014, Attempt=1/10,
Type=HARD, Final State=1

even though it is logged like so in nagios.log

[1199526258] HOST ALERT: acisp014;DOWN;HARD;1;DOWN BABY DOWN.
[1199526258] GLOBAL HOST EVENT HANDLER:
acisp014;(null);(null);(null);global_host_event_handler

Later,

[1199527058.256653] [016.1] [pid=12436] HOST: acisp014, ATTEMPT=1/10,
CHECK TYPE=ACTIVE, STATE TYPE=HARD, OLD STATE=1, NEW STATE=0
[1199527058.256661] [016.1] [pid=12436] Host was DOWN/UNREACHABLE.
[1199527058.256667] [016.1] [pid=12436] Host experienced a HARD recovery
(it's now UP).
[1199527058.256673] [016.1] [pid=12436] Propagating checks to parent
host(s)...
[1199527058.256679] [016.1] [pid=12436] Propagating checks to child
host(s)...
[1199527058.256685] [016.1] [pid=12436] Pre-handle_host_state() Host:
acisp014, Attempt=1/10, Type=HARD, Final State=0 [1199527058.256750]
[016.1] [pid=12436] Running global event handler for host 'acisp014'..
[1199527058.256767] [2320.2] [pid=12436] Raw Command Input:
$USER2$/global_host_event_handler $HOSTNAME$ $HOSTSTATE$ $HOSTSTATETYPE$
$LASTHOSTUP$ $LASTHOSTDOWN$ $LASTHOSTUNREACHABLE$ $HOSTDOWNTIME$
[1199527058.256776] [2320.2] [pid=12436] Expanded Command Output:
$USER2$/global_host_event_handler $HOSTNAME$ $HOSTSTATE$ $HOSTSTATETYPE$
$LASTHOSTUP$ $LASTHOSTDOWN$ $LASTHOSTUNREACHABLE$ $HOSTDOWNTIME$
[1199527058.256783] [016.2] [pid=12436] Raw global host event handler
command line: $USER2$/global_host_event_handler $HOSTNAME$ $HOSTSTATE$
$HOSTSTATETYPE$ $LASTHOSTUP$ $LASTHOSTDOWN$ $LASTHOSTUNREACHABLE$
$HOSTDOWNTIME$ [1199527058.256806] [016.2] [pid=12436] Processed global
host event handler command line:
/usr/lib/nagios/plugins/eventhandlers/global_host_event_handler acisp014
UP HARD 1199527058 1199526258 0 0 [1199527058.385280] [016.1]
[pid=12436] Post-handle_host_state() Host: acisp014, Attempt=1/10,
Type=HARD, Final State=0

So the event handler is called correctly; there is ZERO likelihood of
the failure to get the handler results being the fault of Nagios 3 (it
is the fault of MY event handler).

On the other hand

1 why does the log entry not show the event handler args apart from
$HOSTNAME$

2 why does debug not show the return code of the handler

3 why does the debug not show the ePN processing (as it does very well
with service checks)
  of the event handler 

4 why does the debug output showing the 'Expanded Command Output:' not
show the macro values 

?

Your comments are very welcome.

Thank you,

Yours sincerely.





Classification: UNCLASSIFIED

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
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