Event handler
Drew Weaver
drew.weaver at thenap.com
Wed May 14 23:03:58 CEST 2008
Hi there, I created a very simple event handler just to 'see how it works' and I am having a slight problem perhaps someone can assist me...
define command{
command_name host-status
command_line /usr/bin/php /blah/host-status.php $HOSTSTATE$ $HOSTADDRESS$
}
define command{
command_name service-status
command_line /usr/bin/php /blah/service-status.php $SERVICESTATE$ $HOSTNAME$ $SERVICEDISPLAYNAME$
}
If I su nagios and do /usr/bin/php /blah/service-status.php 1 2 3 it does actually work...
(I thought maybe it was an ownership/permissions issue?)
Host-status.php and service-status.php are simply files which are:
<?
$a = $argv[0];
$b = $argv[1];
$c = $argv[2];
$d = $argv[3];
$handle = fopen("output", "a+");
$content = "$a - $b - $c - $d\n";
$go = fwrite($handle, "$content");
?>
(I'm just trying to learn..)
define service {
host_name blah
service_description SMTP on blah
display_name smtp
check_command check_smtp
max_check_attempts 5
check_interval 30
retry_interval 30
check_period 24x7
event_handler service-status
event_handler_enabled 1
notification_interval 30
notification_period 24x7
}
In the log I see:
[1210798037] SERVICE EVENT HANDLER: blah:SMTP on blah;(null);(null);(null);service-status
So it appears to be attempting to run the event-handler, although I don't believe it should be saying (null)(null)(null) and nothing is written to the output file which php should be writing to.
Has anybody run into this before?
Any advice would be tremendously helpful.
Thank you,
Drew
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-lists.org/archive/users/attachments/20080514/cf081826/attachment.html>
-------------- next part --------------
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
-------------- next part --------------
_______________________________________________
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