net-mgmt/nagios-devel cgi_dir recursive feature

Chris Haulmark chris at sigd.net
Thu Dec 27 17:30:20 PST 2007


Looking here at:

http://nagios.sourceforge.net/docs/3_0/configmain.html#cfg_dir

It shows that if you had been using cgi_dir for several subdirectories,
there would be several cfgs getting loaded into Nagios during the
startup.

Even it would pass the nagios -v with flying colors.

In my situation, it was not working.  I am using FreeBSD 6.2 with
the nagios-devel installed from ports as of this morning (RC1). My
nagios system is set up as a distributed nagios system with a single
master server and slaves that are sharing the same cfg files.

My problem laid in the use of recursive part of the cgi_dir.  

For example, in the nagios.cfg for the master nagios server, I
have those lines:

cfg_dir=svchosts.FBSD01/
cfg_dir=svchosts.FBSD02/
cfg_dir=svchosts.FBSD03/

The directory structure is like this:

/usr/local/etc/nagios/svchosts.FBSD01/
/usr/local/etc/nagios/svchosts.FBSD01/clients/
/usr/local/etc/nagios/svchosts.FBSD01/servers/
/usr/local/etc/nagios/svchosts.FBSD01/networks/ 

/usr/local/etc/nagios/svchosts.FBSD02/
/usr/local/etc/nagios/svchosts.FBSD02/clients/
/usr/local/etc/nagios/svchosts.FBSD02/servers/
/usr/local/etc/nagios/svchosts.FBSD02/networks/ 

/usr/local/etc/nagios/svchosts.FBSD03/
/usr/local/etc/nagios/svchosts.FBSD03/clients/
/usr/local/etc/nagios/svchosts.FBSD03/servers/
/usr/local/etc/nagios/svchosts.FBSD03/networks/

In each of those directories, there are several .cfg
files.  Only the templates-related cfgs are in the slave's
parent directory (svchosts.$SLAVE_NAME/).  The services
and host defined directives are in those cfgs that are
located in any of those three categorized directories under
the slave's parent directory.

Testings were done to make sure the . (period) was not the
culprit in the nagios.cfg. I tried dashes and without any
special characters.  I used absolute paths too.

Nagios always failed with no services or hosts found. 

If I added those lines to the nagios.cfg:

cfg_dir=/usr/local/etc/nagios/svchosts.FBSD01/
cfg_dir=/usr/local/etc/nagios/svchosts.FBSD01/clients
cfg_dir=/usr/local/etc/nagios/svchosts.FBSD01/servers
cfg_dir=/usr/local/etc/nagios/svchosts.FBSD01/networks 

cfg_dir=/usr/local/etc/nagios/svchosts.FBSD02/
cfg_dir=/usr/local/etc/nagios/svchosts.FBSD02/clients
cfg_dir=/usr/local/etc/nagios/svchosts.FBSD02/servers
cfg_dir=/usr/local/etc/nagios/svchosts.FBSD02/networks 

cfg_dir=/usr/local/etc/nagios/svchosts.FBSD03/
cfg_dir=/usr/local/etc/nagios/svchosts.FBSD03/clients
cfg_dir=/usr/local/etc/nagios/svchosts.FBSD03/servers
cfg_dir=/usr/local/etc/nagios/svchosts.FBSD03/networks

Nagios would start up with no errors.

It is like the cfg_dir does not have the recursive feature
as it is shown in their documentation.

I have emailed the nagios-users@ mailing list and got only
one person to confirm that it is working as expected. He
pasted his example and because of his path to the nagios
directory being /usr/local/nagios/etc, it gave me the clue
that it is a Linux machine running nagios.

I am wondering that if there is any other FreeBSD users
that are using nagios successfully using the cfg_dir
recursive feature?  If so, could I see few samples or 
would you share any insights in how you got it working. Or
are there any known issues related to the recursive feature?

Even I had the debug turned on, it does not show when
it is loading cfg files or how it is working on doing that.

Chris


More information about the freebsd-ports mailing list