Nagios 4 ignores object_cache_file and log_file

Joerg Linge pitchfork at ederdrom.de
Sun Sep 16 17:13:58 CEST 2012


Am 16.09.2012 um 16:27 schrieb Andreas Ericsson <ae at op5.se>:

> On 09/16/2012 01:01 PM, Joerg Linge wrote:
>> Hi Andreas,
>> its me again ;)
>> 
>> Now running on git HEAD dc2caf36
>> 
> 
> You're very up to date then. Awesome :)
> 
>> i use customized path to object_cache_file and log_file inside of nagios.cfg
>> 
>> ----
>> OMD[ng4]:~$ grep objects.cache tmp/nagios/nagios.cfg
>> object_cache_file=/omd/sites/ng4/var/nagios/objects.cache
>> 
>> OMD[ng4]:~$ grep nagios.log tmp/nagios/nagios.cfg
>> log_file=/omd/sites/ng4/var/nagios/nagios.log
>> ----
>> 
>> But nagios uses the default locations out of include/locations.h
>> 
>> ----
>> OMD[ng4]:~$ ./bin/nagios  /omd/sites/ng4/tmp/nagios/nagios.cfg
>> 
>> Nagios Core 3.99.95
>> Copyright (c) 2009-2011 Nagios Core Development Team and Community Contributors
>> Copyright (c) 1999-2009 Ethan Galstad
>> Last Modified: 09-14-2012
>> License: GPL
>> 
>> Website: http://www.nagios.org
>> Warning: Could not open object cache file '/usr/local/nagios/var/objects.cache' for writing!
>> Warning: Cannot open log file '/usr/local/nagios/var/nagios.log' for writing
>> Nagios 3.99.95 starting... (PID=29838)
>> Local time is Sun Sep 16 12:54:34 CEST 2012
>> command_wproc->ioc: 0x105ed40
>> Successfully launched command file worker with pid 29839
> 
> Gotta get rid of that debug output too...
> 
>> Workers spawned: 4
>> ----
>> 
>> Some events are written to /usr/local/nagios/var/nagios.log and later
>> to the correct location /omd/sites/ng4/var/nagios/nagios.log
> 
> Hmm. I wonder how that happened. Would you mind bisecting it? I'm guessing
> it's something to do with the object_cache_file now being a nagios core
> variable instead of something belonging to the xodtemplate layer (which
> really shouldn't have any variables of its own).
> 
>> Also /usr/local/nagios/var/objects.cache is created but never updated
>> 
> 
> Well, that's by design. The objects.cache should only be written to once.
> Or do you mean that it gets created but is empty?

Correct.
object_cache_file was created using the wrong path (/usr/local/nagios/var/objects.cache as defined in includes/locations.h instead of /omd/sites/ng4/var/nagios/objects.cache defined in nagios.cfg )

But the file contains just the header.

----
########################################
#       NAGIOS OBJECT CACHE FILE
#
# THIS FILE IS AUTOMATICALLY GENERATED
# BY NAGIOS.  DO NOT MODIFY THIS FILE!
#
# Created: Sun Sep 16 17:09:28 2012
########################################

----

This also happens if you compile nagios using the default prefix /usr/local/nagios.
status.dat is OK.
retention.dat is created and valid.
objects.cache is created but just contains the header without data.

Joerg 
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://ad.doubleclick.net/clk;258768047;13503038;j?
http://info.appdynamics.com/FreeJavaPerformanceDownload.html




More information about the Developers mailing list