Command.cfg not being parsed


Hi guys, i’m new to nagios, and am having problems passing the nagios -v tool.
My configuration files are all in place and being processed properly, except the following line in the main nagios script:





i get the following data back after running the nagios -v command (with some cleanup to ease readability)

[error] The following 5 error(s) occurred:
Error: Service check command 'check_http' specified in service 'HTTP' for host 'node01.rhc1' not defined anywhere!
Error: Host check command 'check-host-alive' specified for host 'localhost' is not defined anywhere!
Error: Host check command 'check-host-alive' specified for host 'node01.rhc1' is not defined anywhere!
Error: Service notification command 'notify-service-by-email' specified for contact 'nagiosadmin' is not defined anywhere!
Error: Host notification command 'notify-host-by-email' specified for contact 'nagiosadmin' is not defined anywhere!
[warning] The following 1 warning(s) were generated:
Warning: Host 'localhost' has no services associated with it!

Naturally i’m not worried about the warnings… but the errors are all complaining about commands that ARE existing in the cluster_command.cfg file (referenced in my main cfg file). I have checked the path and permissions numerous times. Is this a common error. I’m using Nagios 3.0.2 in RHE52. The cluster_command.cfg file is a copy of the /usr/local/share/doc/nagios-plugin’s very own command.cfg. The file is un-edited at the moment and has check-host-alive, and notify-host-by-email etc… their all defined (or so they are in the file anyways).

What am i missing? :frowning:


file ownership/permissions?


Thanks for the reply, but that didn’t work. It just doesn’t seem to reference the ‘EXTERNAL COMMAND FILE’ definition and i’m at a loss why.


If i try to make it a config file reference in the nagios.cfg (main config), they verification completely fails on the very first line of the commands.cfg file.



Error: Unexpected token or statement in file '/etc/nagios/cluster_commands.cfg' on line 33.

The first uncommented entry in the file begins on line 33. line 33 of the file is:

command[notify-by-email]=/bin/printf "$OUTPUT$" | /bin/mail -s '$SERVICESTATE$ alert for $HOSTALIAS$/$SERVICEDESC$' $CONTACTEMAIL$

So i’m assuming makeing this a external_command reference is definitely what i have to do right? Are there any other suggestions?


Hang on, I think you are at crossed purposes here and I appear to have not read the original post properly to begin with so my apologies…

The EXTERNAL COMMAND FILE is a file in which commands entered through the web interface to, say, ack a service or whatever, are reported into , and thats where nagios expects to find them - normally you will leave this as is… All of your object configurations, be they host objects, service objects, command objects and so on are indeed configured by referencing the files that contain them with cfg_file= as you have correctly tried to achieve. Ensure that all of your relevant object config files have a related cfg_file statement, and any cfg_file statement you are not using is commented out.

Unfortunately for you, the syntax for your cluster_commands.cfg file (dated 2002) is not now supported…

All objects, such as

are now defined like

define command{ command_name notify-host-by-email command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState:...etc }

There is a note at the top of the file regarding converting the file to ‘object format’ - that might help.

[blockquote]# Note: Use the convertcfg program in the contrib directory of the Nagios

distribution to convert this file into a object file format.[/blockquote]




Why have you changed External command file? It should be as Nagios installation made it:
Only change the path to the file if neccessary. External command file is not meant to be edited. It’s only purpose is for Nagios to read the scheduled jobs to be done, which are put in it by clicking the selected job on the web gui of Nagios or through the scripts/command line with the right sintax which could be found here:
[](hyperlink url)

Locate your **nagios.cmd **file and put the right path to your nagios.cfg for the External command file.

Cfg files are the ones that should be edited and configured in the right way. Those are all in /etc/nagios#/conf.d folder or something like that. I think you’ve mixed up something in the way. commands.cfg file is a file in which you configure check, notification and perflibdata commands. Don’t mix them up with external commands.
In the nagios.cfg there is a segment that says:
Object Configuration File
that should include you commands.cfg file
check it out here:


Thank you!
thats exactly what i did!

I also didn’t know the formats changed to define command { blah blah } which explains why it couldn’t’ include the file that way.

All my problems have gone away! :slight_smile:

Is there a reason why the old command format is still shipped with nagios? (makes it kind of confusing). I’m assuming someone may have already gone line by line and changed all the old entries properly? if so… is there a location to get it from? Otherwise, i guess i can just go through and change the ones i need.



I think nagios-plugins are a seperate entity to nagios itself, which comes with it’s own (correct) sample configs anyway. You sound like you are volunteering :wink: