RRDClean v0.40 - Released

Announcements concerning Plugins for Cacti

Moderators: Developers, Moderators

Locked
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

RRDClean v0.40 - Released

Post by gandalf »

The new release has been verified with cacti087g and PIA 2.8.
It is possible (and indeed, there have been no modifications to break PIA/Cacti support) that it will work with lower versions as well.
Find all the details at http://docs.cacti.net/plugin:rrdclean

Reinhard
dethmetaljeff
Posts: 4
Joined: Thu Jun 12, 2008 11:21 am

Re: RRDClean v0.40 - Released

Post by dethmetaljeff »

Thanks for the update. I can confirm it works on 0.8.7e however I did stumble on a bug in the rrdclean_create_path function in rrdmove.php

Seems like it's expecting a path to be passed into which makes perfect sense however, the function is still littered with dirname calls

Code: Select all

        if (!is_dir(dirname($path))) {
                if (mkdir(dirname($path), 0775)) {
                        if ($config["cacti_server_os"] != "win32") {
                                $owner_id      = fileowner($config["rra_path"]);
                                $group_id      = filegroup($config["rra_path"]);

                                if ((chown(dirname($path), $owner_id)) &&
                                        (chgrp(dirname($path), $group_id))) {
                                        return TRUE;
                                }else{
                                        cacti_log("ERROR: Unable to set directory permissions for '" . dirname($path) . "'", FALSE);
                                }
                        }
                }else{
                        cacti_log("ERROR: Unable to create directory '" . dirname($path) . "'", FALSE);
                }
        }

        return FALSE;
Since every time rrdclean_create_path is called the filename is already stripped by the dirname function, this has the unfortunate side effect of actually removing the last directory in the path....for example

Code: Select all

# here we're passing dirname(/var/www/cacti/rra/106/2130.rrd) to  rrdclean_create_path which ends up being /var/www/cacti/rra/106/
rrdclean_create_path(dirname($rrd_archive . "/" . $file["name"]));

# inside the function we take the passed in value (which is /var/www/cacti/rra/106/) and run dirname on it again...thus making it /var/www/cacti/rra/ so the 106 sub directory is never created
        if (!is_dir(dirname($path))) {
                if (mkdir(dirname($path), 0775)) {


Hope this makes sense. My fix was to remove the dirname calls in the rrdclean_create_path function since it clearly is expecting a path as a parameter and not a /full/path/to/file.txt
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Re: RRDClean v0.40 - Released

Post by gandalf »

I'm very sorry. The bug was known and resolved. But due to lack of time, I did not yet publish. This is now down: http://docs.cacti.net/plugin:rrdclean#rrdclean
R.
Locked

Who is online

Users browsing this forum: No registered users and 1 guest