Index: /trunk/tools/czarclean.pl
===================================================================
--- /trunk/tools/czarclean.pl	(revision 30273)
+++ /trunk/tools/czarclean.pl	(revision 30274)
@@ -6,18 +6,20 @@
 
 # local classes
+use czartool::Config;
 use czartool::CzarDb;
 
 my $czarDbName = undef;
-my $from = undef;
-my $to = undef;
+my $begin = undef;
+my $end = undef;
 my $interval = undef;
 my $verbose = undef;
 my $optimize = undef;
+my $config = new czartool::Config();
 
 GetOptions (
         "dbname|d=s" => \$czarDbName,
         "interval|i=s" => \$interval,
-        "from|f=s" => \$from,
-        "to|t=s" => \$to,
+        "begin|b=s" => \$begin,
+        "end|e=s" => \$end,
         "optimize|o" => \$optimize,
         "verbose|v" => \$verbose,
@@ -32,11 +34,11 @@
     print "* UNKNKOWN: option                          @ARGV\n";
 }
-if (!$from) {
+if (!$begin) {
     $quit=1;
-    print "* REQUIRED: choose a from date                 -b <datetime>\n";
+    print "* REQUIRED: choose a begin date                -b <datetime>\n";
 }
-if (!$to) {
-    if($from) {$to=$from;} else {$to="NULL";}
-    print "* OPTIONAL: choose a to date                   -e <datetime>                   (default=$to)\n";
+if (!$end) {
+    if($begin) {$end=$begin;} else {$end="NULL";}
+    print "* OPTIONAL: choose an end date date            -e <datetime>                   (default=$end)\n";
 }
 if (!$czarDbName) {
@@ -45,10 +47,9 @@
 }
 if (!$interval) {
-    $interval = "30 MINUTE";
-    print "* OPTIONAL: choose time interval               -i <'30 MINUTE'|'1 hour'|etc>   (default=$interval)\n";
+    print "* OPTIONAL: choose time interval               -i <'30 MINUTE'|'1 hour'|etc>   (default=".$config->getCzarCleanupInterval().")\n";
 }
 if (!$optimize) {
     $optimize = 0;
-    print "* OPTIONAL: optimize database after cleanup    -o <'30 MINUTE'|'1 hour'|etc>   (default=$interval)\n";
+    print "* OPTIONAL: optimize database after cleanup    -o                              (default=$optimize)\n";
 }
 print "*\n*******************************************************************************\n";
@@ -56,13 +57,9 @@
 if ($quit) { exit; }
 
-
-my $save_temps = 0;
-
-
-my $czarDb = new czartool::CzarDb($czarDbName, "ippdb01", "ipp", "ipp", 0, $save_temps); # TODO last arg here is save_temps, should get as arg
+my $czarDb = $config->getCzarDbInstance();
 
 my $labels = undef;
 
 
-$czarDb->cleanupDateRange($from, $to, $interval);
+$czarDb->cleanupDateRange($begin, $end, $config->getCzarCleanupInterval());
 if ($optimize) {$czarDb->optimize();}
Index: /trunk/tools/czarpoll.pl
===================================================================
--- /trunk/tools/czarpoll.pl	(revision 30273)
+++ /trunk/tools/czarpoll.pl	(revision 30274)
@@ -139,5 +139,4 @@
                 # create metrics for last 24 hours
                 print "* Creating metrics for last 24 hours\n";
-                # TODO hardcoded path needs to be in config
                 my $dayMetrics = new czartool::DayMetrics($config, 1, 0, $today); 
                 $dayMetrics->writeHTML();
@@ -149,5 +148,5 @@
                 # now cleanup tables from yesterday and optimize
                 print "* New day - performing cleanup\n";
-                $czarDb->cleanupDateRange($yesterday, $yesterday, "30 MINUTE");
+                $czarDb->cleanupDateRange($yesterday, $yesterday, $config->getCzarCleanupInterval());
                 $czarDb->optimize();
                 $lastDayDailyTasks = $yesterday;
Index: /trunk/tools/czartool/Config.pm
===================================================================
--- /trunk/tools/czartool/Config.pm	(revision 30273)
+++ /trunk/tools/czartool/Config.pm	(revision 30274)
@@ -61,4 +61,5 @@
     $self->{czaruser} = $xc->findvalue('//czardatabase/user');
     $self->{czarpassword} = $xc->findvalue('//czardatabase/password');
+    $self->{czardbcleanupinterval} = $xc->findvalue('//czardatabase/cleanupinterval');
 
     # roboczar
@@ -105,4 +106,14 @@
 ###########################################################################
 #
+# Returns the interval used in czarDB cleanup
+#
+###########################################################################
+sub getCzarCleanupInterval {
+    my ($self) = @_;
+    return $self->{czardbcleanupinterval};
+}
+
+###########################################################################
+#
 # Returns the interval after which we consider a server to be down/stopped
 #
Index: /trunk/tools/czartool/czarconfig.xml
===================================================================
--- /trunk/tools/czartool/czarconfig.xml	(revision 30273)
+++ /trunk/tools/czartool/czarconfig.xml	(revision 30274)
@@ -25,4 +25,5 @@
     <user>ipp</user>
     <password>ipp</password>
+    <cleanupinterval>30 MINUTE</cleanupinterval>
   </czardatabase>
 
