## Verifying Your Nagios Configuration

Verifying The Configuration From The Command Line

Once you've entered all the necessary data into the configuration files, its time to do a sanity check. Everyone make mistakes from time to time, so its best to verify what you've entered. Nagios automatically runs a "pre-flight check" before before it starts monitoring, but you also have the option of running this check manually before attempting to start Nagios. In order to do this, you must start Nagios with the -v command line argument as follows...

/usr/local/nagios/bin/nagios -v <main_config_file>

Note that you should be entering the path/filename of your main configuration file (i.e. /usr/local/nagios/etc/nagios.cfg) as the second argument. Nagios will read your main configuration file and all object configuration files and verify that they contain valid data.

Relationships Verified During The Pre-Flight Check

During the "pre-flight check", Nagios verifies that you have defined the data relationships necessary for monitoring. Objects are all related and need to be setup properly in order for things to run. This is a list of the basic things that Nagios attempts to check before it will start monitoring...

1. Verify that all contacts are a member of at least one contact group.
2. Verify that all contacts specified in each contact group are valid.
3. Verify that all hosts are a member of at least one host group.
4. Verify that all hosts specified in each host group are valid.
5. Verify that all hosts have at least one service associated with them.
6. Verify that all commands used in service and host checks are valid.
7. Verify that all commands used in service and host event handlers are valid.
8. Verify that all commands used in contact service and host notifications are valid.
9. Verify that all notification time periods specified for services, hosts, and contact are valid.
10. Verify that all service check time periods specified for services are valid.

Fixing Configuration Errors

If you've forgotten to enter some critical data or just plain screwed things up, Nagios will spit out a warning or error message that should point you to the location of the problem. Error messages generally print out the line in the configuration file that seems to be the source of the problem. On errors, Nagios will often exit the pre-flight check and return to the command prompt after printing only the first error that it has encountered. This is done so that one error does not cascade into multiple errors as the remainder of the configuration data is verified. If you get any error messages you'll need to go and edit your configuration files to remedy the problem. Warning messages can generally be safely ignored, since they are only recommendations and not requirements.

Where To Go From Here

Once you've verified your configuration files and fixed any errors, you can be reasonably sure that Nagios will start monitoring the services you've specified. On to starting Nagios!