Remove old RRDs

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
User avatar
snapon_admin
Posts: 952
Joined: Mon Jun 10, 2013 10:39 am
Location: Kenosha, WI
Contact:

Remove old RRDs

Post by snapon_admin »

Over time we've gotten quite a few RRD files created that are no longer being used. Either the service was deleted, a new plugin was used to perform a specific check, or a service's name was changed at some point. All of these lead to a bunch of RRD files that essentially do nothing on the server but take up space. Is there any way to easily remove the unused RRDs from our system? I've just started looking into this so if there's an easy way to do this that I just haven't found yet I apologize.
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Remove old RRDs

Post by tmcdonald »

Sort by date with "find" or "ls" and remove anything with an older timestamp? There's nothing I know of built-in to XI for this.
Former Nagios employee
jwelch
Posts: 225
Joined: Wed Sep 05, 2012 12:49 pm

Re: Remove old RRDs

Post by jwelch »

Digging through my notes on cleaning up old check* files in /tmp.....

Using find to delete files last modified more than 2 days in current directory:
find . -maxdepth 1 -type f -mtime +2 -name "check*" -exec rm {} \;

You could use a version of this to remove the stale rrd files
under /usr/local/nagios/share/perfdata.

cd /usr/local/nagios/share/perfdata
find . -maxdepth 2 -type f -mtime +2 -name "*.rrd" -exec rm {} \;

If you want to get rid of the associated *.xml files (not actively updated),
you could write a script to use the find command without the '-exec rm {} \;'
to generate a list of files, parse the output, and delete the .rrd and .xml files
for each host.

Hopefully, you have decent backups. The dirs/files are owned by nagios, so
running any commands/scripts as nagios should limit the damage when the
system does what you told it to do (but not what you meant).

---
As always, if you or any member of your team is caught or killed,
the Secretary will disavow any knowledge of your actions.
Good Luck,
<Jim>
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Remove old RRDs

Post by abrist »

^This. jwlech is absolutely right.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Remove old RRDs

Post by Box293 »

snapon_admin wrote:Is there any way to easily remove the unused RRDs from our system?
The Performance Data Tool I created for Nagios XI can do exactly this.

Download from here: http://exchange.nagios.org/directory/Ad ... ol/details

Upload through Admin > System Extensions > Manage Components

The tool is located under the Tools menu.
Click the Delete tab
Select the perfdata folder you want
Change the Date Filter
Select the files and select an action next to the Perform Action button
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Locked