Deletion of the performance data log files.

Andreas Ericsson ae at op5.se
Tue May 18 12:54:43 CEST 2004


Ben Clewett wrote:
> Dear group,
> 
> I have a problem parsing the Nagios performance data and wonder if any 
> member can suggest a solution.  These have the default file names 
> 'serviceperf.log' and 'hostperf.log'.
> 
> I wish to parse and delete these every minute.  But I cannot delete them 
> as Nagios holds the file open.  Stopping and starting Nagios every 
> minute is not really an option.
> 
You can empty it without deleting it.
simply 'echo -n > hostperf.log ; echo -n > serviceperf.log'.
The files will be truncated, but still have identical filehandles and 
directory links, so nagios won't be disturbed.
This can, however, create a race condition (i think last in wins), so 
you might lose information if you do it this way, but it's the best I 
can think of without having a daemon hook the writes.

> Really I want to pass a command to Nagios to request the deletion of 
> these files.  However, if there is a delay between Nagios getting the 
> command, and Nagios deleting the files, information will be lost. 
> Because my program is sitting waiting for the deletion without parsing.
> 


> Ideally, I would want Nagios to write to a tmp file, then on getting a 
> command, close the file, move it to the true file, and open up a new tmp 
> file for it's self.  Or get Nagios to continuously close the file after 
> every write, making it delete-safe.  But this might effect performance??
> 
This would require severe diskthrashing, which is less than optimal.

> If any member has any ideas, I would be extremely interested.
> 
> Kind regards, Ben.
> 
> 
> -------------------------------------------------------
> This SF.Net email is sponsored by: SourceForge.net Broadband
> Sign-up now for SourceForge Broadband and get the fastest
> 6.0/768 connection for only $19.95/mo for the first 3 months!
> http://ads.osdn.com/?ad_id=2562&alloc_id=6184&op=click
> _______________________________________________
> Nagios-devel mailing list
> Nagios-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/nagios-devel
> 

-- 
Sourcerer / Andreas Ericsson
OP5 AB
+46 (0)733 709032
andreas.ericsson at op5.se


-------------------------------------------------------
This SF.Net email is sponsored by: SourceForge.net Broadband
Sign-up now for SourceForge Broadband and get the fastest
6.0/768 connection for only $19.95/mo for the first 3 months!
http://ads.osdn.com/?ad_id=2562&alloc_id=6184&op=click




More information about the Developers mailing list