Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 27 Dec 2007 20:30:02 -0500
From:      "Chris Haulmark" <chris@sigd.net>
To:        <freebsd-ports@freebsd.org>
Subject:   net-mgmt/nagios-devel cgi_dir recursive feature
Message-ID:  <6FC9F9894A9F8C49A722CF9F2132FC220FC78889@ms05.mailstreet2003.net>

next in thread | raw e-mail | index | archive | help
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. =20

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

cfg_dir=3Dsvchosts.FBSD01/
cfg_dir=3Dsvchosts.FBSD02/
cfg_dir=3Dsvchosts.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/=20

/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/=20

/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.=20

If I added those lines to the nagios.cfg:

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

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

cfg_dir=3D/usr/local/etc/nagios/svchosts.FBSD03/
cfg_dir=3D/usr/local/etc/nagios/svchosts.FBSD03/clients
cfg_dir=3D/usr/local/etc/nagios/svchosts.FBSD03/servers
cfg_dir=3D/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=20
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6FC9F9894A9F8C49A722CF9F2132FC220FC78889>