One of my servers runs Nagios (open-source) that was installed by someone else in the past and worked just fine, until I changed the windows.cfg file and now when I try to start the daemon, it says that there are errors in the configuration. When I try to run the config verification, it doesn't give any errors or warnings, but that only checks nagios.cfg which I did not change.

The question is, is it possible to verify/debug windows.cfg and commands.cfg ? Or can this be caused by another issue?



If you look at the contents of nagios.cfg, it will almost certainly include references to windows.cfg and commands.cfg.

When you run the config verification that you mentioned, it traverses through all of the files referenced by nagios.cfg as well, so you are checking the changes you made as well.

  • Thank you. In that case I will try to install Nagios from scratch and configure it myself because right now it displays 0 errors but won't launch because there are (supposedly) errors :( – Ynhockey Dec 27 '11 at 19:37
  • What's the output when you try to run it? – Matt Simmons Dec 27 '11 at 22:11

You can do a verification on the nagios configuration file with the "-v" option. Something like:

/usr/sbin/nagios3 -v /etc/nagios3/nagios.cfg

or whatever your paths happen to be. This should show where the errors are.

  • Oh, you might want to consider putting some version control over the nagios configuration directory. – cjc Dec 27 '11 at 16:13
  • Thank you for the reply. But as I said, I already did this but it returned 0 errors and 0 warnings, and the problem is likely in the windows.cfg which I actually modified. Is there a way to verify that? – Ynhockey Dec 27 '11 at 19:34
  • 1
    Weird. The command I gave should run through all the configuration files included by the main nagios.cfg, including windows.cfg. Could your nagios be pointing at a different nagios.cfg file? – cjc Dec 27 '11 at 21:42
  • @Ynhockey, ensure you're checking the nagios config, not just windows.cfg – John Gardeniers Dec 28 '11 at 23:06

It is possible that the init script you are using to start nagios is feeding it a different conf file than you are using with your manual 'nagios -v /path/to/nagios.cfg' test.

This can happen if, for example, someone starts a nagios box by installing/compiling from source, but abandons that and uses a distro package instead, resulting in multiple nagios confs in multiple places.

Also, the conf parser for nagios is somewhat dumb; The 'verify' step only looks for blatantly-obvious problems like typos, yet happily allows you to leave out some 'required' attributes.

It would help if you paste the exact output that you see when trying to start nagios using your normal method.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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