RRDTool Backups
I use RRDTool quite a bit in some of my code. Not to mention its heavy use in other open source projects. But backing up my RRD files was a pain. I can’t keep them in our network filesystem (OpenAFS) that has regular backups because the database files become corrupt. I can’t move the files from one machine to another because they are very platform/architecture specific. Further, I’ve got a whole directory tree full of RRD files.
I wanted a tool that would scan a directory tree full of RRDs, create a
mirror image of that tree elsewhere, and dump out the RRD files to XML.
So, each rlmtools/global/foo.rra
file gets dumped out to
/tmp/test/rlmtools/global/foo.xml
.
So, I wrote it
The first argument is the directory tree to copy, the next argument is where to root the newly created tree. A -b or -r argument is required for backup or restore mode, respectively.
In a similar vein I wrote a bash script that wraps the above for use with cron. The srcipt runs the above script, tars and compresses the output, and places the file (with a date in the file name) at a specifc directory. That directory is then pruned so that all backups are no older than about 2 weeks.