Pulling my hair out. Every single time I make the slightest edit to the windows.cfg file, the nagios service fails to start. I can't figure out why. Even doing some as simple as changing the host_name from the default winserver to something like winserver2 (only adding a 2 to the end) causes the nagios service to fail on reload.
The error is generic and states that it may be an issue with the config file. Nothing in the nagios log that tells me what exactly is going on.
I am using vi to edit /usr/local/nagios/etc/objects/windows.cfg. I have also tried nano for the editor and same results. It seems like the slightest change I make to the file (not adding spaces or line breaks) causes the service to fail on reload. Even if I change the edit immediately back to how the file was originally configured, the service still fails. The only way to recover is to restore the windows.cfg file from a backup.
I have tried changing the path to a different location. i have tried using a different config file for my windows servers, even going so far as to start with a blank config file and copying in the host definition from the sample into that blank file. Still the service errors on restart with a generic config file error message.
Doesn't make sense. I am extremely careful to main the exact syntax required. Is this a bug because I am using CentOS 7. It is the only thing I have running on this server and the nagios admin website comes up fine. Should I just switch to ubuntu?
windows.cfg file edits causes nagios service to fail
-
jdalrymple
- Skynet Drone
- Posts: 2620
- Joined: Wed Feb 11, 2015 1:56 pm
Re: windows.cfg file edits causes nagios service to fail
Not to play favorites, but you'll find running Nagios on CentOS is far better documented (supported) than on Debian based systems. It works on both, but is easier to maintain on EL variants.
That said - post the output:
That said - post the output:
Code: Select all
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfgThere should be fairly verbose output, please post it all.kev12345 wrote:The error is generic and states that it may be an issue with the config file. Nothing in the nagios log that tells me what exactly is going on.
Re: windows.cfg file edits causes nagios service to fail
ah. of course, I should have run that command. Here is the output -- I am looking at the line referenced right now.
Whats interesting is that I didn't get this error until I made a minor change to that default file on line26 (changing the hostname from the default name to the string DC1)
[root@localhost objects]# nagios -v /usr/local/nagios/etc/nagios.cfg
Nagios Core 4.0.8
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 08-12-2014
License: GPL
Website: http://www.nagios.org
Reading configuration data...
Read main config file okay...
Error: Could not find any host matching 'winserver' (config file '/usr/local/nagios/etc/objects/windows.cfg', starting on line 138)
Error: Failed to expand host list 'winserver' for service 'Explorer' (/usr/local/nagios/etc/objects/windows.cfg:138)
Error processing object config files!
***> One or more problems was encountered while processing the config files...
Check your configuration file(s) to ensure that they contain valid
directives and data defintions. If you are upgrading from a previous
version of Nagios, you should be aware that some variables/definitions
may have been removed or modified in this version. Make sure to read
the HTML documentation regarding the config files, as well as the
'Whats New' section to find out what has changed.
[root@localhost objects]#
Whats interesting is that I didn't get this error until I made a minor change to that default file on line26 (changing the hostname from the default name to the string DC1)
[root@localhost objects]# nagios -v /usr/local/nagios/etc/nagios.cfg
Nagios Core 4.0.8
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 08-12-2014
License: GPL
Website: http://www.nagios.org
Reading configuration data...
Read main config file okay...
Error: Could not find any host matching 'winserver' (config file '/usr/local/nagios/etc/objects/windows.cfg', starting on line 138)
Error: Failed to expand host list 'winserver' for service 'Explorer' (/usr/local/nagios/etc/objects/windows.cfg:138)
Error processing object config files!
***> One or more problems was encountered while processing the config files...
Check your configuration file(s) to ensure that they contain valid
directives and data defintions. If you are upgrading from a previous
version of Nagios, you should be aware that some variables/definitions
may have been removed or modified in this version. Make sure to read
the HTML documentation regarding the config files, as well as the
'Whats New' section to find out what has changed.
[root@localhost objects]#
Re: windows.cfg file edits causes nagios service to fail
that was it. What I am piecing together is that once you make a change to the host_name under the Host Definition, you have to update each service's host_name to match the one you changed. Once I did this for each service, the nagios service was able to be restarted.
thank you for that verbose output command as that told me exactly where to look!
thank you for that verbose output command as that told me exactly where to look!
Re: windows.cfg file edits causes nagios service to fail
Good to hear that you have it resolved. Shall I close the post?
Be sure to check out our Knowledgebase for helpful articles and solutions!