Index: trunk/ippMonitor/czartool/czarplot.pl
===================================================================
--- trunk/ippMonitor/czartool/czarplot.pl	(revision 38252)
+++ trunk/ippMonitor/czartool/czarplot.pl	(revision 38258)
@@ -30,7 +30,9 @@
 my $log = undef;
 my $psps = undef;
+my $project = 'gpc1';
 
 GetOptions (
         "label|l=s" => \$label,
+        "project=s" => \$project,
         "stage|s=s" => \$stage,
         "timeinpast|p=s" => \$timeinpast,
@@ -110,12 +112,16 @@
 my $newDayTime =  $config->getMetricsStartTime();
 
+my $projectDb = $config->getDbInstanceForProject($project);
+die "Failed to open database for $project.\n" unless $projectDb;
+
+
 my $plotter = undef;
 if ($savingToFile) {
 
-    $plotter = czartool::Plotter->new_file($config, $path, $save_temps);
+    $plotter = czartool::Plotter->new_file($config, $projectDb, $path, $save_temps);
 }
 else {
 
-    $plotter = czartool::Plotter->new_display($config, $save_temps);
+    $plotter = czartool::Plotter->new_display($config, $projectDb, $save_temps);
 }
 
Index: trunk/ippMonitor/czartool/czarpoll.pl
===================================================================
--- trunk/ippMonitor/czartool/czarpoll.pl	(revision 38252)
+++ trunk/ippMonitor/czartool/czarpoll.pl	(revision 38258)
@@ -26,5 +26,5 @@
 
 GetOptions (
-        "period|p=s" => \$period, # TODO more Db args
+        "period|p=s" => \$period,
         );
 
@@ -35,6 +35,11 @@
 my $nebulous = new czartool::Nebulous($czarDb);
 my $pantasks = new czartool::Pantasks();
-my $plotter = czartool::Plotter->new_file($config, $config->getGnuplotPath(), $save_temps);
-
+
+# We have a top level directory that gets general plots and then one for each database
+my $plotter0 = czartool::Plotter->new_file($config, undef, $config->getGnuplotPath(), $save_temps);
+
+# for now hardcode two databases. Later I'll look into handling a variable number
+my $plotter1 = czartool::Plotter->new_file($config, $gpc1Db, $config->getGnuplotPath() . "/gpc1", $save_temps);
+my $plotter2 = czartool::Plotter->new_file($config, $gpc2Db, $config->getGnuplotPath() . "/gpc2", $save_temps);
 
 my @stages = (
@@ -59,4 +64,7 @@
         "merged",
         "deleted_local");
+
+# The ippToPsps pages are no longer operational
+@ippToPspsStages = ();
 
 my @allStages = (@stages, @ippToPspsStages);
@@ -167,4 +175,6 @@
     while (1) {
 
+        my $iterationStartTime = time();
+
         # sort out times
         $today = strftime('%Y-%m-%d', localtime);
@@ -172,8 +182,9 @@
         $end = $czarDb->getNowTimestamp();
 
-        # if before 18:00 today, then start plots from 18:00 yesterday
-        if ($czarDb->isBefore($end, "$today $newDayTime")) {$begin = "$yesterday $newDayTime";}
-        # if after 18:00 today, then perform some daily tasks and start plots from 18:00 today
-        else {
+        if ($czarDb->isBefore($end, "$today $newDayTime")) {
+            # if before $newDayTime today (configured to 18:00), then start plots from $newDayTime yesterday
+            $begin = "$yesterday $newDayTime";
+        } else {
+            # if after $newDayTime today (configured to 18:00), then perform some daily tasks and start plots from $newDayTime  today
 
             $begin = "$today $newDayTime";
@@ -186,9 +197,9 @@
                 # create metrics for last 24 hours
                 print "* Creating metrics for last 24 hours\n";
-                my $dayMetrics = new czartool::DayMetrics($config, 1, 0, $today);
+                my $dayMetrics = new czartool::DayMetrics($config, $gpc1Db, 1, 0, $today);
                 $dayMetrics->writeHTML();
 
                 # now update metrics index page
-                my $metricsIndex = new czartool::MetricsIndex($config, 1, 0);
+                my $metricsIndex = new czartool::MetricsIndex($config, $gpc1Db, 1, 0);
                 $metricsIndex->writeHTML();
 
@@ -210,7 +221,7 @@
         print "* Checking Nebulous\n";
         $nebulous->updateClusterSpaceInfo();
-        $plotter->plotStorageTimeSeries($czarDb->subtractInterval($begin, "1 WEEK") , $end);
-        $plotter->plotDiskUsageHistogram();
-        $plotter->plotDiskUsageHistogramLarge();
+        $plotter0->plotStorageTimeSeries($czarDb->subtractInterval($begin, "1 WEEK") , $end);
+        $plotter0->plotDiskUsageHistogram();
+        $plotter0->plotDiskUsageHistogramLarge();
         updateServerStatus();
 
@@ -239,4 +250,5 @@
                 foreach $row ( @{$labels} ) {
                     my ($label) = @{$row};
+                    # for now use priorities from gpc1 database
                     $priority = $gpc1Db->getPriority($label);
                     $czarDb->setLabelPriority($label, $priority);
@@ -244,13 +256,22 @@
 
                 updateAllStages($thisServer, $newState, $labels, $begin, $end);
-                if ($thisServer eq "stdscience") {createPlots($thisServer, $labels, $begin, $end);}
+                if ($thisServer eq "stdscience") {
+                    createPlots($thisServer, $plotter1, $labels, $begin, $end);
+                    createPlots($thisServer, $plotter2, $labels, $begin, $end);
+                }
             }
             else { print "* WARNING: no $thisServer labels found in Db\n";}
         }
 
+        my $iterationTime = time() - $iterationStartTime;
+
+        print "done with czarpoll iteration after $iterationTime seconds\n";
+
         print "--------------------------------------------------------------------------\n";
-        #print "* Going to sleep\n";
-        #sleep($period);
-        #print "* Waking up\n";
+        if ($iterationTime < $period) {
+            print "* Going to sleep\n";
+            sleep($period - $iterationTime);
+            print "* Waking up\n";
+        }
     };
 }
@@ -262,40 +283,48 @@
 ###########################################################################
 sub createPlots {
-    my ($server, $rows, $begin, $end) = @_;
+    my ($server, $plotter, $rows, $begin, $end) = @_;
 
     my $stage = undef;
     my $row = undef;
 
-    print "* Generating plots\n";
-
-    # get ippToPsps labels
-    my $ippToPspsLabels = undef;
-    $czarDb->getCurrentIppToPspsLabels($begin, $end, \$ippToPspsLabels);
-    $plotter->setIppToPspsMode();
-
-    # create ippToPsps labels
-    foreach $stage (@ippToPspsStages) {
+    my $project = $plotter->getProject();
+    print "* Generating plots for $project\n";
+
+    # XXX The ippToPsps stuff is not project specific so it should be done somewhere
+    # else
+    if (scalar @ippToPspsStages) {
+        # get ippToPsps labels
+        my $ippToPspsLabels = undef;
+        $czarDb->getCurrentIppToPspsLabels($begin, $end, \$ippToPspsLabels);
+        $plotter->setIppToPspsMode();
+
+        # create ippToPsps labels
+        foreach $stage (@ippToPspsStages) {
+            foreach $row ( @{$ippToPspsLabels} ) {
+                my ($label) = @{$row};
+
+                chomp($label);
+                $plotter->createTimeSeries($label, $stage, $begin, $end, 1, 0, 1);
+            }
+        }
+
+        # create plots for each label for all stages for ippToPsps
         foreach $row ( @{$ippToPspsLabels} ) {
             my ($label) = @{$row};
 
-            chomp($label);
-            $plotter->createTimeSeries($label, $stage, $begin, $end, 1, 0, 1);
-        }
-    }
-
-    # create plots for each label for all stages for ippToPsps
-    foreach $row ( @{$ippToPspsLabels} ) {
-        my ($label) = @{$row};
-
-        $plotter->createTimeSeries($label, undef, $begin, $end, 1, 1, 1);
-    }
-
+            $plotter->createTimeSeries($label, undef, $begin, $end, 1, 1, 1);
+        }
+    }
 
     # create plots for each label for each stage
     $plotter->setStandardMode();
+
     foreach $stage (@stages) {
         foreach $row ( @{$rows} ) {
             my ($label) = @{$row};
 
+            # skip update labels for now. The plots are not relevant.
+            next if $label =~ 'ps_ud';
+
             chomp($label);
             $plotter->createTimeSeries($label, $stage, $begin, $end, 1, 0, 1);
@@ -308,4 +337,7 @@
     foreach $row ( @{$rows} ) {
         my ($label) = @{$row};
+
+        # skip update labels for now. The plots are not relevant.
+        next if $label =~ 'ps_ud';
 
         $plotter->createTimeSeries($label, undef, $begin, $end, 1, 1, 1);
@@ -362,4 +394,5 @@
             chomp($label);
 
+            # Move this to a function and pass in the database
             $new = $gpc1Db->countExposures($label, $stage, $newState);
             $full = $gpc1Db->countExposures($label, $stage, "full");
Index: trunk/ippMonitor/czartool/czartool/Config.pm
===================================================================
--- trunk/ippMonitor/czartool/czartool/Config.pm	(revision 38252)
+++ trunk/ippMonitor/czartool/czartool/Config.pm	(revision 38258)
@@ -126,4 +126,21 @@
 ###########################################################################
 #
+# Returns an instance of a database for the given project
+#
+###########################################################################
+sub getDbInstanceForProject {
+    my ($self, $project) = @_;
+
+    if ($project eq 'gpc1') {
+        return $self->getGpc1Instance();
+    } elsif ($project eq 'gpc2') {
+        return $self->getGpc2Instance();
+    } else {
+        return undef;
+    }
+}
+
+###########################################################################
+#
 # Returns the interval used in czarDB cleanup
 #
Index: trunk/ippMonitor/czartool/czartool/CzarDb.pm
===================================================================
--- trunk/ippMonitor/czartool/czartool/CzarDb.pm	(revision 38252)
+++ trunk/ippMonitor/czartool/czartool/CzarDb.pm	(revision 38258)
@@ -214,5 +214,5 @@
 ###########################################################################
 #
-# Updates current_labels table
+# Update server_dates table
 #
 ###########################################################################
@@ -380,4 +380,8 @@
     my ($self, $label, $stage, $fromTime, $toTime, $minX, $maxX, $timeDiff) = @_;
 
+    # XXX: I'm not splitting this by project (dbname).
+    # Is that ok? Seems like a good idea because this will make the time
+    # range of the plots for both projects the same.
+
     my $query = $self->{_db}->prepare(<<SQL);
     SELECT
@@ -411,13 +415,13 @@
 ###########################################################################
 sub getDayTimings {
-    my ($self, $label, $startStage, $endStage, $begin, $started, $finished, $timeTaken) = @_;
+    my ($self, $label, $dbname, $startStage, $endStage, $begin, $started, $finished, $timeTaken) = @_;
 
     my $end = $self->addInterval($begin, "1 DAY");
 
-    my $startStageMetrics = new czartool::StageMetrics($startStage, $label, $begin, $end);
-    my $endStageMetrics = new czartool::StageMetrics($endStage, $label, $begin, $end);
-
-    if (!$self->runAnalysis($startStageMetrics)) {return 0;}
-    if (!$self->runAnalysis($endStageMetrics)) {return 0;}
+    my $startStageMetrics = new czartool::StageMetrics($startStage, $label, $dbname, $begin, $end);
+    my $endStageMetrics = new czartool::StageMetrics($endStage, $label, $dbname, $begin, $end);
+
+    if (!$self->runAnalysis($startStageMetrics, $dbname)) {return 0;}
+    if (!$self->runAnalysis($endStageMetrics, $dbname)) {return 0;}
 
     ${$started} = $startStageMetrics->getStarted();
@@ -436,5 +440,5 @@
 ###########################################################################
 sub runAnalysis {
-    my ($self, $stageMetrics) = @_;
+    my ($self, $stageMetrics, $dbname) = @_;
 
     if (!$stageMetrics) {return 0;}
@@ -445,4 +449,5 @@
     my $toTime = $stageMetrics->getEndTime();
 
+
     $toTime = $self->addInterval($toTime, "20 MINUTE"); # TODO dodgy
 
@@ -452,4 +457,5 @@
         FROM $stage
         WHERE label LIKE '$label'
+        AND dbname LIKE '$dbname'
         AND timestamp >= '$fromTime' AND timestamp <= '$toTime'
         ORDER BY timestamp;
@@ -656,5 +662,5 @@
 ###########################################################################
 sub createTimeSeriesData {
-    my ($self, $label, $stage, $fromTime, $toTime, $minX, $maxX, $timeDiff, $linDataFile, $logDataFile, $ratDataFile) = @_;
+    my ($self, $label, $dbname, $stage, $fromTime, $toTime, $minX, $maxX, $timeDiff, $linDataFile, $logDataFile, $ratDataFile) = @_;
 
     # get total number of data points
@@ -663,4 +669,5 @@
         FROM $stage
         WHERE label LIKE '$label'
+        AND dbname LIKE '$dbname'
         AND timestamp >= '$fromTime' AND timestamp <= '$toTime';
 SQL
@@ -680,4 +687,5 @@
         FROM $stage
         WHERE label LIKE '$label'
+        AND dbname LIKE '$dbname'
         AND timestamp >= '$fromTime' AND timestamp <= '$toTime'
         ORDER BY timestamp;
@@ -854,5 +862,5 @@
 ###########################################################################
 sub countFaultsInPast {
-    my ($self, $label, $stage, $interval) = @_; # TODO use time not interval
+    my ($self, $label, $dbname, $stage, $interval) = @_; # TODO use time not interval
 
     # get earliest time for this label
@@ -860,5 +868,6 @@
     SELECT GREATEST(MIN(timestamp), now() - INTERVAL $interval)
         FROM $stage
-        WHERE label LIKE '$label';
+        WHERE label LIKE '$label'
+        AND dbname LIKE '$dbname';
 SQL
     $query->execute;
@@ -870,4 +879,5 @@
         FROM $stage
         WHERE label LIKE '$label'
+        AND dbname LIKE '$dbname'
         AND timestamp <= '$timestamp' LIMIT 1;
 SQL
@@ -883,5 +893,5 @@
 ###########################################################################
 sub countPendingNow {
-    my ($self, $label, $stage) = @_;
+    my ($self, $label, $dbname, $stage) = @_;
 
     my $query = $self->{_db}->prepare(<<SQL);
@@ -889,4 +899,5 @@
         FROM $stage
         WHERE label LIKE '$label'
+        AND dbname LIKE '$dbname'
         ORDER BY timestamp DESC LIMIT 1;
 SQL
@@ -902,5 +913,5 @@
 ###########################################################################
 sub countProcessedPendingAndFaults {
-    my ($self, $label, $stage, $fromTime, $toTime, $processed, $pending, $faults) = @_;
+    my ($self, $label, $dbname, $stage, $fromTime, $toTime, $processed, $pending, $faults) = @_;
 
     my $query = $self->{_db}->prepare(<<SQL);
@@ -909,4 +920,5 @@
         FROM $stage
         WHERE label LIKE '$label'
+        AND dbname like '$dbname'
         AND timestamp >= '$fromTime' AND timestamp <= '$toTime'
         ORDER BY timestamp DESC LIMIT 1;
@@ -917,5 +929,5 @@
     (${$pending}, ${$faults}) = $query->fetchrow_array();
 
-    ${$processed} = $self->countProcessed($label, $stage, $fromTime, $toTime);
+    ${$processed} = $self->countProcessed($label, $dbname, $stage, $fromTime, $toTime);
 
     if (!${$pending}) {${$pending} = 0;}
@@ -1066,5 +1078,5 @@
 ###########################################################################
 sub createProcessingRateData {
-    my ($self, $stage, $label, $begin, $end, $interval, $dataFile, $minX, $maxX, $timeDiff) = @_;
+    my ($self, $stage, $label, $dbname, $begin, $end, $interval, $dataFile, $minX, $maxX, $timeDiff) = @_;
 
     my $startTime = $begin;
@@ -1089,5 +1101,5 @@
         if (!$self->isBefore($startTime, $end)) {last;}
         $endTime = $self->addInterval($startTime, $interval);
-        if (!$self->countProcessedPendingAndFaults($label, $stage, $startTime, $endTime, \$processed, \$pending, \$faults)) {}
+        if (!$self->countProcessedPendingAndFaults($label, $dbname, $stage, $startTime, $endTime, \$processed, \$pending, \$faults)) {}
         $timestamp = $self->getFormattedDate($endTime);
         if (!$processed) {$processed = 0;}
@@ -1108,5 +1120,5 @@
 ###########################################################################
 sub countProcessed {
-    my ($self, $label, $stage, $begin, $end) = @_;
+    my ($self, $label, $dbname, $stage, $begin, $end) = @_;
 
     my $query = $self->{_db}->prepare(<<SQL);
@@ -1115,4 +1127,5 @@
         FROM $stage
         WHERE label LIKE '$label'
+        AND dbname LIKE '$dbname'
         AND timestamp >= '$begin'
         AND timestamp < '$end'
Index: trunk/ippMonitor/czartool/czartool/DayMetrics.pm
===================================================================
--- trunk/ippMonitor/czartool/czartool/DayMetrics.pm	(revision 38252)
+++ trunk/ippMonitor/czartool/czartool/DayMetrics.pm	(revision 38258)
@@ -29,9 +29,10 @@
     my $self = $class->SUPER::new(
             $_[1],  # config object
-            $_[2],  # verbose
-            $_[3]   # save_temps
+            $_[2],  # projectDb
+            $_[3],  # verbose
+            $_[4]   # save_temps
             );
 
-    $self->{day} = $_[4];
+    $self->{day} = $_[5];
 
     my $yesterday =  $self->{czarDb}->subtractInterval($self->{day}, "1 DAY");
@@ -68,7 +69,8 @@
 
     # summit and chip exposures
-    my $summitExposures = $self->{gpc1Db}->countScienceExposuresFromLastNight($self->{day});
-    my $chipMetrics = new czartool::StageMetrics("chip", "all_stdscience_labels", $self->{begin}, $self->{chipEnd});
-    $self->{czarDb}->runAnalysis($chipMetrics);
+    my $summitExposures = $self->{projectDb}->countScienceExposuresFromLastNight($self->{day});
+    my $dbname = $self->{projectDb}->getDbName();
+    my $chipMetrics = new czartool::StageMetrics("chip", "all_stdscience_labels", $dbname, $self->{begin}, $self->{chipEnd});
+    $self->{czarDb}->runAnalysis($chipMetrics, $dbname);
 
     my $previousDay = $self->{czarDb}->subtractInterval($self->{day}, "1 DAY");
@@ -136,6 +138,6 @@
         foreach my $stage ( @stages ){
 
-            my $stageMetrics = new czartool::StageMetrics($stage, $label, $self->{begin}, ($stage eq "chip") ? $self->{chipEnd} : $self->{end});
-            if (!$self->{czarDb}->runAnalysis($stageMetrics)) {next;}
+            my $stageMetrics = new czartool::StageMetrics($stage, $label, $dbname, $self->{begin}, ($stage eq "chip") ? $self->{chipEnd} : $self->{end});
+            if (!$self->{czarDb}->runAnalysis($stageMetrics, $dbname)) {next;}
 
             if (!$stageMetrics->anythingProcessed()) {next;}
@@ -268,7 +270,9 @@
     print $htmlFile "  </tr>\n";
 
+    my $dbname = $self->{projectDb}->getDbName();
+
     # OSS survey
     my ($started, $finished, $timeTaken) = undef;
-    $self->{czarDb}->getDayTimings("OSS.nightlyscience", "chip", "diff", $self->{begin}, \$started, \$finished, \$timeTaken);
+    $self->{czarDb}->getDayTimings("OSS.nightlyscience", $dbname, "chip", "diff", $self->{begin}, \$started, \$finished, \$timeTaken);
     $self->printSurveyDetails("OSS", $started, $finished, $timeTaken);
 
@@ -295,5 +299,5 @@
     foreach $mdf (@mdfs) {
 
-        if ($self->{czarDb}->getDayTimings($mdf, "chip", "dist", $self->{begin}, \$started, \$finished, \$timeTaken)) {
+        if ($self->{czarDb}->getDayTimings($mdf, $dbname, "chip", "dist", $self->{begin}, \$started, \$finished, \$timeTaken)) {
 
             if ($started && $self->{czarDb}->isBefore($started, $earliest)) {$earliest = $started; $haveStart = 1;}
@@ -309,5 +313,5 @@
     $self->printSurveyDetails("MDF", $earliest, $latest, $timeTaken);
 
-    $self->{czarDb}->getDayTimings("all_stdscience_labels", "chip", "dist", $self->{begin}, \$started, \$finished, \$timeTaken);
+    $self->{czarDb}->getDayTimings("all_stdscience_labels", $dbname, "chip", "dist",  $self->{begin}, \$started, \$finished, \$timeTaken);
     $self->printSurveyDetails("All", $started, $finished, $timeTaken);
 
Index: trunk/ippMonitor/czartool/czartool/Gpc1Db.pm
===================================================================
--- trunk/ippMonitor/czartool/czartool/Gpc1Db.pm	(revision 38252)
+++ trunk/ippMonitor/czartool/czartool/Gpc1Db.pm	(revision 38258)
@@ -1,3 +1,5 @@
 #!/usr/bin/perl i-w
+
+# This class is now misnamed. Should be ProjectDb or something like that.
 
 package czartool::Gpc1Db;
Index: trunk/ippMonitor/czartool/czartool/Metrics.pm
===================================================================
--- trunk/ippMonitor/czartool/czartool/Metrics.pm	(revision 38252)
+++ trunk/ippMonitor/czartool/czartool/Metrics.pm	(revision 38258)
@@ -25,9 +25,11 @@
     my $self = {
         config => shift,
+        projectDb => shift,
         verbose => shift,
         save_temps => shift,
     };
 
-    $self->{gpc1Db} = $self->{config}->getGpc1Instance();
+    # $self->{gpc1Db} = $self->{config}->getGpc1Instance();
+
     $self->{czarDb} = $self->{config}->getCzarDbInstance();
     $self->{baseDir} = $self->{config}->getMetricsSaveLocation();
@@ -39,4 +41,5 @@
     $self->{plotter} = czartool::Plotter->new_file(
             $self->{config},
+            $self->{projectDb},
             ".",
             $self->{save_temps});
Index: trunk/ippMonitor/czartool/czartool/MetricsIndex.pm
===================================================================
--- trunk/ippMonitor/czartool/czartool/MetricsIndex.pm	(revision 38252)
+++ trunk/ippMonitor/czartool/czartool/MetricsIndex.pm	(revision 38258)
@@ -29,6 +29,7 @@
     my $self = $class->SUPER::new(
             $_[1],  # config object 
-            $_[2],  # verbose
-            $_[3]   # save_temps
+            $_[2],  # database
+            $_[3],  # verbose
+            $_[4]   # save_temps
             );
 
Index: trunk/ippMonitor/czartool/czartool/MySQLDb.pm
===================================================================
--- trunk/ippMonitor/czartool/czartool/MySQLDb.pm	(revision 38252)
+++ trunk/ippMonitor/czartool/czartool/MySQLDb.pm	(revision 38258)
@@ -65,4 +65,9 @@
 }                                                                               
 
+sub getDbName {
+    my( $self ) = @_;                                                       
+    return $self->{_dbName};                                                 
+}                                                                               
+
 ###########################################################################
 #
Index: trunk/ippMonitor/czartool/czartool/Plotter.pm
===================================================================
--- trunk/ippMonitor/czartool/czartool/Plotter.pm	(revision 38252)
+++ trunk/ippMonitor/czartool/czartool/Plotter.pm	(revision 38258)
@@ -46,4 +46,5 @@
     my $self = {
         _config => shift,
+        _projectDb => shift,
         _dateFormat => shift,
         _outputFormat => shift,
@@ -52,4 +53,5 @@
     };
 
+
     bless $self, $class;
     $self->init();
@@ -66,4 +68,5 @@
     my $self = {
         _config => shift,
+        _projectDb => shift,
         _outputPath => shift,
         _save_temps => shift,
@@ -86,4 +89,5 @@
     my $self = {
         _config => shift,
+        _projectDb => shift,
         _save_temps => shift,
     };
@@ -128,7 +132,23 @@
     my ($self) = @_;
 
-    $self->{_gpc1Db} = $self->{_config}->getGpc1Instance();
+    if ($self->{_projectDb}) {
+        $self->{_project} = $self->{_projectDb}->getDbName();
+    } else {
+        $self->{_project} = undef;
+    }
+        
+
     $self->{_czarDb} = $self->{_config}->getCzarDbInstance();
     $self->setStandardMode();
+}
+
+###########################################################################
+#
+# Get the project (dbname) associated with this Plotter
+#
+###########################################################################
+sub getProject {
+    my ($self) = @_;
+    return $self->{_project};
 }
 
@@ -209,4 +229,5 @@
                     $stage,
                     $label,
+                    $self->{_project},
                     $beginTime,
                     $endTime,
@@ -301,4 +322,5 @@
         if($self->{_czarDb}->createTimeSeriesData(
                     $label,
+                    $self->{_project},
                     $stage,
                     $beginTime,
@@ -403,4 +425,5 @@
         if (!$self->{_czarDb}->countProcessedPendingAndFaults(
                 $label,
+                $self->{_project},
                 $stage,
                 $beginTime,
@@ -547,5 +570,5 @@
     $title .= " for '$label'\\nFrom '$fromTime' to '$toTime' HST";
 
-    open (GP, "|$GNUPLOT -persist") or die "no gnuplot";
+    open (GP, "|$GNUPLOT -persist > /dev/null 2>&1") or die "no gnuplot";
     use FileHandle;
     GP->autoflush(1);
@@ -747,5 +770,5 @@
 
     my $fracs;
-    if (!$self->{_gpc1Db}->getMagicMaskFraction($exp_id, \$fracs)) {return 0;}
+    if (!$self->{_projectDb}->getMagicMaskFraction($exp_id, \$fracs)) {return 0;}
 
     open (GNUDAT, ">".$tmpFile->filename);
@@ -809,5 +832,5 @@
     # get exposures between these dates
     my $exp_ids = undef;
-    if (!$self->{_gpc1Db}->getProcessedExposures($begin, $end, \$exp_ids)) {return 0;}
+    if (!$self->{_projectDb}->getProcessedExposures($begin, $end, \$exp_ids)) {return 0;}
     my $totalExp = @{$exp_ids};
     if ($totalExp < 1) {return 0;}
@@ -844,5 +867,5 @@
         $exp_id = @{$row}[0];
 
-        if (!$self->{_gpc1Db}->getMagicMaskStats($exp_id, \$meanMask, \$sumMask, \$chipCount )) {next;}
+        if (!$self->{_projectDb}->getMagicMaskStats($exp_id, \$meanMask, \$sumMask, \$chipCount )) {next;}
 
 
Index: trunk/ippMonitor/czartool/czartool/StageMetrics.pm
===================================================================
--- trunk/ippMonitor/czartool/czartool/StageMetrics.pm	(revision 38252)
+++ trunk/ippMonitor/czartool/czartool/StageMetrics.pm	(revision 38258)
@@ -17,4 +17,5 @@
         stage => shift,
         label => shift,
+        dbname => shift,
         startTime => shift,
         endTime => shift
@@ -111,4 +112,5 @@
 sub getEndTime() {my $self = shift; return $self->{endTime};}
 sub getLabel() {my $self = shift; return $self->{label};}
+sub getDbname() {my $self = shift; return $self->{dbname};}
 sub getStage() {my $self = shift; return $self->{stage};}
 sub getStarted() {my $self = shift; return $self->{started};}
