Error: Cannot open config file '/usr/local/nagios/etc/hosts.cfg'

Steve_Schryburt at Mitel.COM Steve_Schryburt at Mitel.COM
Mon May 16 23:09:56 CEST 2005


The cfg_dir directive doesn't work on HP-UX 11.11.

I ran the same test on Solaris 8 (with same configuration files), works no
problem.

Stephen S.
----- Forwarded by Steve Schryburt/Kan/Mitel on 05/16/2005 05:00 PM -----
                                                                                                                                
                      Steve Schryburt                                                                                           
                                               To:      "EXT-Fuentes, James P" <James.P.Fuentes at boeing.com>                     
                      05/16/2005 04:18         cc:      nagios-users at lists.sourceforge.net                                      
                      PM                       Subject: RE: [Nagios-users] Error: Cannot open config file                       
                                               '/usr/local/nagios/etc/hosts.cfg'(Document link: Steve Schryburt)                
                                                                                                                                



I tried a test, but still no luck.

I have this in nagios.cfg: (I added a cfg_file directive for host R1N1V2)

   # grep ^cfg_ nagios.cfg
   cfg_file=/usr/local/nagios/etc/checkcommands.cfg
   cfg_file=/usr/local/nagios/etc/misccommands.cfg
   cfg_file=/usr/local/nagios/etc/contactgroups.cfg
   cfg_file=/usr/local/nagios/etc/contacts.cfg
   cfg_file=/usr/local/nagios/etc/hostgroups.cfg
   cfg_file=/usr/local/nagios/etc/timeperiods.cfg
   cfg_file=/usr/local/nagios/etc/hostextinfo.cfg

   cfg_file=/usr/local/nagios/etc/hosts/R1N1V2.cfg

   cfg_dir=/usr/local/nagios/etc/hosts
   cfg_dir=/usr/local/nagios/etc/services


Pre-flight:

   # ./nagios -v ../etc/nagios.cfg

   Nagios 2.0b3
   Copyright (c) 1999-2005 Ethan Galstad (www.nagios.org)
   Last Modified: 04-03-2005
   License: GPL

   Reading configuration data...

   Error: Could not find any host matching 'R1N1V2'
   Error: Could not expand member hosts specified in hostgroup (config file
   '/usr/local/nagios/etc/hostgroups.cfg', starting on line 50)


I'm running on HP-UX 11.11, I'll try the same test on Solaris 8 & report
results.

Stephen S.




                                                                                                                                 
                      "EXT-Fuentes,                                                                                              
                      James P"                 To:       <Steve_Schryburt at Mitel.COM>                                             
                      <James.P.Fuentes at b       cc:       <nagios-users at lists.sourceforge.net>                                    
                      oeing.com>               Subject:  RE: [Nagios-users] Error: Cannot open config file                       
                                                 '/usr/local/nagios/etc/hosts.cfg'                                               
                      05/16/2005 02:35                                                                                           
                      PM                                                                                                         
                                                                                                                                 
                                                                                                                                 




My bad. I should have looked into that a little further. What if you put a
"cfg_file" directive pointing to a hostname.cfg in the "cfg_dir" just to
test that Nagios even knows where to go? I dunno, just thinking out loud
with my keyboard...
-Jim


________________________________

From: Steve_Schryburt at Mitel.COM [mailto:Steve_Schryburt at Mitel.COM]
Sent: Mon 5/16/2005 11:23 AM
To: EXT-Fuentes, James P
Cc: nagios-users at lists.sourceforge.net
Subject: RE: [Nagios-users] Error: Cannot open config file
'/usr/local/nagios/etc/hosts.cfg'




Jim,

I would like a hostname.cfg file for each host that I am monitoring.

My understanding is that I should be able to put hostname.cfg files into a
directory that I've identified with the cfg_dir directive
"cfg_dir=/usr/local/nagios/etc/hosts".

Here is the example in nagios.cfg:

   # 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=/usr/local/nagios/etc/servers
   #cfg_dir=/usr/local/nagios/etc/printers
   #cfg_dir=/usr/local/nagios/etc/switches
   #cfg_dir=/usr/local/nagios/etc/routers

For some reason the cfg_dir directive is not working.  The pre-flight
doesn't pick up any hosts in the "/usr/local/nagios/etc/hosts" directory.

Stephen S.




                      "EXT-Fuentes,

                      James P"                 To:
<Steve_Schryburt at Mitel.COM>, <nagios-users at lists.sourceforge.net>
                      <James.P.Fuentes at b       cc:

                      oeing.com>               Subject:  RE: [Nagios-users]
Error: Cannot open config file

'/usr/local/nagios/etc/hosts.cfg'

                      05/16/2005 01:51

                      PM







Do you have "cfg_file" directives for each hostname.file in your
nagios.cfg? Also, I'm a little confused on why you'd point to
"cfg_dir=/usr/local/nagios/etc/hosts". That should read
cfg_file=/usr/local/nagios/etc/hosts.cfg but it sounds like you don't want
that in favor of several other hostname.cfgs:

cfg_file=/usr/local/nagios/etc/host1.cfg
cfg_file=/usr/local/nagios/etc/host2.cfg

-Jim

________________________________

From: Steve_Schryburt at Mitel.COM [mailto:Steve_Schryburt at Mitel.COM]
Sent: Mon 5/16/2005 10:12 AM
To: nagios-users at lists.sourceforge.net
Subject: [Nagios-users] Error: Cannot open config file
'/usr/local/nagios/etc/hosts.cfg'



I'm trying to use several host definition files, one for each monitored
system.  I'm not using hosts.cfg.

When I try staring the nagios deamon I get an error that it can't find
hosts.cfg:

Nagios 2.0b3 starting... (PID=425)
Error: Cannot open config file '/usr/local/nagios/etc/hosts.cfg' for
reading: No such file or directory


Location of of host definition files (1 per host):
/usr/local/nagios/etc/hosts/<hostname>.cfg

/usr/local/nagios/etc/nagios.cfg:
cfg_dir=/usr/local/nagios/etc/hosts


I compiled with these options:

./configure --prefix=/usr/local/nagios \
--exec-prefix=/usr/local/nagios \
--bindir=/bin \
--sbindir=/sbin \
--libexecdir=/libexec \
--datadir=/share \
--sysconfdir=/etc \
--localstatedir=/var


Thanks.
Stephen S.




-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click
_______________________________________________
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

















-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click
_______________________________________________
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