Index: trunk/ippMonitor/czartool/czarpoll.pl
===================================================================
--- trunk/ippMonitor/czartool/czarpoll.pl	(revision 40879)
+++ trunk/ippMonitor/czartool/czarpoll.pl	(revision 41125)
@@ -236,4 +236,25 @@
         $pantasks->getServerStatus($server,'gpc2', \$alive, \$running);
         $czarDb->updateServerStatus($server,'gpc2', $alive, $running);
+   }
+}
+
+###########################################################################
+#
+# Updates pantasks server status TODO should really get info for all servers at once
+#
+###########################################################################
+sub updateServerStatusLive {
+    print "* Checking all pantasks servers\n";
+
+    my $servers = $pantasks->getServerList();
+
+    my $server = undef;
+    my $alive = undef;
+    my $running = undef;
+    foreach $server (@{$servers}) {
+        $pantasks->getServerStatus($server,'gpc1', \$alive, \$running);
+        $czarDb->updateServerStatusLive($server,'gpc1', $alive, $running);
+        $pantasks->getServerStatus($server,'gpc2', \$alive, \$running);
+        $czarDb->updateServerStatusLive($server,'gpc2', $alive, $running);
    }
 }
@@ -272,9 +293,10 @@
     my $newDayTime = $config->getMetricsStartTime();
     my $lastDayDailyTasks = "2010-01-01";
-
+    my $checkneb = 1; # 1 for nebulous, 0 for localhost test
     # main polling loop
     while (1) {
+
         my $iterationStartTime = time();
-
+ 
         #get the time of last czarpoll update
         $polldate = $czarDb->getPollDate();
@@ -287,9 +309,9 @@
         if($timediff > 120.) { 
             print "There is no recent Czarpoll iteration\n";
-            print "*Updating database entries*\n";
+            print "* Updating database entries*\n";
             $dbupdate = 1;
         } else {
             print "There is a recent Czarpoll iteration already made ($timediff sec ago)\n";
-            print "*Skipping database queries and entries*\n";
+            print "* Skipping database queries and entries\n";
             $dbupdate = 0;
         }
@@ -326,8 +348,8 @@
                 #TdB20190703: The ipp113 and ipp117 instances of czarpoll use the same stage DBs in czarDB. 
                 #Therefore, it makes no sense to run the cleanup+optimising twice
-                #print "* Performing database cleanup\n";
-                #$czarDb->cleanupDateRange($yesterday, $yesterday, $config->getCzarCleanupInterval());
-                #print "* Optimizing the database\n";
-                #$czarDb->optimize();
+                print "* Performing database cleanup\n";
+                $czarDb->cleanupDateRange($yesterday, $yesterday, $config->getCzarCleanupInterval());
+                print "* Optimizing the database\n";
+                $czarDb->optimize();
                 $lastDayDailyTasks = $yesterday;
             }
@@ -344,10 +366,18 @@
 
         # check nebulous
-        print "* Checking Nebulous\n";
-        if($dbupdate == 1) {$nebulous->updateClusterSpaceInfo();}
-        $plotter0->plotStorageTimeSeries($czarDb->subtractInterval($begin, "1 WEEK") , $end);
-        $plotter0->plotDiskUsageHistogram();
-        $plotter0->plotDiskUsageHistogramLarge();
+        if ($checkneb == 1) {
+            print "* Checking Nebulous\n";
+            if($dbupdate == 1) {$nebulous->updateClusterSpaceInfo();}
+            $plotter0->plotStorageTimeSeries($czarDb->subtractInterval($begin, "1 WEEK") , $end);
+            $plotter0->plotDiskUsageHistogram();
+            $plotter0->plotDiskUsageHistogramLarge();
+        }
+        else {
+            print "* Locahost, so no checking nebulous\n";
+        }
+
+        # check pantasks status
         if($dbupdate == 1) {updateServerStatus();}
+        if($dbupdate == 1) {updateServerStatusLive();}
 
         # check pantasks dates
