home made php script
Erik Olsen
nagios at elitdata.no
Sun Aug 14 10:58:08 CEST 2011
Hello
I've been trying to make my own script now for a few hours but im not
getting it to work with nagios.
Im most familiar with php so I used that to make the script.
My setup:
Ubuntu 11.4 server
Nagios 3.2.3
The host/command/and service are all in the same .cfg file.
define command{
command_name check_ups_temprature2
command_line $USER$/check_ups_temp.php
}
define service{
use generic-service
host_name ups1
service_description Temp ups env sensor
check_command eaton_ups_temp
}
Status Information (Return code of 127 is out of bounds - plugin may be
missing)
If I run it with
command_line /usr/bin/php -q $USER$/check_ups_temp.php
I get warning instead of error status: Status Information:(null)
My script:
#!/usr/bin/php -q
<?php
$temp = 23;
$maxtemp=22;
if ($temp<=$maxtemp){
echo "OK";
exit(0);
}
if ($temp>$maxtemp){
echo "CRITICAL";
exit(2);
}
?>
But even if I just use the simplest code it dosnt work.
echo "OK Test ok";
exit(0);
When I run the script from webmin as nagios user it works.
------------------------------------------------------------------------------
FREE DOWNLOAD - uberSVN with Social Coding for Subversion.
Subversion made easy with a complete admin console. Easy
to use, easy to manage, easy to install, easy to extend.
Get a Free download of the new open ALM Subversion platform now.
http://p.sf.net/sfu/wandisco-dev2dev
_______________________________________________
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