<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#3333ff">
<tt>Hi All,<br>
<br>
</tt><tt>I'm trying to setup an eventhandler but it seems that
it is never being called/executed.  </tt><tt>I have been over my
configs with a fine-tooth comb, and I just can't
figure this out.  Here are my configs:<br>
<br>
misccommands.cfg:<br>
<br>
define command{<br>
        command_name    restart_test.sh<br>
        command_line    $USER2$/restart_test $SERVICESTATE$
$SERVICESTATETYPE$ $SERVICEATTEMPT$ $HOSTNAME$<br>
        } # $USER2$ is a macro for /opt/nagios/libexec/eventhandle<br>
<br>
<br>
nagios.cfg:<br>
<br>
enable_event_handlers=1<br>
<br>
<br>
services.cfg:<br>
<br>
# Generic service definition template<br>
define service{<br>
        name                            generic-service ; The 'name' of
this service template, referenced in other service definitions<br>
        active_checks_enabled           1       ; Active service checks
are enabled<br>
        passive_checks_enabled          1       ; Passive service
checks are enabled/accepted<br>
        parallelize_check               1       ; Active service checks
should be parallelized (disabling this can lead to major performance
problems)<br>
        obsess_over_service             1       ; We should obsess over
this service (if necessary)<br>
        is_volatile                     0<br>
        check_period                    24x7<br>
        max_check_attempts              3<br>
        normal_check_interval           5<br>
        retry_check_interval            1<br>
        check_freshness                 0       ; Default is to NOT
check service 'freshness'<br>
        notifications_enabled           1       ; Service notifications
are enabled<br>
        event_handler_enabled           1       ; Service event handler
is enabled<br>
        flap_detection_enabled          1       ; Flap detection is
enabled<br>
        process_perf_data               1       ; Process performance
data<br>
        retain_status_information       1       ; Retain status
information across program restarts<br>
        retain_nonstatus_information    1       ; Retain non-status
information across program restarts<br>
        notification_interval           120<br>
        notification_period             24x7<br>
        notification_options            c,r,u<br>
        process_perf_data               0<br>
<br>
        register                        0       ; DONT REGISTER THIS
DEFINITION - ITS NOT A REAL SERVICE, JUST A TEMPLATE!<br>
        }<br>
<br>
<br>
and the service: <br>
define service{<br>
        use                             generic-service         ; Name
of service template to use<br>
        host_name                       tmail<br>
        service_description             msgStor Partition<br>
        max_check_attempts              4<br>
        event_handler_enabled           1<br>
        event_handler                   restart_test<br>
        contact_groups                  solaris-admins<br>
        check_command                   snmp_disk!7!84!89<br>
        }<br>
<br>
<br>
</tt><tt>at this point, all I have in restart_test.sh is this (</tt><tt>I
cannot get any output from this script into</tt><tt> restart_test.log
which is leading me to believe that its not being called)</tt><tt>:<br>
<br>
#!/bin/sh<br>
<br>
echo "$1" "$2" "$3" "$4" >>./restart_test.log<br>
<br>
exit 0<br>
<br>
<br>
and directory perms:<br>
<br>
nagios@excalibur-mgt:~/libexec/eventhandlers> ls -la<br>
total 10<br>
drwxr-xr-x 2 nagios nagios  112 2007-06-05 14:41 .<br>
drwxr-xr-x 3 root   root   2168 2007-05-29 12:37 ..<br>
-rwxr-xr-- 1 nagios nagios   65 2007-06-05 14:41 restart_test.sh<br>
<br>
<br>
</tt><tt>The nagios logs state that it is being called, but I don't
think so:<br>
<br>
[1180991106] SERVICE ALERT: tmail;msgStor Partition;UNKNOWN;SOFT;1;No
valid data returned<br>
[1180991106] SERVICE EVENT HANDLER: tmail;msgStor
Partition;UNKNOWN;SOFT;1;restart_test<br>
[1180991126] SERVICE ALERT: tmail;iPlanet Partition;UNKNOWN;SOFT;1;No
valid data returned<br>
[1180991166] SERVICE ALERT: tmail;msgStor Partition;UNKNOWN;SOFT;2;No
valid data returned<br>
[1180991166] SERVICE EVENT HANDLER: tmail;msgStor
Partition;UNKNOWN;SOFT;2;restart_test<br>
[1180991186] SERVICE ALERT: tmail;iPlanet Partition;UNKNOWN;SOFT;2;No
valid data returned<br>
[1180991226] SERVICE ALERT: tmail;msgStor Partition;UNKNOWN;SOFT;3;No
valid data returned<br>
[1180991226] SERVICE EVENT HANDLER: tmail;msgStor
Partition;UNKNOWN;SOFT;3;restart_test<br>
[1180991246] SERVICE ALERT: tmail;iPlanet Partition;UNKNOWN;SOFT;3;No
valid data returned<br>
[1180991286] SERVICE ALERT: tmail;msgStor Partition;UNKNOWN;HARD;4;No
valid data returned<br>
[1180991286] SERVICE EVENT HANDLER: tmail;msgStor
Partition;UNKNOWN;HARD;4;restart_test<br>
[1180991306] SERVICE ALERT: tmail;iPlanet Partition;UNKNOWN;HARD;4;No
valid data returned<br>
<br>
<br>
by forcing an error (setting the script to no execute) I know that its
being passed the args:<br>
<br>
[1181065075] Warning: Attempting to execute the command
"/opt/nagios/libexec/eventhandlers/restart_test.sh UNKNOWN SOFT 1
<some_IP>" resulted in a return code of 126.  Make sure the
script or binary you are trying to execute actually exists...<br>
<br>
<br>
There you have it.  Can anyone help?<br>
Thanks,<br>
    Kurt<br>
<br>
</tt>
</body>
</html>