Cacti (home)ForumsRepositoryDocumentation
Cacti: offical forums and support  

 FAQFAQ   SearchSearch   MemberlistMemberlist    RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in    


rrdCleaner - cleans cactis rrd dir from unused rrd's
Goto page Previous  1, 2, 3, 4, 5, 6, 7, 8, 9  Next
 
Post new topic   Reply to topic    Cacti Forum Index -> Plugin Announcements
Author Message
gandalf
Developer


Joined: 02 Dec 2004
Posts: 12206
Location: Muenster, Germany

PostPosted: Sun Nov 13, 2005 7:00 am    Post subject: Reply with quote

I'd like to volunteer for that task (cause I'm waiting for the 0.9 stuff ). But let me first have a look at the current code, cause my php knowledge is not that of an expert. For testing purpose: is 0.8.6 branch compatible with 0.8.6f mysql structure? And how to get new code into the branch?
I'd even like to introduce something like a "confirmation" checkbox. Only confirmed deletes should be worked on. So there's a chance to have a look at them with more care. Or am I mistaken?
Reinhard
Back to top
TheWitness
Developer


Joined: 14 May 2002
Posts: 9671
Location: MI, USA

PostPosted: Sun Nov 13, 2005 1:33 pm    Post subject: Reply with quote

Quote:
For testing purpose: is 0.8.6 branch compatible with 0.8.6f mysql structure?


Yes

Quote:
And how to get new code into the branch?


E-mail me

Quote:
I'd even like to introduce something like a "confirmation" checkbox. Only confirmed deletes should be worked on. So there's a chance to have a look at them with more care. Or am I mistaken?


If you look at host.php you will see a real good skeleton for code. It provides dropdowns, filters and the like. Not too bad.

Larry
Back to top
cigamit
Developer


Joined: 07 Apr 2005
Posts: 945
Location: B/CS Texas

PostPosted: Sun Nov 13, 2005 3:31 pm    Post subject: Reply with quote

I have toyed with the idea of making a Plugin out of this. The user would be able to remove any unreferenced RRDs that haven't been updated in X number of days, either by selecting then for immediate removal, or automatically by setting a schedule.

How I see the scheduler working would be like this. The user sets it to archive old rrds after X days, in which it will move the RRDs to a seperate directory. From there, it will delete items after they are X+Y days old. Have it run immediately after the poller at midnight everynight (configurable ofcourse). You can even have it email you a list of all RRDs that it moved and deleted after that nights purging. Almost everything would be configurable ofcourse, you could set it not to delete, or not to archive, email, the amount of time, ect...

Write access to directory wouldn't be a problem, since it would run in the context of the normal poller process. I think you should also be able to set exclusions, so that certain files will never be removed.
Back to top
Tut`



Joined: 21 Jul 2005
Posts: 11

PostPosted: Mon Nov 14, 2005 10:08 am    Post subject: Reply with quote

I did a quick and dirty plugin based on rrdcleanr.php by ottob
It requires the Plugin Architecture

Do NOT forget to give correct permissions for apache user on rras folder

Also, fill in Backup path in :
Console > settings > paths > Backup directory

And give yourself some permissions :p (console > utilies > user managment > Clean rra)



rrdclean.tar.gz
 Description:

Download
 Filename:  rrdclean.tar.gz
 Filesize:  2.11 KB
 Downloaded:  314 Time(s)

Back to top
spignataro



Joined: 07 Nov 2005
Posts: 41

PostPosted: Mon Nov 14, 2005 11:30 am    Post subject: Reply with quote

lvm wrote:
spignataro wrote:
yes it is in my root directory. I only run cacti on this machine.
To be sure: you placed rrdcleaner into C:\apache2\Apache2\htdocs\rrdcleaner.php. But it must go into something like C:\apache2\Apache2\cacti\rrdcleaner.php where C:\apache2\Apache2\cacti is assumed to be your cacti directory (e.g. where poller.php sits).
Reinhard


my cacti installation resides in c:\apache2\Apache2\htdocs

that is the root of my cacti. I dont have a folder called cacti because there was no need for this.

poller.php resides in this folder as well. Does that help?
Back to top
spignataro



Joined: 07 Nov 2005
Posts: 41

PostPosted: Mon Nov 14, 2005 11:36 am    Post subject: Reply with quote

Tut` wrote:
I did a quick and dirty plugin based on rrdcleanr.php by ottob
It requires the Plugin Architecture

Do NOT forget to give correct permissions for apache user on rras folder

Also, fill in Backup path in :
Console > settings > paths > Backup directory

And give yourself some permissions :p (console > utilies > user managment > Clean rra)


i have the plugin architecture installed. But i am having a problem with this plugin. Might be that it was compressed wrong...is it possible to make it .zip instead of .tar.gz

Here is the code after i uncompressed it:


Code:
<?
/*
Plugin RRDCleaner by Tut`
based on RRDcleanr.php by berger@hk-net.de ( 12/2004 )
(http://forums.cacti.net/viewtopic.php?t=5852)

Do NOT forget to add "$plugins['rrdclean'];" in include/config.php  :)

*/


chdir('../../');
include("./include/auth.php");

$ds_actions = array(
   1 => "Delete",
   2 => "Backup"
);

$rra_path = $config["base_path"] . "/rra";


if (isset($_POST['drp_action'])) {
   do_rrd();
}else{
   lr])) {
);
l"h funp_act {
   lr])) {lseglobal ;

$ds_acti,;

$rra_pra"   "./incl_onclude("./incluiew_headeaner.php"   html_ust_box("<strong>on              t t= array(
yT%
y["blors["php"   h"]y4
ycent   h"yust_box(php"   h_checkng>o   1 => "File name"yLast modified"ysize")a_pa   $files_unuRRDc= add_files(a_pa   $ic= 0ustet($sizeof($files_unuRRD) > 0_rrdpa   to each($files_unuRRD as $unuRRD_file_rrd(   d(    0_rrd stfiles_unuR}(th = $conf";

"f";$unuRRD_file_;d(    nuR}s[]fig[es_unuR};d(    0_rrmtimtfiles_umtimt(th = $conf";

"f";$unuRRD_file_;dd(   to m_alt   hnate_row_"blor(["blors["to m_alt   hnate1"]y["blors["to m_alt   hnate2"]y[i);?>d(      <td>d(         <?

*/print;$unuRRD_file;?>d(      </td>d(      <td>d(         <?

*/print;dateox( ttttdttttdttttdttttdttttdttttdttttdttttdttttdttttdttttdttttdttttdttttdttttdttttdttttdttt_hp"   h"st mot   hnate1")ttdttttdttttdttttdttttdttttdttttdttttround((row_"blor/1024/1024), 2); ?> MB (<?tdttttdtow_"blor( ?>)ttttdttttdttttdt style="ttdttttdttttnuRR   $ic= 0u_style()ttd" width="1%" align="right"tttdtttinpunclype='   $ic= 0u' style='marp"): 0px;'($fil='   $k_tdttttdttttdttttdttttdttttd' title="ttdttttdttttttttdttttdttttd"dttttdttttdtttt/tr>ttdttdttt$i++(["b}tdttt<tbgd>d(   ='#6d88ad'tdttttdt class='textSubHs(a_pDark' d>dspan="2">   h_checkTotalFile namedttttdttttdt class='textSubHs(a_pDark' d>dspan="2">   h_check<?techotround(tet($_sum(_alt   h)/1024/1024, 2); ?> MBFile namedttttdttt/tr> ttdttdtt_actrst_tg.phe()t
   ./inclui   tdtttt"<tr>tttt<em>No  nuR}s[et(s</em>dttttt/tr>\n"t
   .
add_filendx(phpfainc)t
   draw        _dropdown(           )t
   tdtttt"<de/cm>\n"t
   
yT%
y["blors["php"   bottom_footycent   h"}"   html_usnuRRD_file_rong>on     t= arrayd(   result_almysql_quer$siSELECT[etdlors["FROM poll_paitem. "/r   wheof((rold_almysql_fetch
*/p(   result./incliles_unudbnate_suble (le rchr(rold[0)a_p/"),1 "/r   .
ad$handlm_alopendup"  t= ar); r   wheof((roilm_alRRDddup((rhandlm./in r   rd stfuble (roilm,-3) == "etd"/in r   rrd st!in_tet($sroilm, les_unudb./incli   iles_unuRRD asnate_row_"(["b   .
b   . r   .
t_ao asup" handlm.(["return les_unuRRD aser.phphtml_us_oncluderong>on     t= arrayiles_unuRRD as $unuRRD_file_rrt_actrst_tg.phe()t
rrd st_acti,;

$rra_pra"   " == "2")ncliletdlmovm_aldb_fetch
cell(eletdlm 'Pct value from acttings wherles_un ='ovm_aldb'",''_alt   acti,ovm_aldb_f= ''_iles_movm_aldb_feors["to m_a"/s $unu"tdttt
t!in_tet/in t= am_aldb)_iles_mkn t= am_aldb)tdttt
        }T%
y["blors["php"   h"]y4
ycent   h"yu((roilm("<s($var,$val"et le_;d(;

$rli   ilesin_terlg("^dttt(.*)eron$   hnavar, $mhe(h024i   iles_$(phude/= $mhe(h02[1) {ls.in r; st!in(t($sroilm,(phude,unuRRD aser.phli   iles_uswie(hti,;

$rra_pra"   " == "_iles_trst { "1" :les_trsin_taselinklors["to m_alt   hnate(phude)_iles_trttt"<tr>$(phude/alt on']))d!   
ylui   tdttt_trttt"<tr>$(phude/alt Error :}s[aboilautdn']))!   
ylbup(k;les_trst { "2" :les_trsin(res_unlors["to m_alt   hnate(phude, movm_aldb_alt   hnate(phude)_iles_trttt"<tr>$(phude/alt Mldbd!   
ylui   tdttt_trttt"<tr>$(phude/alt Error :}s[aboilautaldb!   
ylbup(k;
llui   tdttt_t"<t


doest look right huh!
Back to top
cigamit
Developer


Joined: 07 Apr 2005
Posts: 945
Location: B/CS Texas

PostPosted: Mon Nov 14, 2005 11:42 am    Post subject: Reply with quote

Tut` wrote:
I did a quick and dirty plugin based on rrdcleanr.php by ottob
It requires the Plugin Architecture

Do NOT forget to give correct permissions for apache user on rras folder

Also, fill in Backup path in :
Console > settings > paths > Backup directory

And give yourself some permissions :p (console > utilies > user managment > Clean rra)


Ya, something seems to be wrong with the archive. Would you mind re-upping it?
Back to top
rony
Developer/Forum Admin


Joined: 17 Nov 2003
Posts: 5448
Location: Wisconsin, USA

PostPosted: Mon Nov 14, 2005 11:49 am    Post subject: Reply with quote

Looks like it was ftp transfered ascii mode..
Back to top
spignataro



Joined: 07 Nov 2005
Posts: 41

PostPosted: Mon Nov 14, 2005 12:09 pm    Post subject: Reply with quote

no i didnt ftp it...that is an exact extract....
Back to top
cigamit
Developer


Joined: 07 Apr 2005
Posts: 945
Location: B/CS Texas

PostPosted: Mon Nov 14, 2005 12:12 pm    Post subject: Reply with quote

spignataro wrote:
no i didnt ftp it...that is an exact extract....


I don't think he was referring to you
Back to top
rony
Developer/Forum Admin


Joined: 17 Nov 2003
Posts: 5448
Location: Wisconsin, USA

PostPosted: Mon Nov 14, 2005 2:19 pm    Post subject: Reply with quote

I'm not, I have seen this before, ascii mode used on a tar.gz file..

Someone did it, just don't know who..
Back to top
spignataro



Joined: 07 Nov 2005
Posts: 41

PostPosted: Mon Nov 14, 2005 2:22 pm    Post subject: Reply with quote

cigamit wrote:
spignataro wrote:
no i didnt ftp it...that is an exact extract....


I don't think he was referring to you


o....doh!
Back to top
Tut`



Joined: 21 Jul 2005
Posts: 11

PostPosted: Mon Nov 14, 2005 6:19 pm    Post subject: Reply with quote

oops =)

i said it was 'dirty' :p


There is a zip archive!



rrdclean.zip
 Description:

Download
 Filename:  rrdclean.zip
 Filesize:  2.35 KB
 Downloaded:  296 Time(s)

Back to top
rony
Developer/Forum Admin


Joined: 17 Nov 2003
Posts: 5448
Location: Wisconsin, USA

PostPosted: Mon Nov 14, 2005 6:29 pm    Post subject: Reply with quote

"dirty"
Back to top
cigamit
Developer


Joined: 07 Apr 2005
Posts: 945
Location: B/CS Texas

PostPosted: Mon Nov 14, 2005 9:31 pm    Post subject: Reply with quote

Thanks for getting this up and running as a plugin. Let me see if I can grab a broom and see if I can clean up some of the "dirt".

I have attached a cleaned up version of the plugin. The realm settings were slightly off, causing the link to not show. I also changed it to show the moved / deleted items in a nicer table at the top. I even did some simple code cleaning

Let me know how its works for you.



rrdclean.zip
 Description:
RRD Cleaner (minus the dirt)

Download
 Filename:  rrdclean.zip
 Filesize:  2.41 KB
 Downloaded:  347 Time(s)

Back to top
Display posts from previous:   
Post new topic   Reply to topic    Cacti Forum Index -> Plugin Announcements All times are GMT - 5 Hours
Goto page Previous  1, 2, 3, 4, 5, 6, 7, 8, 9  Next
Page 2 of 9

 



Powered by phpBB © 2001, 2005 phpBB Group