LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 08-01-2012, 02:20 AM   #1
Sma11T0wnITGuy
LQ Newbie
 
Registered: Aug 2009
Posts: 13

Rep: Reputation: 0
Nagios 3.4.1 nagios.cfg processing loop


Hello,

I've upgraded from Nagios 3.2.something to 3.4.1. on an Ubuntu 8.04.4 server. I'm having difficulty with the nagios.cfg file (/etc/nagios/nagios.cfg). The entire file is attached, but I believe the issue is in this area:

Code:
# You can specify individual object config files as shown below:
cfg_file=/etc/nagios/objects/commands.cfg
#cfg_file=/etc/nagios/objects/contacts.cfg
#cfg_file=/etc/nagios/objects/timeperiods.cfg
#cfg_file=/etc/nagios/objects/templates.cfg

Code:
# You can also tell Nagios to process all config files (with a .cfg
# extension) in a particular directory by using the cfg_dir
# directive as shown below:

cfg_dir=/etc/nagios/objects
#cfg_dir=/etc/nagios/servers
#cfg_dir=/etc/nagios/printers
#cfg_dir=/etc/nagios/switches
#cfg_dir=/etc/nagios/routers
When I run the command

Code:
/usr/local/nagios/bin/nagios -v /etc/nagios/nagios.cfg
I get the following output:

Code:
Nagios Core 3.4.1
Copyright (c) 2009-2011 Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 05-11-2012
License: GPL

Website: http://www.nagios.org
Reading configuration data...
   Read main config file okay...
Processing object config file '/etc/nagios/objects/commands.cfg'...
Processing object config directory '/etc/nagios/objects'...
Processing object config file '/etc/nagios/objects/localhost.cfg'...
Processing object config file '/etc/nagios/objects/printer.cfg'...
Processing object config file '/etc/nagios/objects/contacts.cfg'...
Processing object config file '/etc/nagios/objects/templates.cfg'...
Processing object config file '/etc/nagios/objects/timeperiods.cfg'...
Processing object config directory '/etc/nagios/objects/servers'...
Processing object config file '/etc/nagios/objects/servers/host1.cfg'...
Processing object config file '/etc/nagios/objects/servers/host2.cfg'...
Processing object config file '/etc/nagios/objects/servers/host3.cfg'...
Processing object config file '/etc/nagios/objects/servers/host4.cfg'...
Processing object config file '/etc/nagios/objects/servers/host5.cfg'...
Processing object config file '/etc/nagios/objects/servers/host6.cfg'...
Processing object config file '/etc/nagios/objects/servers/host7.cfg'...
'/etc/nagios/objects/checkcommands.cfg'...
Processing object config file '/etc/nagios/objects/commands.cfg'...
Warning: Duplicate definition found for command 'notify-host-by-email' (config file '/etc/nagios/objects/commands.cfg', starting on line 28)
Error: Could not add object property in file '/etc/nagios/objects/commands.cfg' on line 29.
   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.
I believe the nagios.cfg file is causing command.cfg to be read twice, and the test errors out when it sees command.cfg the second time. I'm just not sure how to get around it. I've tried moving it up a directory and updating nagios.cfg to reflect the new location, but then none of the .cfg files in /objects can see it and I get other errors.

What's the standard way this is handled? What am I missing?

Thanks,

Ted
Attached Files
File Type: txt nagios.txt (44.8 KB, 36 views)
 
Old 08-01-2012, 09:17 PM   #2
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.10, Centos 7.5
Posts: 17,682

Rep: Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490
The whole point is to be able to specify individual files and directories, so long as you don't (!) duplicate any entries ... which you have.
If you have stuck with the default setup (all cfgs in .../objects) then comment out specific line
Code:
cfg_file=/etc/nagios/objects/commands.cfg
its redundant
 
1 members found this post helpful.
Old 08-01-2012, 09:19 PM   #3
Sma11T0wnITGuy
LQ Newbie
 
Registered: Aug 2009
Posts: 13

Original Poster
Rep: Reputation: 0
Thanks Chris, that worked.

Sincerely,

Ted
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem manually executing entry in Nagios checkcommands.cfg blainemiller Linux - Software 5 03-10-2011 05:25 PM
commands.cfg [nagios] Xanios Linux - Newbie 18 07-30-2010 04:51 AM
[SOLVED] Nagios dependencies.cfg example file rutledgetome Linux - Software 2 03-17-2010 12:08 PM
[SOLVED] nagios.cfg errors. worm5252 Linux - Server 3 12-17-2009 09:39 PM
nagios and contactgroups.cfg d2490n Linux - Software 3 03-20-2008 09:27 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:55 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration