Re: Error: Service check command

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: Error: Service check command

Post by mcapra »

Your service definition looks malformed. When passing arguments to a check_command in your service definition, you delimit them with the ! character.

So if you have a check command like this:

Code: Select all

# 'check_url_status' command definition
define command{
command_name check_url_status
command_line $USER1$/check_url_status.pl -U $ARG1$
}
And you wanted to pass in http://xxxx.com as the $ARG1$ value, then based on the structure of your check_url_status command definition, you could do something like this:

Code: Select all

define service{
use websites
host_name xxxx
service_description website
servicegroups websites
check_command check_url_status!http://xxxx.com
}
Notice how I have omitted the -U because it is already included in the check_url_status command definition. In the context of a service definition's check_command directive, you are referencing the command definition itself; Not the script.

If your command definition instead looked like this:

Code: Select all

# 'check_url_status' command definition
define command{
command_name check_url_status
command_line $USER1$/check_url_status.pl $ARG1$
}
Then it would be totally valid to include the -U in your service's check_command directive like so:

Code: Select all

check_command check_url_status!-U http://xxxx.com
Former Nagios employee
https://www.mcapra.com/
dappa_don
Posts: 8
Joined: Tue May 30, 2017 9:57 am

Re: Error: Service check command

Post by dappa_don »

of course youre right. here is what i did


define command{
command_name check_url_status
command_line $USER1$/check_url_status.pl $ARG1$
}

define service{
use websites
host_name xxxxx
service_description website
servicegroups websites
check_command check_url_status! -U http://xxxx.com
}

this resolved it
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Error: Service check command

Post by tmcdonald »

Moderator Note: Wondering where the first post went? It was a very complicated workflow involving no small amount of arcane wizardry and techno-babble. To even begin describing what occurred here would require years of study and personal sacrifice on the part of the reader.







Okay I might have hit disapprove on a pending edit which apparently deletes the post. My bad.
Former Nagios employee
Locked