configuration directory and file directives ...perplexity (long and boring). [SEC=UNCLASSIFIED]

Fulton, David dfulton at mail.fdn.com
Thu Oct 25 16:34:18 CEST 2007


> -----Original Message-----
> From: nagios-users-bounces at lists.sourceforge.net [mailto:nagios-users-

> bounces at lists.sourceforge.net] On Behalf Of 
> Stanley.Hopcroft at Dest.gov.au
> Sent: Wednesday, October 24, 2007 10:07 PM
> To: nagios-users at lists.sourceforge.net
> Subject: Re: [Nagios-users] configuration directory and file 
> directives ...perplexity (long and boring). [SEC=UNCLASSIFIED]
> 
> Dear Tim,
> 
> (Yes, I am the nitwit).
> 
> > -----Original Message-----
> > Mr Hopcroft,
> >
> > My first reaction was an unqualified "yuk!, what nitwit would even 
> > consider this", then I noticed it was you, and having seen your ever

> > useful posts since the Netsaint 0.0.7 days, I relented. Although 
> > hearing vi called "anachronistic" ruffles a couple of feathers.
> 
> (OT. Have a look at what Rob Pike has been saying about Unix for some 
> years. To an MSCE, vi is .. well I am happy with my original choice of

> words. I am not a Windows admin and am perfectly happy with vi to do 
> my Nagios configuration [or my own home brew semi-automation] but not 
> everyone who likes Nagios likes vi).
> 
> > Notepad isn't?
> > No accounting for taste...
> 
> (OT. For unambitious text mangling it's Ok. How many people depend on 
> vi macros or even conditional substitution ?)
> 
> >
> > I can't actually speak to your specific question, but it just seems 
> > like a scary thought. Better to run samba on the Nagios machine and 
> > let them mount it, and/or SVN. And then there's the GUI method, of 
> > course.
> 
> Good thought but why should they change to suit one application ?
> 
> At this site there are no Unix Sys admin skills (apart from me) and 
> everyone likes Windows. Having the configs on Win means management is 
> happy they are adequately backed up.
> 
> Does cfg_dir=/Some/Path actually work ? and if so, would anyone be so 
> kind as to paste a few lines containing these directives from their 
> nagios.cfg ?
> 
> Here is the problem, adding a cfg_dir to point to a _Unix_ directory 
> like so
> 
> ***************
> *** 78,83 ****
> --- 78,87 ----
>   # extension) in a particular directory by using the cfg_dir
>   # directive as shown below:
> 
> + cfg_dir=/etc/nagios
> +
> + # cfg_dir=/mnt/dest_smb/coms/NMS/nagios
> +
>   #cfg_dir=/etc/nagios/servers
>   #cfg_dir=/etc/nagios/printers
>   #cfg_dir=/etc/nagios/switches
> [root at acisp057 nagios]#
> 
> causes
> 
> [root at acisp057 nagios]# nagios -v nagios.cfg
> 
> Nagios 2.9
> Copyright (c) 1999-2007 Ethan Galstad (http://www.nagios.org) Last
> Modified: 04-10-2007
> License: GPL
> 
> Reading configuration data...
> 
> Error: Unexpected token or statement in file '/etc/nagios/cgi.cfg' on 
> line 23.
> 
> ***> 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 at acisp057 nagios]#

If you are setting cfg_dir equal to the directory where you store your
main configuration it is part of the problem. The reasons are twofold:
	1.	Nagios will try to recursively open the main
configuration file, as you can imagine this would cause issues.

	2.	Nagios will open all configuration files that end in
.cfg including ones that it is not supposed to, like cgi.cfg which is
only intended to be read by the cgi programs that the web server runs.

The workaround that I might use for this is to make a subdirectory for
configuration datat and mount your smb filesystem there. It is a
tradeoff though. The windows admins won't be able to modify the main
nagios.cfg file. On the other hand, how often do you change those
options?  The big configuration file changes always happen in the object
definitions. My nagios.cfg file has the following cfg_dir directives in
it:

cfg_dir=/usr/local/etc/nagios/objects/contacts
cfg_dir=/usr/local/etc/nagios/objects/times
cfg_dir=/usr/local/etc/nagios/objects/services
cfg_dir=/usr/local/etc/nagios/objects/templates

cfg_dir=/usr/local/etc/nagios/objects/hosts/firewalls
cfg_dir=/usr/local/etc/nagios/objects/hosts/routers
cfg_dir=/usr/local/etc/nagios/objects/hosts/switches

cfg_dir=/usr/local/etc/nagios/objects/hosts/ironports

cfg_dir=/usr/local/etc/nagios/objects/hosts/unix/freebsd
cfg_dir=/usr/local/etc/nagios/objects/hosts/unix/linux
cfg_dir=/usr/local/etc/nagios/objects/hosts/unix/solaris

cfg_dir=/usr/local/etc/nagios/objects/hosts/windows
cfg_dir=/usr/local/etc/nagios/objects/hosts/vmware
cfg_dir=/usr/local/etc/nagios/objects/hosts/netapp

cfg_dir=/usr/local/etc/nagios/objects/hosts/virtual_services

cfg_dir=/usr/local/etc/nagios/objects/hostgroups
cfg_dir=/usr/local/etc/nagios/objects/servicegroups

This gives me flexibility in configuration file names (as long as it
ends in .cfg) and the ability to keep different types of objects
separate.

Hope this helps

> 
> Take out cfg_dir and all is well.
> 
> >
> > good luck!
> >
> > tim
> 
> Thank you.
> 
> Yours sincerely.
> 
> 
> Classification: UNCLASSIFIED
> 
> ----------------------------------------------------------------------
> --- This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems?  Stop.
> Now Search log events and configuration files using AJAX and a
browser.
> Download your FREE copy of Splunk now >> http://get.splunk.com/ 
> _______________________________________________
> Nagios-users mailing list
> Nagios-users at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/nagios-users
> ::: Please include Nagios version, plugin version (-v) and OS when 
> reporting any issue.
> ::: Messages without supporting info will risk being sent to /dev/null

Regards,
	David Fulton

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list