service performance logs

Don Badrak dbadrak at tco.census.gov
Mon Jul 28 16:38:08 CEST 2003


Lane,

On Mon, 28 Jul 2003, Williams, P. Lane wrote:

> I was wondering if anyone has a standard way of rotating your service
> performance logs.  I've been letting mine go for some time now and it has
> hit the 2G limit and of course that killed the Nagios process.  So I
> manually rotated the thing and all is well.
>
> I've tried using logrotate in the past, but after the rotation Nagios stops
> logging to it.  I assume because the application has a lock on the file and
> when rotated that changes.

I have this crontab entry under the "nagios" username.

59 23 * * *     /usr/local/nagios/bin/rotate-perfdata.sh > /dev/null 2>&1

I use this script:

#!/bin/sh
# /usr/local/nagios/bin/rotate-perfdata.sh

BASEDIR="/usr/local/nagios"
VARDIR="$BASEDIR/var"

DATE=`date +%Y%m%d`
sleep 60

for file in host service
do
   old="$VARDIR/${file}-perfdata.out"
   new="$VARDIR/${file}-perfdata.$DATE.out"
   mv $old $new && gzip $new
done
===

It's pretty simple, but it suits my needs.  It probably needs more features, like
putting all files in a YYYYMM directory, so the /usr/local/nagios/var directory doesn't
fill up.  Or move them to a new location.  Whatever you'd like.

Don
-- 
Don Badrak <dbadrak at census.gov>              301.763.5534 work
Telecommunications Office                    301.457.4438 fax
U.S. Bureau of the Census
Suitland MD, USA



-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
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