I'm using Nagios 3.2.3 on CentOS 6.5. Everything during install
and make
went smoothly. I transferred over my conf files, made the appropriate changes, and did a pre-flight test against my nagios.cfg file. In my nagios.cfg file, I use cfg_dir=/usr/local/nagios/etc/conf.d
and then let Nagios recursively search through that directory.
Output of /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
shows the following:
Website: http://www.nagios.org
Reading configuration data...
Read main config file okay...
Processing object config directory '/usr/local/nagios/etc/conf.d'...
Processing object config directory '/usr/local/nagios/etc/conf.d/hostgroups.d'...
Processing object config file '/usr/local/nagios/etc/conf.d/hostgroups.d/hostgroups.cfg'...
Processing object config directory '/usr/local/nagios/etc/conf.d/commands.d'...
Processing object config file '/usr/local/nagios/etc/conf.d/commands.d/commands.cfg'...
Processing object config directory '/usr/local/nagios/etc/conf.d/templates.d'...
Processing object config file '/usr/local/nagios/etc/conf.d/templates.d/templates.cfg'...
Processing object config file '/usr/local/nagios/etc/conf.d/templates.d/printer.cfg'...
Processing object config file '/usr/local/nagios/etc/conf.d/templates.d/switch.cfg'...
Processing object config file '/usr/local/nagios/etc/conf.d/templates.d/timeperiods.cfg'...
Processing object config file '/usr/local/nagios/etc/conf.d/templates.d/windows.cfg'...
Processing object config directory '/usr/local/nagios/etc/conf.d/objects'...
Processing object config file '/usr/local/nagios/etc/conf.d/objects/previews-indexes-qa.cfg'...
Processing object config file '/usr/local/nagios/etc/conf.d/objects/contacts.cfg'...
Processing object config file '/usr/local/nagios/etc/conf.d/objects/restart_cb_sites.cfg'...
Processing object config file '/usr/local/nagios/etc/conf.d/objects/hudson-slave01.cfg'...
Processing object config file '/usr/local/nagios/etc/conf.d/objects/ipc-qa.cfg'...
Processing object config file '/usr/local/nagios/etc/conf.d/objects/russellreynolds.cfg'...
Processing object config file '/usr/local/nagios/etc/conf.d/objects/lr.cfg'...
Processing object config file '/usr/local/nagios/etc/conf.d/objects/ts-01.cfg'...
Processing object config file '/usr/local/nagios/etc/conf.d/cgi.cfg'...
Error: Unexpected token or statement in file '/usr/local/nagios/etc/conf.d/cgi.cfg' on line 15.
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.
So I check the cgi.cfg
file at line 15, which points to my main_config_file=
#################################################################
#
# CGI.CFG - Sample CGI Configuration File for Nagios 3.4.4
#
# Last Modified: 06-17-2009
#
#################################################################
# MAIN CONFIGURATION FILE
# This tells the CGIs where to find your main configuration file.
# The CGIs will read the main and host config files for any other
# data they might need.
main_config_file=/usr/local/nagios/etc/nagios.cfg //line 15 here
# PHYSICAL HTML PATH
# This is the path where the HTML files for Nagios reside. This
# value is used to locate the logo images needed by the statusmap
# and statuswrl CGIs.
physical_html_path=/usr/local/nagios/share
The nagios.cfg is purposely outside of the conf.d/ directory. The path listed is correctly as well:
[root@ip-172-31-46-232 conf.d]# locate nagios.cfg
/usr/local/nagios/etc/nagios.cfg