Index: trunk/ippMonitor/czartool/czartool.pl
===================================================================
--- trunk/ippMonitor/czartool/czartool.pl	(revision 38206)
+++ trunk/ippMonitor/czartool/czartool.pl	(revision 40840)
@@ -15,10 +15,11 @@
 my $save_temps = 1;
 my $interval = undef;
+my $telescope = "gpc1";
 
 GetOptions (
         "dbname|d=s" => \$czarDbName,
         "interval|i=s" => \$interval,
+        "telescope|t=s" => \$telescope,
         );
-
 
 my @states = ("full", "new", "drop", "wait");
@@ -26,4 +27,5 @@
 my $czarDb = $config->getCzarDbInstance();
 my $gpc1Db = $config->getGpc1Instance();
+my $gpc2Db = $config->getGpc2Instance();
 my $pantasks = new czartool::Pantasks();
 
@@ -55,9 +57,9 @@
 sub promptPoll {
 
-    @stdscienceLabels = @{$pantasks->getLabels("stdscience")};
-    @distributionLabels = @{$pantasks->getLabels("distribution")};
-    # @publishingLabels = @{$pantasks->getLabels("publishing")};
+    @stdscienceLabels = @{$pantasks->getLabels("stdscience",$telescope)};
+    @distributionLabels = @{$pantasks->getLabels("distribution",$telescope)};
+    # @publishingLabels = @{$pantasks->getLabels("publishing", $telescope)};
     @publishingLabels = @stdscienceLabels;
-    checkAllLabels("new");
+    checkAllLabels("new", $telescope);
     printInstructions();
 
@@ -68,7 +70,7 @@
 
         if ($key eq "s") {checkServers();}
-        elsif ($key eq "l") {checkAllLabels("new");}
-        elsif ($key eq "u") {$pantasks->getServerCurrentStatus("stdscience");}
-        elsif ($key =~ m/[0-9]/) {my $key2=getc; checkOneLabel($stdscienceLabels[($key.$key2)-1]);}
+        elsif ($key eq "l") {checkAllLabels("new", $telescope);}
+        elsif ($key eq "u") {$pantasks->getServerCurrentStatus("stdscience",$telescope);}
+        elsif ($key =~ m/[0-9]/) {my $key2=getc; checkOneLabel($stdscienceLabels[($key.$key2)-1], $telescope);}
         printInstructions();
 
@@ -139,4 +141,5 @@
 ###########################################################################
 sub labelDetails {
+    my ($telescope) = @_;
 
     print "\nPlease enter the label name, or number from table above: ";
@@ -144,8 +147,8 @@
     chomp($input);
     if ($input =~ m/^([0-9]|[1-9][0-9]|[1-9][0-9][0-9])$/) {
-        return checkOneLabel($stdscienceLabels[$input]);
-    }
-
-    checkOneLabel($input);
+        return checkOneLabel($stdscienceLabels[$input], $telescope);
+    }
+
+    checkOneLabel($input, $telescope);
 }
 
@@ -156,5 +159,5 @@
 ###########################################################################
 sub checkOneLabel {
-    my ($label) = @_;
+    my ($label, $telescope) = @_;
 
     chomp($label);
@@ -188,5 +191,5 @@
         foreach $stage (@stages) {
 
-            printf("|%14s", getStateAndFaultsString($label, $state, $stage));
+            printf("|%14s", getStateAndFaultsString($label, $state, $stage, $telescope));
         }
 
@@ -209,5 +212,5 @@
 ###########################################################################
 sub checkAllLabels {
-    my ($state) = @_;
+    my ($state, $telescope) = @_;
 #print time, $/;
     my $stage;
@@ -259,5 +262,5 @@
         foreach $stage (@stages) {
 
-            printf("|%14s", getStateAndFaultsString($stdsLabel, $state, $stage));
+            printf("|%14s", getStateAndFaultsString($stdsLabel, $state, $stage, $telescope));
         }
 
@@ -280,11 +283,24 @@
 ###########################################################################
 sub getStateAndFaultsString {
-    my ($label, $state, $stage) = @_;
-
-    my $new = $gpc1Db->countExposures($label, $stage, $state);
-
-    #if ($state ne "new") {return $new;}
-
-    my $faults = $gpc1Db->countFaults($label, $stage, $state);
+    my ($label, $state, $stage, $telescope) = @_;
+
+    my $new = undef;
+    my $faults = undef;
+
+    if ($telescope eq 'gpc1') {
+      $new = $gpc1Db->countExposures($label, $stage, $state);
+      #if ($state ne "new") {return $new;}
+
+      $faults = $gpc1Db->countFaults($label, $stage, $state);
+    }
+    elsif ($telescope eq 'gpc2') {
+      $new = $gpc2Db->countExposures($label, $stage, $state);
+      #if ($state ne "new") {return $new;}
+
+      $faults = $gpc2Db->countFaults($label, $stage, $state);
+    }
+    else {
+        print "WARNING: Must specify a telescope for connecting to the right pantask\n";
+    }
 
     if ($faults < 1) {return $new;}
