Event handler OK from command line, not from nagios

Kemp, Darren Darren.Kemp at xerox.com
Thu Jul 8 15:40:27 CEST 2004


It looks to me like your command syntax for your eventhandler isn't
passing any arguments to the script.

It should be something like this:


command_line	/usr/local/nagios/libexec/eventhandler/reset_spooler_04
$SERVICESTATE$ $STATETYPE$ $SERVICEATTEMPT$


(for 2.0 $STATETYPE is SERVICESTATETYPE)

Hope this helps.

-dkk


============================================
Now if I cd to /usr/local/nagios/eventhandler and enter this command:

./reset_spooler_04 CRITICAL HARD 4

The rspooler.bat file on the Win 2k box actually runs and logs the
reset.

So far so good.  Now I need to set up a service definition for the event

handler:

#
#  reset_spooler_04 Command
define command{
        command_name    reset_spooler_04
        command_line    /usr/local/nagios/eventhandler/reset_spooler_04
        }

And I need to include the event handler in the service definition:

define service{
        host_name            fc-ctx-04
        use                        rs-windows-service
        service_description        printq_service
        max_check_attempts         5
       event_handler        reset_spooler_04
        normal_check_interval      10
        retry_check_interval       1
        check_command            check_nt_perf!"\\Print 
Queue(_Total)\\Jobs"!4!5
        }

So now the big picture.  We have a working monitor on the Nagios server 
which monitors
the number of print jobs in the Win 2k print queue.  We generate an 
alarm when the number
of jobs in the queue exceeds 5.  I can test this by pulling the paper 
tray on the printer and
queueing up print jobs.  The montor works fine..  It goes into alarm 
when the print queue
gets up to 5 jobs. 

But the event handler doesn't work properly.  Here's the log:

[07-02-2004 13:51:41] SERVICE EVENT HANDLER: 
fc-ctx-04;printq_service;CRITICAL;HARD;5;reset_spooler_04
[07-02-2004 13:51:41] SERVICE ALERT: 
fc-ctx-04;printq_service;CRITICAL;HARD;5;6
[07-02-2004 13:50:41] SERVICE EVENT HANDLER: 
fc-ctx-04;printq_service;CRITICAL;SOFT;4;reset_spooler_04
[07-02-2004 13:50:41] SERVICE ALERT: 
fc-ctx-04;printq_service;CRITICAL;SOFT;4;6
[07-02-2004 13:49:42] SERVICE EVENT HANDLER: 
fc-ctx-04;printq_service;CRITICAL;SOFT;3;reset_spooler_04
[07-02-2004 13:49:42] SERVICE ALERT: 
fc-ctx-04;printq_service;CRITICAL;SOFT;3;6
[07-02-2004 13:48:36] SERVICE EVENT HANDLER: 
fc-ctx-04;printq_service;CRITICAL;SOFT;2;reset_spooler_04
[07-02-2004 13:48:36] SERVICE ALERT: 
fc-ctx-04;printq_service;CRITICAL;SOFT;2;7
[07-02-2004 13:47:37] SERVICE EVENT HANDLER: 
fc-ctx-04;printq_service;CRITICAL;SOFT;1;reset_spooler_04
[07-02-2004 13:47:37] SERVICE ALERT: 
fc-ctx-04;printq_service;CRITICAL;SOFT;1;7

So, it seems to me that Nagios is calling the event handler, and is 
calling it n a CRITICAL HARD state.  Why, oh why, I
wonder, isn't the rest of the system working?  The above event did NOT 
result in an entry in the rspooler.log on the
Win 2k machine.

As I said earlier, if I call the event handler as user nagios from the 
command line, it does run rspooler and makes the
log entries on the Win 2k machine.

Any help would be appreciated...

Glenn Meisenheimer







-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 - 
digital self defense, top technical experts, no vendor pitches, 
unmatched networking opportunities. Visit www.blackhat.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 sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 - 
digital self defense, top technical experts, no vendor pitches, 
unmatched networking opportunities. Visit www.blackhat.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