Since the front page of a web server I wish to check is rather large (49k), I created a very tiny web page for nagios testing purposes. In services.cfg I changed the check option to:


But it looks like it’s still pulling down the default web page as the size is still the same. Am I missing something? Yes, I restarted nagios. I also tried using the alternate switch of “-u /nagios.html”.


I solved it like this.

In checkcommands.cfg add a new check:

define command{
command_name check_http2
command_line $USER1$/check_http -H $ARG1$ -u $ARG2$

Call the new command from services.cfg:

check_command check_http2!!/nagios.htm


as Gus said, you need to redefine the checkcommand.
if check_http is defined as
command_line $USER1$/check_http -H $HOSTADDRESS$
(which most probably is your case if you didn’t modify it)
nagios will ignore any parameters you provide in the service definition and only check http on the IP provided in the host definition.



That fixed it. I decided to call it ‘check_url’.

There doesn’t seem to be a way to pass optional parameters to a check command, right? This could easily be solved if there was an $ARG$ macro that returns the entire command line, like using ‘$USER1$…$USER32$’. Then all of the check commands could be modified to include that by default.

Edited Fri Aug 26 2005, 08:28AM ]


most check_commands have options. Those options have to be defined in the checkcommands.cfg file before you run the script. i.e. -a $ARG1 -c …etc, there is no way to define before hand (by default as you put it) what switch options are in any particular check_command. Does check_ping use a -c or a -a or a -b? It’s just not possible to know unless all scripts included options a-z by default or all scripts use options a-k. But what if some script has no need for that many options.

A better solution is to run ./check_command --help and read the output. Then test the script by command line and then define the command in checkcommands.cfg with ONLY the options and ARGS that you feel the need to use.