home made php script

Erik Olsen nagios at elitdata.no
Sun Aug 14 12:55:30 CEST 2011


Thx.. 
Fell like an idiot ,) Should have seen it. I just copied and past the
command that was over, and didn’t even think of checking the spelling for
the variable.
The command over wasn’t in use.


-----Opprinnelig melding-----
Fra: Daniel Tuecks [mailto:dtuecks at googlemail.com] 
Sendt: 14. august 2011 12:23
Til: Nagios Users List
Emne: Re: [Nagios-users] home made php script

Hi Erik,

I think that Nagios can't find your script. The $USER$ macro is wrong.
It should be $USERn$ (defined in your resource.cfg file).
http://nagios.sourceforge.net/docs/nagioscore/3/en/macrolist.html#user

Daniel

2011/8/14 Erik Olsen <nagios at elitdata.no>:
> 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
>

----------------------------------------------------------------------------
--
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


------------------------------------------------------------------------------
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