rrdCleaner - cleans cactis rrd dir from unused rrd's

Announcements concerning Plugins for Cacti

Moderators: Developers, Moderators

Locked
User avatar
fmangeant
Cacti Guru User
Posts: 2345
Joined: Fri Sep 19, 2003 8:36 am
Location: Sophia-Antipolis, France
Contact:

Post by fmangeant »

Many many thanks gilles for this plugin :D
[size=84]
[color=green]HOWTOs[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15353]Install and configure the Net-SNMP agent for Unix[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=26151]Install and configure the Net-SNMP agent for Windows[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=28175]Graph multiple servers using an SNMP proxy[/url][/list]
[color=green]Templates[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15412]Multiple CPU usage for Linux[/url]
[*][url=http://forums.cacti.net/viewtopic.php?p=125152]Memory & swap usage for Unix[/url][/list][/size]
User avatar
timi
Cacti User
Posts: 240
Joined: Wed Nov 09, 2005 8:35 am
Location: Timisoara, Romania
Contact:

Post by timi »

this plugin works great, 10q
airwalk
Cacti User
Posts: 103
Joined: Fri Aug 18, 2006 11:22 am
Location: MSK, RU

Post by airwalk »

nice work. thank you for another handy plugin.
User avatar
TFC
Cacti Pro User
Posts: 739
Joined: Wed Apr 09, 2003 2:17 am
Location: Izmir/Turkey

Post by TFC »

Hi,
I installed rrdcleaner.
The plugin checks unused rrd files correctly.
But when I try to delete, I get this message:
aggregator_maltepe_traffic_in_816.rrd Error : unable to delete!
I think this is about permission problem.
How can I fix it?
Here is the permission of rrd file :
[root@citizen rra]# ls -la agg*816*
-rw-r--r-- 1 nobody nobody 945944 Mar 2 2006 aggregator_maltepe_traffic_in_816.rrd
And in crontab, poller.php runs with root user:
*/5 * * * * root /usr/bin/php /var/www/html/cacti/poller.php > /dev/null 2>&1
Is there any information needed to solve the problem?
spoofiz
Posts: 42
Joined: Tue Feb 28, 2006 5:37 am
Location: Koeln - D

Post by spoofiz »

Original Post :
-------------------------------------------------
I've installed the rrdcleaner plugin but i don't see anything new on my cacti ( 0.8.6i + plugin arch V1.1) but the Backup directory field in Console>Settings>Paths.

What do I have to do to see the rrdcleaner part ?
Do i have a permission problem ?
-------------------------------------------------


EDIT : Nevermind, forgot to put the access right (Realm Permissions) in user management ...
cacti 0.8.6i | cmd.php / Plugin arch + Thold
mysql 5.0.18 | net-snmp 5.1.2-11 | rrdtool 1.2.13 | apache 2.2.0 | php 5.1.4 | RH4EL
MaffooClock
Posts: 17
Joined: Wed Jul 12, 2006 11:25 pm

Post by MaffooClock »

In case this helps anyone else:

I had the "Permission denied" unlink() error, but I just knew I had the permissions set right. Yet, I continued to have the error.

I discovered a comment on the unlink() page at php.net:
http://www.php.net/manual/en/function.unlink.php#59122

In it, one commenter says you must remember to set approprriate permissions on the folder as well. So for Cacti users, if you continue to have permission issues, make sure your web server user/group has write permissions on the 'rra' folder itself.
MaffooClock
Posts: 17
Joined: Wed Jul 12, 2006 11:25 pm

Post by MaffooClock »

I hope I didn't miss this same issue earlier in this thread...

After I got this plugin installed, I was able to delete dozens of old rrd files. After that initial delete run, I noticed this plugin lists files that are being used (some, not all). I know this because after each run of poller.php, the file's last access time (in this list) is incremented by five minutes! And I checked the data sources for those file names and they are, in fact, being used. After browsing the graphs, I am seeing a lot of blank graphs (some, not all) and I have a feeling the previous delete action deleted some in-use rrd files.

Yes, the clock is correct on the Cacti PC.
Attachments
Screenshot
Screenshot
screenshot.jpg (90.99 KiB) Viewed 10718 times
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

At the very early days (before it became a plugin), I dealt "a bit" with it. So my knowledge is a bit old. But I'm quite sure, that there are circumstances, where this plugin fails; e.g. externally updated rrd files. Nevertheless, I do like it. But I would always pay attention to the last update timestamp (that's why I added it) and never delete files with recent update timestamps.
Reinhard
benton2006
Cacti User
Posts: 50
Joined: Sun Apr 01, 2007 12:47 am

Post by benton2006 »

I meet an error like that:
Warning: Invalid argument supplied for foreach() in /var/www/html/cacti/plugins/rrdclean/rrdcleaner.php on line 38


But Gilles' patch can't be downloaded, who can give me a download link??
nocrack
Posts: 3
Joined: Thu Jun 22, 2006 8:54 am

Post by nocrack »

Hello all

I have the same probleme than benton 2006 !!!
someone can help me ?


Thanks
Voiper99
Cacti User
Posts: 276
Joined: Thu Mar 01, 2007 5:43 pm
Location: Melbourne, Australia

Post by Voiper99 »

I too am having the issue where it lists some RRDs which are still being used (the timestap updates every 5 minutes). I think a good idea would be to add a feature so that you can "sort by" the columns (especially the Last Modified column) that way you can easily pick out the unused RRDs from the in use RRDs.
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

Please find the new version of RRDCleaner, V0.3, attached. From README:

Code: Select all

/*******************************************************************************

    Author ......... Reinhard Scheck
    Contact ........ gandalf @ cacti forums
    Home Site ...... http://www.cacti.net
    Program ........ Cacti RRD file Cleaner
    Version ........ 0.3
    Purpose ........ Delete unused rrd files
    first published by ..... berger@hk-net.de ( 12/2004 )
    first plugin by ........ Tut
    modifications by ....... gilles

*******************************************************************************/


----[ Purpose

    This plugin analyzes many cacti db structures
    to determine unused rrd files.

----[ Features

    1) allows for filtering and sorting on
       - rrd file name
       - date/timestamp of last rrd file modification
       - size
    2) file delete is done by the poller
       This avoids permission errors or security issues.
       The same instance that creates rrd files, the poller,
       will be used for deletion as well.

----[ Prerequisites

    Before you install RRDCleaner, you need to have met the following pre-requisites:

    1) Cacti 0.8.6j is fully supported along with plugin arch V1.1
    2) Other versions: on your own risk, but not yet tested

----[ Installation

    Install is similar to other plugins.
	Realm ID 36 is used. No sql import necessary

----[ Usage


----[ Additional Help?

    If you need additional help, please goto forums.cacti.net.

----[ Possible Bugs?

    If you figure out this problem, let me know!!!

----[ Special Thanks

	I want to thank all authors mentioned in the headers

----[ Future Changes


----[ Changelog
    --- SVN ---

Reinhard
Attachments
A screenshot.<br />Please notice the filter function.<br />The last line holds a grand total of all files matching the current filter.
A screenshot.
Please notice the filter function.
The last line holds a grand total of all files matching the current filter.
rrdcleaner.png (91.64 KiB) Viewed 9338 times
Last edited by gandalf on Sun Oct 21, 2007 2:54 am, edited 2 times in total.
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

Some few enhacements

Reformatted messages
Rounding of filesize
Omit rereading files when sorting or filtering

Reinhard
Last edited by gandalf on Sun Oct 21, 2007 2:52 am, edited 1 time in total.
apperrault
Cacti User
Posts: 379
Joined: Fri Feb 16, 2007 11:37 am
Location: Emeryville, CA
Contact:

Post by apperrault »

Gandolf,
i get the following message after installing the most recent version.

Code: Select all

Notice: Undefined index: rrdcleaner.php:restart in E:\cacti\lib\functions.php on line 1422
please let me know how to proceed. i get this at the top of the rrdclean page.

app
[b]Cacti Version[/b] - 0.8.7b
[b]Plugin Architecture[/b] - 2.2 Beta
[b]Poller Type[/b] - CMD.php
[b]Server Info[/b] - Linux 2.6.9-78.0.1.ELsmp
[b]Web Server[/b] - Apache/2.0.52 (Red Hat)
[b]PHP[/b] - 4.3.9
[b]MySQL[/b] - 4.1.22
[b]RRDTool[/b] - 1.2.23
[b]SNMP[/b] - 5.1.2
[b]Plugins[/b][list]Global Plugin Settings (settings - v0.5)
SuperLinks (superlinks - v0.72)
Host Info (hostinfo - v0.2)
Report Creator (reports - v0.3)
Update Checker (update - v0.4)
Realtime for Cacti (realtime - v0.35)
Cacti Log View (clog - v1.1)
RRD File Cleaner (rrdclean - v0.36)
Network Discovery (discovery - v0.9)
Uptime (uptime - v0.4)[/list]
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

Sorry for that missing line. New Code attached, only removed this error.
Reinhard
Attachments
rrdclean-031.tgz
Updated Code
(6.85 KiB) Downloaded 490 times
Locked

Who is online

Users browsing this forum: No registered users and 0 guests