[mrtg] Re: Backing up MRTG

Cook, Garry GWCOOK at mactec.com
Thu Mar 17 17:31:01 MET 2005


> I have some questions about backing up our MRTG installation.
> 
> 1. Due to space limitations, I am trying to only back up our .cfg and
> .rrd files, and our Perl scripts. Is there anything else that I
> should be backing up? 
>
[snip] 

I wrote a script a while ago to archive my .rrds to a backup directory.
I'll attach this below.
Works great for me, but naturally, YMMV. Perhaps you can use it.

Garry W. Cook, CCNA
Network Infrastructure Manager
MACTEC, Inc. - http://www.mactec.com/
303.273.5050 (Office) - 720.220.1862 (Mobile)


#!/bin/sh
#########################################################
#                                                       #
#       archiverrds - written by Garry W. Cook          #
#                     garry (at) cookbros (dot) net     #
#                                                       #
#       See usage() definition for details              #
#                                                       #
#########################################################

usage() {
        echo "
$0

        Round Robin Databases (.rrd) are created and/or updated every
        five minutes by MRTG/RRDtool. This is where our circuit usage
        data is stored.

        $0 copies the rrd files from their
        home at /var/www/html/mrtg/rrdfiles/ to /usr/local/etc/archive/
        and these files are then tarballed, gzip-ed, and deleted.

        $0 is run daily via cron.daily and
        automagically removes rrd tarballs older than 1 week.

        "
        exit 0
}

case $1 in
        -h|--help)        usage;;
esac


cd /usr/local/etc/archive

today=`date +%Y%m%d`

find /var/www/html/mrtg/rrdfiles/ -name *.rrd -printf %f\\n |
while read file
do
        cp /var/www/html/mrtg/rrdfiles/$file ./$file
done

tar --remove-files -zcf $today-rrds.tar.gz *.rrd

find . -mtime +6 -name \*rrds.tar.gz -print |
while read file
do
        rm $file
done

--
Unsubscribe mailto:mrtg-request at list.ee.ethz.ch?subject=unsubscribe
Archive     http://www.ee.ethz.ch/~slist/mrtg
FAQ         http://faq.mrtg.org    Homepage     http://www.mrtg.org
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi



More information about the mrtg mailing list