Nagios retention problem.

Markus.Almroth at teliasonera.com Markus.Almroth at teliasonera.com
Thu Nov 20 11:06:41 CET 2008


Here is a patch for xdata/xrddefault.c. This is derived from 3.0.4-code.
I hope I got the logit() call right :-)

/Markus


256a257,258
>       char errormsg[40];
>       int errorcount=0;
274a277
> 
561c564,570
<       fclose(fp);
---
>       /* If there is a problem when saving/closing the tempfile
>          don't write to the retentionfile and write an error to the
>          log 
>       */
>       if(fclose(fp)) {
>               sprintf(errormsg, "Error when closing retention
tempfile: %s", strerror(errno));
>               logit(NSLOG_RUNTIME_ERROR,TRUE,errormsg,errno);
563,564c572,573
<       /* move the temp file to the retention file (overwrite the old
retention file) */
<       if(my_rename(temp_file,xrddefault_retention_file))
---
>               /* Remove the tempfile - I'm not sure this actually is a
good idea */
>               unlink(temp_file); 
565a575,580
>       } else {
> 
>               /* move the temp file to the retention file (overwrite
the old retention file) */
>               if(my_rename(temp_file,xrddefault_retention_file))
>                       result=ERROR;
>       }
569d583
< 
574,575d587
< 
<  

-----Original Message-----
From: Markus.Almroth at teliasonera.com
[mailto:Markus.Almroth at teliasonera.com] 
Sent: den 19 november 2008 13:39
To: ae at op5.se
Cc: nagios-devel at lists.sourceforge.net;
nagios-users at lists.sourceforge.net
Subject: Re: [Nagios-devel] [Nagios-users] Nagios retention problem.


I move this thred to 'dev' instead. It seems to fit better there.

Problem solved. 

Nagios does'nt check the return value from the fclose() call when
closing the tempfile used to write retention.dat. Before I upgraded to
Nagios 3 I hade severe performance problems, so I moved all temp-files
to ramdisks for higher performance which worked well. But when the
number of services increased after upgrading the ramdisk was'nt big
enough.

Since there were no log entry, and the ramdisks were only about 40-50%
full, I did'nt think this was the problem - after all the ramdisk were
only 100% full between the closing of the tempfile until Nagios changed
the name of the tempfile to "retention.dat".

Anyway. I've rewritten the code a little so that Nagios checks the
fclose() return value, and if there is a problem a log entry is written.
Also Nagios does not change the name of the tempfile, so the old
retention data is saved instead of the new corropt data.

Are you people interested in the patch?

Best Regards
/Markus almroth

-----Original Message-----
From: Andreas Ericsson [mailto:ae at op5.se]
Sent: den 14 november 2008 14:12
To: Almroth, Markus M.
Cc: nagios-users at lists.sourceforge.net
Subject: Re: [Nagios-users] Nagios retention problem.


Markus.Almroth at teliasonera.com wrote:
> Does anybody know if Nagios _always_ write the retention file when 
> reloading/restarting?
>  

It writes the retention file with rather frequent intervals, such as
when it has done "enough" checks (where "enough" is determined sort of
intelligently on a per-installation basis).

Didn't the command-file trick work for you?

-- 
Andreas Ericsson                   andreas.ericsson at op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

------------------------------------------------------------------------
-
This SF.Net email is sponsored by the Moblin Your Move Developer's
challenge
Build the coolest Linux based applications with Moblin SDK & win great
prizes
Grand prize is a trip for two to an Open Source event anywhere in the
world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Nagios-devel mailing list
Nagios-devel at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-devel

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/




More information about the Developers mailing list