The way a Service definition passes $ARGn$ values to a Command definition is by separating them with the
! character. You can choose to address each argument individually, or you can pass all the arguments in one go. It's entirely up to you at that point. One solution might make more sense than another depending on your use case.
If you define your
check_http_url command like this:
Code: Select all
define command{
command_name check_http_url
command_line $USER1$/check_http -I $HOSTADDRESS$ $ARG1$ $ARG2$ $ARG3$
}
Then that command is going to be expecting 3 arguments. However, in your service definition:
Code: Select all
check_command check_http_url!MyURL -p 8010 --expect=200 -s "Country of Residence"
You are, as far as Nagios is concerned, only passing the
check_http_url command one argument (since there's only one
! character). More info here:
https://assets.nagios.com/downloads/nag ... acros.html
Another discrepancy is that your check_command is trying to pass MyURL without the
-u directive. This will probably upset
check_http since MyURL is just floating out there.
Just a few possible options for this setup:
Option A (4 arguments required)
Code: Select all
define command{
command_name check_http_url
command_line $USER1$/check_http -I $HOSTADDRESS$ -u $ARG1$ -p $ARG2$ --expect=$ARG3$ -s $ARG4$
}
......
define service{
use generic-service
host_name MyServer
#hostgroup_name url010d
service_description Check Port, Status and Text
check_command check_http_url!MyURL!8001!200!"Country of Residence"
}
Option B (pass everything in 1 argument)
Code: Select all
define command{
command_name check_http_url
command_line $USER1$/check_http -I $HOSTADDRESS$ $ARG1$
}
......
define service{
use generic-service
host_name MyServer
#hostgroup_name url010d
service_description Check Port, Status and Text
check_command check_http_url!-u MyURL -p 8001 --expect=200 -s "Country of Residence"
}