Plugin help

Jonathan Angliss jon at netdork.net
Sat Jul 23 15:39:13 CEST 2011


On 07/22/11 14:00, af.at.work at gmail.com wrote:
> I extended the check_curl plugin from Nagios Exchange to allow the
> inclusion of cookies. While it works like a charm from the CLI, I am
> having trouble getting the check command to work within the configs.
>
> I added the following to commands.cfg:
>
> # 'check CURL' command definition
>
> define command{
>          command_name    check_curl
>          command_line    $USER1$/php check_curl.php -H $HOSTADDRESS$
>          }
>
> And setup a new hostgroup, host and service however whenever I
> validate the config the following error is returned:
>
> Error: Service check command 'check_curl -U
> http://domain.name/home.aspx -F -G Welcome' specified in service
> 'Home' for host 'HomeTest' not defined anywhere!


I'm guessing you've not defined your service check properly.  I'm 
guessing it probably looks something like this:

define service {
   host_name  HomeTest
   service    Home
   check_command  check_curl -U http://domain.name/home.aspx....
}

This makes nagios look for a command which has command_name defined like 
the check_command line.  You probably want something like this instead:

define command {
   command_name   check_curl
   command_line   $USER1$/check_curl.php -H $HOSTADDRESS$ -U $ARG1$ \
     -F -G '$ARG2$'
}

define service {
   host_name  HomeTest
   service    Home
   check_command  check_curl!http://domain.name/home.aspx!Welcome
}

There are a couple of things you'll want to check.  First, I'm 
relatively sure PHP isn't in the path for $USER1$, if it is, ignore 
this.  Second, with my example, it assumes the check_curl.php script is 
executable, and has the necessary script headers, so it looks like this:

!#/usr/bin/php
<?
// rest of php script here //

You should read up on service and command definitions:

http://nagios.sourceforge.net/docs/3_0/objectdefinitions.html#service
http://nagios.sourceforge.net/docs/3_0/objectdefinitions.html#command

It might help to look at some of the examples that come with Nagios too.

-- 
Jonathan Angliss


------------------------------------------------------------------------------
Storage Efficiency Calculator
This modeling tool is based on patent-pending intellectual property that
has been used successfully in hundreds of IBM storage optimization engage-
ments, worldwide.  Store less, Store more with what you own, Move data to 
the right place. Try It Now! http://www.accelacomm.com/jaw/sfnl/114/51427378/
_______________________________________________
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