Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am reading the nagios.cfg file documentation and cannot see where it says what options are required and what options are optional. Are all of these optional? If not where can I find which are optional?

share|improve this question
up vote 2 down vote accepted

Backup the configuration file:

# cp -a /usr/local/nagios/etc/nagios.cfg /usr/local/nagios/etc/nagios.cfg.bak

Comment out all the options:

# sed -i 's/^/#/' /usr/local/nagios/etc/nagios.cfg

and verify the configuration data:

# nagios -v /usr/local/nagios/etc/nagios.cfg

you will see something like this:

Checking services...
Error: There are no services defined!
    Checked 0 services.
Checking hosts...
Error: There are no hosts defined!
    Checked 0 hosts.
Checking contacts...
Error: There are no contacts defined!
    Checked 0 contacts.
Total Warnings: 0
Total Errors:   3

So, you need to include some config files which defined at least a host, some services and a contact:



Checking services...
    Checked 8 services.
Checking hosts...
    Checked 1 hosts.
Checking contacts...
    Checked 34 contacts.

Total Warnings: 0
Total Errors:   0
share|improve this answer
It's much cleaner to use cfg_dir, rather than a long list of cfg_file lines. Any file whose name ends with .cfg in the cfg_dir will be (recursively) included (concatenated) prior to conf parsing. This allows you to structure your config in a way that makes the most sense to you (e.g., by client, by subnet, by OS type, by tier, etc.) – Keith Dec 28 '11 at 22:27

Usually, when a configuration option is not specified, it will be assigned a default value. Yes, the link you posted does not state whether an option is optional or not. However, default values are specified. If such a value is suitable for your needs, you don't need to include it in your config or you can include it commented out.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.