Changeset 30274
- Timestamp:
- Jan 13, 2011, 1:08:55 PM (15 years ago)
- Location:
- trunk/tools
- Files:
-
- 4 edited
-
czarclean.pl (modified) (4 diffs)
-
czarpoll.pl (modified) (2 diffs)
-
czartool/Config.pm (modified) (2 diffs)
-
czartool/czarconfig.xml (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/czarclean.pl
r29278 r30274 6 6 7 7 # local classes 8 use czartool::Config; 8 9 use czartool::CzarDb; 9 10 10 11 my $czarDbName = undef; 11 my $ from= undef;12 my $ to= undef;12 my $begin = undef; 13 my $end = undef; 13 14 my $interval = undef; 14 15 my $verbose = undef; 15 16 my $optimize = undef; 17 my $config = new czartool::Config(); 16 18 17 19 GetOptions ( 18 20 "dbname|d=s" => \$czarDbName, 19 21 "interval|i=s" => \$interval, 20 " from|f=s" => \$from,21 " to|t=s" => \$to,22 "begin|b=s" => \$begin, 23 "end|e=s" => \$end, 22 24 "optimize|o" => \$optimize, 23 25 "verbose|v" => \$verbose, … … 32 34 print "* UNKNKOWN: option @ARGV\n"; 33 35 } 34 if (!$ from) {36 if (!$begin) { 35 37 $quit=1; 36 print "* REQUIRED: choose a from date-b <datetime>\n";38 print "* REQUIRED: choose a begin date -b <datetime>\n"; 37 39 } 38 if (!$ to) {39 if($ from) {$to=$from;} else {$to="NULL";}40 print "* OPTIONAL: choose a to date -e <datetime> (default=$to)\n";40 if (!$end) { 41 if($begin) {$end=$begin;} else {$end="NULL";} 42 print "* OPTIONAL: choose an end date date -e <datetime> (default=$end)\n"; 41 43 } 42 44 if (!$czarDbName) { … … 45 47 } 46 48 if (!$interval) { 47 $interval = "30 MINUTE"; 48 print "* OPTIONAL: choose time interval -i <'30 MINUTE'|'1 hour'|etc> (default=$interval)\n"; 49 print "* OPTIONAL: choose time interval -i <'30 MINUTE'|'1 hour'|etc> (default=".$config->getCzarCleanupInterval().")\n"; 49 50 } 50 51 if (!$optimize) { 51 52 $optimize = 0; 52 print "* OPTIONAL: optimize database after cleanup -o <'30 MINUTE'|'1 hour'|etc> (default=$interval)\n";53 print "* OPTIONAL: optimize database after cleanup -o (default=$optimize)\n"; 53 54 } 54 55 print "*\n*******************************************************************************\n"; … … 56 57 if ($quit) { exit; } 57 58 58 59 my $save_temps = 0; 60 61 62 my $czarDb = new czartool::CzarDb($czarDbName, "ippdb01", "ipp", "ipp", 0, $save_temps); # TODO last arg here is save_temps, should get as arg 59 my $czarDb = $config->getCzarDbInstance(); 63 60 64 61 my $labels = undef; 65 62 66 63 67 $czarDb->cleanupDateRange($ from, $to, $interval);64 $czarDb->cleanupDateRange($begin, $end, $config->getCzarCleanupInterval()); 68 65 if ($optimize) {$czarDb->optimize();} -
trunk/tools/czarpoll.pl
r30250 r30274 139 139 # create metrics for last 24 hours 140 140 print "* Creating metrics for last 24 hours\n"; 141 # TODO hardcoded path needs to be in config142 141 my $dayMetrics = new czartool::DayMetrics($config, 1, 0, $today); 143 142 $dayMetrics->writeHTML(); … … 149 148 # now cleanup tables from yesterday and optimize 150 149 print "* New day - performing cleanup\n"; 151 $czarDb->cleanupDateRange($yesterday, $yesterday, "30 MINUTE");150 $czarDb->cleanupDateRange($yesterday, $yesterday, $config->getCzarCleanupInterval()); 152 151 $czarDb->optimize(); 153 152 $lastDayDailyTasks = $yesterday; -
trunk/tools/czartool/Config.pm
r30250 r30274 61 61 $self->{czaruser} = $xc->findvalue('//czardatabase/user'); 62 62 $self->{czarpassword} = $xc->findvalue('//czardatabase/password'); 63 $self->{czardbcleanupinterval} = $xc->findvalue('//czardatabase/cleanupinterval'); 63 64 64 65 # roboczar … … 105 106 ########################################################################### 106 107 # 108 # Returns the interval used in czarDB cleanup 109 # 110 ########################################################################### 111 sub getCzarCleanupInterval { 112 my ($self) = @_; 113 return $self->{czardbcleanupinterval}; 114 } 115 116 ########################################################################### 117 # 107 118 # Returns the interval after which we consider a server to be down/stopped 108 119 # -
trunk/tools/czartool/czarconfig.xml
r30250 r30274 25 25 <user>ipp</user> 26 26 <password>ipp</password> 27 <cleanupinterval>30 MINUTE</cleanupinterval> 27 28 </czardatabase> 28 29
Note:
See TracChangeset
for help on using the changeset viewer.
