Configuration error:

My pre-flight reports an error when i make new definitions to my a check_http service. The error is blow:

Error: Service check command ‘check_http ‘-H xxx.xxx.xxx…com -u /and/and/and/monitored.png’’ specified in service ‘HTTP’ for host 'xxx.xxx.xxx…com ’ not defined anywhere!

When run manually i get a HTTP ok Retured.

/usr/lib/nagios/plugins/libexec/check_http '-H xxx.xxx.xxx…com -u /and/and/and/monitored.png
HTTP OK HTTP/1.1 200 OK - 383 bytes in 0.062 seconds |time=0.062472s;;;0.000000 size=383B;;;0

Hosts.cfg:

xxx.xxx.xxx.com’ host definition

define host{
use generic-host ; Name of host template to use
host_name xxx.xxx.xxx.com
alias xxx.xxx.xxx.com
address xx.xx.xx.xx
check_command check-host-alive
max_check_attempts 3
notification_interval 120
notification_period 24x7
notification_options d,u,r
contact_groups server-notify
}
Services.cfg

Service definition

define service{
use generic-service ; Name of service template to use

    host_name                       xxx.xxx.xxx.com
    service_description             HTTP
    is_volatile                     0
    check_period                    24x7
    max_check_attempts              3
    normal_check_interval           5
    retry_check_interval            1
    contact_groups                  server-notify
    notification_interval           120
    notification_period             24x7
    notification_options            w,u,c,r
    check_command                   check_http '-H xxx.xxx.xxx..com -u /and/and/and/monitored.png'
    }

You ‘define’ your check commands in a command object definition (normally in commands.cfg in v3) - they look something like this:
[blockquote]# ‘check_http’ command definition
define command{
command_name check_http
command_line $USER1$/check_http -I $HOSTADDRESS$ $ARG1$
}
[/blockquote]
Then, when you define the check_command variable in your service object you pass variables to the check command through use of the delimiter “!”, like
[blockquote]
check_command check_http!-u /download/index.php -t 5 -s “latest-version.tar.gz”
[/blockquote]
So what happens next is the variables from the check_commans line are passed on to the command definition in the order in which they are delimited. If you note the example above for check_http, the first variable $HOSTADDRESS$ will be populated automatically by nagios. the second variable, $ARG1$, will be populated by anything between the first and second delimiter (“!”) - in this case that’s the whole of the remaining check command (i.e. there is no 2nd delimiter and no $ARG2$ in the command object - if there was it’d follow the same sort of reasoning - $ARG2$ maps to the content between the second and third delimiter, $ARG3$ to that between the third and forth, and so on…). Therefore nagios interperates it as follows…
[blockquote]command_line $USER1$/check_http -I $HOSTADDRESS$ $ARG1$
+
check_command check_http!-u /download/index.php -t 5 -s “latest-version.tar.gz”

check_http -I 192.168.what.ever -u /download/index.php -t 5 -s “latest-version.tar.gz”[/blockquote]
So… if you have a working command of
[blockquote]check_http -H xxx.xxx.xxx…com -u /and/and/and/monitored.png[/blockquote]
and your command object for check_http looks like
[blockquote]command_line $USER1$/check_http -I $HOSTADDRESS$ $ARG1$[/blockquote]
then your service object wants to be something like
[blockquote]check_command check_http!-u /and/and/and/monitored.png[/blockquote]
You may need to fiddle with that a bit depending on your check_http command object definition, though the key thing here is seeing how the delimiter works.
Theres a bunch of nagios documentation on monitoring publicly available services at nagios.sourceforge.net/docs/3_0/ … vices.html

HTH

/S

Thanks for the reply… I think i’ve got it now… I’ve defined the host and url in my commands config and all is ok now.

Cheers.