Nagios service does not start - Error processing object config files!
This article describes how to troubleshoot why the Nagios service will not start due to object configuration errors in Nagios Core. Nagios Core uses plain text files for defining the objects that will be monitored. It can be very easy to make a typing mistake which prevents the Nagios service from starting.
Steps To Reproduce
An example of the issue is as follows:
Type:
service nagios start
The follow error message is produced:
Running configuration check...
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 'winserver3' (config file '/usr/local/nagios/etc/objects/windows.cfg', starting on line 74)
Error: Failed to expand host list 'winserver1' for service 'NSClient++ Version' (/usr/local/nagios/etc/objects/windows.cfg:74)
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.
Identifying The Problem
The following two lines explain the cause of the problem:
Error: Could not find any host matching 'winserver3' (config file '/usr/local/nagios/etc/objects/windows.cfg', starting on line 74)
Error: Failed to expand host list 'winserver1' for service 'NSClient++ Version' (/usr/local/nagios/etc/objects/windows.cfg:74)
Nagios is telling us that the definition for the service called NSCient++ Version has the host winserver3 defined however it cannot find the host object definition in any of the defined configuration files.
Nagios also points you to the exact line in the config file. In this example, line 74 will take you to the beginning of the service definition in /usr/local/nagios/etc/objects/windows.cfg
define service{
use generic-service
host_name winserver1,winserver2,winserver3
service_description NSClient++ Version
check_command check_nt!CLIENTVERSION
check_interval 1
max_check_attempts 1
retry_interval 1
}
Resolving The Problem
You need to correct the object definition error that nagios is complaining about. In the example above, there are two possible solutions:
- Add a host object called winserver3
- Remove winserver3 from the service definition
Why Is The Problem Occurring - I Didn't Make Any Changes
When object configuration files are updated, Nagios will not use these changes until the next time the Nagios service starts.
It is not uncommon for a change to be made in the past and Nagios was not restarted at that point.
You are experiencing the issue because this is the first time Nagios has been restarted since the change.
Preventing The Problem
It is good practice to verify the config whenever changes have been made. Nagios has a verify command you can run which will do just that.
Type:
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
The following information is produced:
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 'winserver3' (config file '/usr/local/nagios/etc/objects/windows.cfg', starting on line 74)
Error: Failed to expand host list 'winserver1' for service 'NSClient++ Version' (/usr/local/nagios/etc/objects/windows.cfg:74)
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.
If there are no problems then the output will be like this:
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...
Read object config files okay...
Running pre-flight check on configuration data...
Checking objects...
Checked 23 services.
Checked 9 hosts.
Checked 6 host groups.
Checked 0 service groups.
Checked 1 contacts.
Checked 1 contact groups.
Checked 29 commands.
Checked 5 time periods.
Checked 0 host escalations.
Checked 0 service escalations.
Checking for circular paths...
Checked 9 hosts
Checked 2 service dependencies
Checked 0 host dependencies
Checked 5 timeperiods
Checking global event handlers...
Checking obsessive compulsive processor commands...
Checking misc settings...
Total Warnings: 0
Total Errors: 0
Things look okay - No serious problems were detected during the pre-flight check
You can also use -vv instead of -v and the command will output a lot more detailed information which you may find useful.
Summary
At this point you should have an understanding of how to troubleshoot configuration issues that prevent the Nagios service from starting.
Final Thoughts
For any support related questions please visit the Nagios Support Forums at: