Index: /trunk/ippMonitor/Makefile.in
===================================================================
--- /trunk/ippMonitor/Makefile.in	(revision 42271)
+++ /trunk/ippMonitor/Makefile.in	(revision 42272)
@@ -85,4 +85,6 @@
 $(DESTWWW)/show_log.php \
 $(DESTWWW)/heathers_plot.php \
+$(DESTWWW)/storage.php \
+$(DESTWWW)/skycoverage.php \
 $(DESTWWW)/loader.js
 
Index: /trunk/ippMonitor/def/autocodeImage.php
===================================================================
--- /trunk/ippMonitor/def/autocodeImage.php	(revision 42271)
+++ /trunk/ippMonitor/def/autocodeImage.php	(revision 42272)
@@ -115,4 +115,22 @@
   foreach ($row as $i => $value) {
     switch ($value) {
+    case 'g.00002':
+      $filter = 1;
+      break;
+    case 'r.00002':
+      $filter = 2;
+      break;
+    case 'i.00002':
+      $filter = 3;
+      break;
+    case 'z.00002':
+      $filter = 4;
+      break;
+    case 'y.00002':
+      $filter = 5;
+      break;
+    case 'w.00002':
+      $filter = 6;
+      break;
     case 'g.00000':
       $filter = 1;
Index: /trunk/ippMonitor/raw/czartool_labels.php
===================================================================
--- /trunk/ippMonitor/raw/czartool_labels.php	(revision 42271)
+++ /trunk/ippMonitor/raw/czartool_labels.php	(revision 42272)
@@ -207,6 +207,6 @@
 $ganglia = "http://ganglia.pan-starrs.ifa.hawaii.edu";
 $svnlink = "https://svn.pan-starrs.ifa.hawaii.edu/trac/ipp";
-$conflink = "https://confluence.ipp.ifa.hawaii.edu";
-$jiralink = "https://jira.ipp.ifa.hawaii.edu";
+$conflink = "https://panstarrs.atlassian.net";
+$jiralink = "https://panstarrs.atlassian.net";
 $hsttime1 = date("Y-m-d H:i:s", strtotime("$lastUpdateTime"));
 $utctime1 = gmdate("Y-m-d H:i:s", strtotime("$lastUpdateTime"));
@@ -241,7 +241,7 @@
   &nbsp|&nbsp <a href=\"$ganglia/?m=mem_report&r=hour&s=by%2520name&c=IPP+Production&h=&sh=1&hc=8&z=small\" target=new> <font color=\"blue\">Memory_reports</font></a></td></tr>";
 echo "<tr><td>Documentations for IPP</td>
-          <td><a href=\"$conflink/pages/viewrecentblogposts.action?key=IPPCZAR\" target=new><font color=\"blue\">Czarblog</font></a>
-  &nbsp|&nbsp <a href=\"$conflink/display/IPPCZAR/IPP-Czaring+Home\" target=new><font color=\"blue\">Confluence</font></a>
-  &nbsp|&nbsp <a href=\"$jiralink/projects/IPP/issues/filter=allissues\" target=new><font color=\"blue\">Jira</font></a>
+          <td><a href=\"$conflink/wiki/spaces/IPPCZAR/pages/679903282/Czarblog+Roll\" target=new><font color=\"blue\">Czarblog</font></a>
+  &nbsp|&nbsp <a href=\"$conflink/wiki/spaces/IPPCZAR/overview\" target=new><font color=\"blue\">Confluence</font></a>
+  &nbsp|&nbsp <a href=\"$jiralink/issues/?filter=-4\" target=new><font color=\"blue\">Jira</font></a>
   &nbsp|&nbsp <a href=\"$svnlink/\" target=new><font color=\"blue\">trac</font></a></td></tr>";
 echo "<tr><td>Current nightly science status</td> 
@@ -288,4 +288,5 @@
 showReplicationsStatus($REPL_HOST_NEBULOUS_SECONDARY, $REPL_USER_NEBULOUS_SECONDARY, $REPL_PASSWORD_NEBULOUS_SECONDARY, $REPL_LABEL_NEBULOUS_SECONDARY);
 showReplicationsStatus($REPL_HOST_NEBULOUS_TERTIARY, $REPL_USER_NEBULOUS_TERTIARY, $REPL_PASSWORD_NEBULOUS_TERTIARY, $REPL_LABEL_NEBULOUS_TERTIARY);
+showReplicationsStatus($REPL_HOST_NEBULOUS_QUATERNARY, $REPL_USER_NEBULOUS_QUATERNARY, $REPL_PASSWORD_NEBULOUS_QUATERNARY, $REPL_LABEL_NEBULOUS_QUATERNARY);
 // other dbs
 showDatabaseStatus($HOST_PSTAMP, $USER_PSTAMP, $PASSWORD_PSTAMP, $LABEL_PSTAMP);
@@ -364,8 +365,8 @@
    # gnuplots
    # time series plot
-#   echo "<img src=\"czartool_getplot.php?mode=$selectedMode&type=t&label=$selectedLabel&proj=$proj&stage=$selectedStage&plottype=linear\"><br><br>";
-#   echo "<img src=\"czartool_getplot.php?mode=$selectedMode&type=t&label=$selectedLabel&proj=$proj&stage=$selectedStage&plottype=log\"><br><br>";
+   echo "<img src=\"czartool_getplot.php?mode=$selectedMode&type=t&label=$selectedLabel&proj=$proj&stage=$selectedStage&plottype=linear\"><br><br>";
+   echo "<img src=\"czartool_getplot.php?mode=$selectedMode&type=t&label=$selectedLabel&proj=$proj&stage=$selectedStage&plottype=log\"><br><br>";
    # rate series plot
-#   echo "<img src=\"czartool_getplot.php?mode=$selectedMode&type=rt&label=$selectedLabel&proj=$proj&stage=$selectedStage&plottype=linear\"><br><br>";
+   echo "<img src=\"czartool_getplot.php?mode=$selectedMode&type=rt&label=$selectedLabel&proj=$proj&stage=$selectedStage&plottype=linear\"><br><br>";
    #for dev version
    # google chart
@@ -382,11 +383,10 @@
 }
 
-
 # data quality timeseries
 echo getDataQuality($projectdb);
 # storage timeseries
-echo getSpaces($czardb);
+#echo getSpaces($czardb);
 # storage plot
-echo getHosts($czardb);
+#echo getHosts($czardb);
 
 # timer for main page end
@@ -1727,5 +1727,4 @@
 
     $sql = "select format(used/total*100,1), usable from cluster_space order by timestamp desc limit 1;";
-
     if ($debug) {echo "$sql<br>";}
     $qry = $db->query($sql);
@@ -1810,5 +1809,4 @@
 }
 
-
 ###########################################################################
 #
@@ -1823,4 +1821,16 @@
     $start = $time;
 
+    $date = gmdate("Y-m-d");
+    $sql = "SELECT MAX(exp_id) FROM rawExp WHERE dateobs >= date_sub('$date', interval 20 day) AND dateobs <= date_sub('$date', interval 10 day)";
+    $qry = $db->query($sql);
+    if (dberror($qry)) {
+        print "*** WARNING: no data in period 10-20 days before requested date (query will be slower) **\n";
+        $refExpID = 0;
+    }
+    $qry->fetchInto($refExpID);
+    if ($refExpID[0] = 'NULL') {
+        $refExpID[0] = 0;
+    }
+
     #Query for the needed data
     $DQarray = array();
@@ -1829,4 +1839,5 @@
 #    $sql.= " WHERE (rawExp.dateobs > utc_date() - INTERVAL 14 hour) and (rawExp.dateobs < utc_date() + INTERVAL 10 hour)";
     $sql.= " WHERE (rawExp.dateobs > utc_date())";
+    $sql.= " AND exp_id > $refExpID[0]";
     $sql.= " AND exp_type = 'OBJECT' AND camRun.state like 'full' ORDER BY dateobs asc;";
     if ($debug) {echo "$sql<br>";}
@@ -2070,5 +2081,5 @@
    echo "     vAxis: {  ";
    echo "                  title: 'Zeropoint offset (mag)',";
-   echo "     viewWindow: {   min: -0.5, max: 0.5    },  ";
+   echo "     viewWindow: {   min: -0.25, max: 0.25    },  ";
    echo "     },";
    echo "     chartArea: {left:80, top:50, right:20, bottom:50},";
Index: /trunk/ippMonitor/raw/ganglia.php
===================================================================
--- /trunk/ippMonitor/raw/ganglia.php	(revision 42272)
+++ /trunk/ippMonitor/raw/ganglia.php	(revision 42272)
@@ -0,0 +1,29 @@
+<?php
+include 'ipp.php';
+include 'site.php';
+
+$ID = checkID();
+
+if ($ID['menu']) {$myMenu = $ID['menu'];}
+else {$myMenu = "ipp.czar.dat";}
+
+menu($myMenu, 'Czartool on '.$lastUpdateTime, 'ipp.css', $ID['link'], $ID['proj']);
+
+$pass = $ID['pass'];
+$proj = $ID['proj'];
+$menu = $ID['menu'];
+
+echo "<table border=\"0\"  style=\"width:1500px\">";
+echo "<tr>";
+echo "  <td >";
+echo "  <h1 align=\"middle\"><a href=\"http://ganglia.pan-starrs.ifa.hawaii.edu/?c=IPP%20Production\" target=new><font color=\"blue\">ganglia</a></h1>";
+echo "<center><iframe src=\"http://ganglia.pan-starrs.ifa.hawaii.edu/?m=cpu_report&r=hour&s=by%2520name&c=IPP+Production&h=&sh=1&hc=6&z=small \" title=\"czarblog\" width=100% height=2000px></iframe>";
+echo "  </td>";
+echo "</tr>";
+echo "</table>";
+
+menu_end();
+
+
+?>
+
Index: /trunk/ippMonitor/raw/ipp.czar.dat
===================================================================
--- /trunk/ippMonitor/raw/ipp.czar.dat	(revision 42271)
+++ /trunk/ippMonitor/raw/ipp.czar.dat	(revision 42272)
@@ -1,12 +1,17 @@
-input     | ipp.menu.dat 
+input      | ipp.menu.dat 
 
-menutop   | menutop      | plain   | &nbsp;   |   
+menutop    | menutop         | plain   | &nbsp;                 |   
 
-menulink   | menuselect      | link    | czartool        | czartool_labels.php
-menulink   | menuselect      | link    | mask stats                   | maskStats.php
-menulink   | menuselect      | link    | night summary                | nightSummary.php
-menutop   | menutop      | plain   | &nbsp;                       | 
-menulink  | menuselect   | link    | Exposures Status             | exposureStatus.php
-menulink  | menuselect   | link    | MOPS Exposures Status        | mopsStatus.php
-menulink  | menuselect   | link    | MySql ProcessList            | gpc1MysqlProcessList.php
+menulink   | menuselect      | link    | czartool               | czartool_labels.php
+menulink   | menuselect      | link    | storage only           | storage.php
+menulink   | menuselect      | link    | mask stats             | maskStats.php
+menulink   | menuselect      | link    | night summary          | nightSummary.php
+menulink   | menuselect      | link    | skycoverage            | skycoverage.php
+menulink   | menuselect      | link    | ganglia                | ganglia.php
 
+menutop    | menutop         | plain   | &nbsp;                 | 
+
+menulink   | menuselect      | link    | Exposures Status       | exposureStatus.php
+menulink   | menuselect      | link    | MOPS Exposures Status  | mopsStatus.php
+menulink   | menuselect      | link    | MySql ProcessList      | gpc1MysqlProcessList.php
+
Index: /trunk/ippMonitor/raw/ipp.plots.dat
===================================================================
--- /trunk/ippMonitor/raw/ipp.plots.dat	(revision 42271)
+++ /trunk/ippMonitor/raw/ipp.plots.dat	(revision 42272)
@@ -11,5 +11,4 @@
 menulink  | menuselect      | link    | Simple plot - diff                  | simplePlotDiffImage.php
 menulink  | menuselect      | link    | Subset plot - diff                  | subsetPlotDiffImage.php
-menulink  | menuselect      | link    | Heather's Plots                     | heathers_plot.php
 
 menutop   | menutop      | plain   | &nbsp;                                 | 
Index: /trunk/ippMonitor/raw/skycoverage.php
===================================================================
--- /trunk/ippMonitor/raw/skycoverage.php	(revision 42272)
+++ /trunk/ippMonitor/raw/skycoverage.php	(revision 42272)
@@ -0,0 +1,29 @@
+<?php
+include 'ipp.php';
+include 'site.php';
+
+$ID = checkID();
+
+if ($ID['menu']) {$myMenu = $ID['menu'];}
+else {$myMenu = "ipp.czar.dat";}
+
+menu($myMenu, 'Czartool on '.$lastUpdateTime, 'ipp.css', $ID['link'], $ID['proj']);
+
+$pass = $ID['pass'];
+$proj = $ID['proj'];
+$menu = $ID['menu'];
+
+echo "<table border=\"0\">";
+echo "<tr>";
+echo "  <td style=width:1300px>";
+echo "  <h1 align=\"middle\"><a href=\"https://ipp.ifa.hawaii.edu/skycoverage.20201110/\" target=new><font color=\"blue\">Skycoverage</a></h1>";
+echo "<center><iframe src=\"https://ipp.ifa.hawaii.edu/skycoverage.20201110/\" title=\"skycoverage\" width=100% height=2000></iframe>";
+echo "  </td>";
+echo "</tr>";
+echo "</table>";
+
+menu_end();
+
+
+?>
+
Index: /trunk/ippMonitor/raw/storage.php
===================================================================
--- /trunk/ippMonitor/raw/storage.php	(revision 42272)
+++ /trunk/ippMonitor/raw/storage.php	(revision 42272)
@@ -0,0 +1,265 @@
+<?php
+include 'ipp.php';
+include 'site.php';
+
+$ID = checkID();
+
+// require an explicit project
+if (! $ID['proj']) { projectform ($ID); }
+
+// connect to czarDb 
+$czardb = dbconnect($CZARDBNAME); 
+$projectdb = dbconnect($ID['proj']);
+
+if ($ID['menu']) {$myMenu = $ID['menu'];}
+else {$myMenu = "ipp.czar.dat";}
+
+menu($myMenu, 'Czartool on '.$lastUpdateTime, 'ipp.css', $ID['link'], $ID['proj']);
+
+$pass = $ID['pass'];
+$proj = $ID['proj'];
+$menu = $ID['menu'];
+
+echo "<table border=\"0\">";
+echo "<tr>";
+echo "  <td style=width:1000px>";
+echo "  <h1 align=\"middle\">Storage status</h1>";
+# storage timeseries
+echo getSpaces($czardb);
+# storage plot
+echo getHosts($czardb);
+echo "  </td>";
+echo "</tr>";
+echo "</table>";
+
+menu_end();
+
+
+/////////////////////////////////////////////////////////////////////////////
+//                                                                         //
+//                               Functions                                 //
+//                                                                         //
+/////////////////////////////////////////////////////////////////////////////
+
+
+###########################################################################
+#
+# Gets disk status
+#
+###########################################################################
+function getHosts($db) {
+    // timer start
+    $time = microtime();
+    $time = explode(' ', $time);
+    $time = $time[1] + $time[0];
+    $start = $time;
+
+    #echo "<script type=\"text/javascript\" src=\"https://www.gstatic.com/charts/loader.js\"></script>";
+    echo "<script type=\"text/javascript\" src=\"loader.js\"></script>";
+    echo "<br><div class=\"chartWithOverlay\" style=\"position: relative; width: 640px\">"; 
+    echo "  <div id=\"disk_div\" style=\"width:1000px; height:1600px\"></div>";
+    echo "  <div class=\"overlay\" style=\"position: absolute; width: 100px; top: 50px; right: 20px;\">";
+    echo "    <div style=\"font-size: 12px; height: 14px; border: 1px solid; background-color: #00ff00\"><center>Free</div>";
+    echo "    <div style=\"font-size: 12px; height: 14px; border: 1px solid; background-color: #ffff00\"><center>Used</div>";
+    echo "    <div style=\"font-size: 12px; height: 14px; border: 1px solid; background-color: #ff0000\"><center>> 97% limit</div>";
+    echo "    <div style=\"font-size: 12px; height: 14px; border: 1px solid; background-color: #bbbbbb\"><center>Down | Repair</div>";
+    echo "    <div style=\"font-size: 12px; height: 14px; border: 1px solid; background-color: #ffffff\"><center>Power Off</div>";
+    echo "    <div style=\"font-size: 12px; height: 14px; border: 1px solid; background-color: #ffffff\"><center>
+                 <a href=\"https://confluence.ipp.ifa.hawaii.edu/display/IKB/IPP+Hardware+Status#IPPHardwareStatus-StorageNodes\" target=new><font color=\"blue\">Notes</font></a></div>";
+    echo "  </div>";
+    echo "</div>";
+
+    echo "<script type=\"text/javascript\">";
+    echo "google.charts.load('current', {packages: ['corechart', 'bar']});";
+    echo "google.charts.setOnLoadCallback(drawBarColors);";
+    echo "function drawBarColors() {";
+    echo "  var data = google.visualization.arrayToDataTable([";
+    echo "    ['Host', ";
+    echo "     'used', {type: 'string', role: 'style'}, {type: 'string', role: 'tooltip', 'p': {'html': true}}, ";
+    echo "     'free', {type: 'string', role: 'style'}, {type: 'string', role: 'tooltip', 'p': {'html': true}}],";
+
+    $sql = "SELECT host, format(total,1), format(available,2), format(used,2), writable, readable, format(used/total*100,2) FROM hosts";
+    if ($debug) {echo "$sql<br>";}
+    $qry = $db->query($sql);
+    if (dberror($qry)) {echo "<b>error with $sql </b><br>\n";}
+    # not sure why neb-host doesn't work on ipp113 CCL.20210216
+    exec("neb-host |cut -b 17-30,86-", $hostnoteall);
+    while ($qry->fetchInto($row)) {
+        list($host, $total, $available, $used, $writable, $readable, $ratio) = $row;
+       $hostnotes = preg_grep("/$host/", $hostnoteall);
+       $hostnote = array_values($hostnotes);
+       if ($writable == 1 && $readable == 1) {
+          if ($ratio >= 97) {
+            # space used over limits, up mode (read/write ok).
+            echo "[ \"$host\", ";
+            echo "      $used, \"stroke-width: 0.3;\"+\"stroke-color: black;\"+\"color: #ff0000;\", \"<i><b>$host: $ratio% of $total TB used</b></i><br>$hostnote[0]\", ";
+            echo " $available, \"stroke-width: 0.3;\"+\"stroke-color: black;\"+\"color: #00ff00;\", \"<i><b>$host: $available TB free</b></i>\"],";
+          }
+          else {
+            # enough space, up mode (read/write ok).
+            echo "[ \"$host\", ";
+            echo "      $used, \"stroke-width: 0.3;\"+\"stroke-color: black;\"+\"color: #ffff00;\", \"<i><b>$host: $ratio% of $total TB used</b></i><br>$hostnote[0]\", ";
+            echo " $available, \"stroke-width: 0.3;\"+\"stroke-color: black;\"+\"color: #00ff00;\", \"<i><b>$host: $available TB free</b></i>\"],";
+         }
+       }
+       else if ($writable == 0 && $readable == 1) {
+          if ($ratio >= 97) {
+            # space used over limits, repair mode (read only).
+            echo "[ \"$host\", ";
+            echo "      $used, \"stroke-width: 0.3;\"+\"stroke-color: black;\"+\"color: #ff0000;\", \"<i><b>$host: $ratio% of $total TB used<br><font color=red>$hostnote[0]\", ";
+            echo " $available, \"stroke-width: 0.3;\"+\"stroke-color: black;\"+\"color: #bbbbbb;\", \"<i><b>$host: $available TB free</b></i>\"],";
+          }
+          else {
+            # enough space, but hosts are unstable, repair mode (read only).
+            echo "[ \"$host\", ";
+            echo "      $used, \"stroke-width: 0.3;\"+\"stroke-color: black;\"+\"color: #ffff00;\", \"<i><b>$host: $ratio% of $total TB used<br>$hostnote[0]\", ";
+            echo " $available, \"stroke-width: 0.3;\"+\"stroke-color: black;\"+\"color: #bbbbbb;\", \"<i><b>$host: $available TB free</b></i>\"],";
+          }
+       }
+       else {
+            # down mode (can't read or write).
+            echo "[ \"$host\", ";
+            echo "      $used, \"stroke-width: 0.3;\"+\"stroke-color: black;\"+\"color: #bbbbbb;\", \"<i><b>$host: $ratio% used<br>$hostnote[0]\", ";
+            echo " $available, \"stroke-width: 0.3;\"+\"stroke-color: black;\"+\"color: #bbbbbb;\", \"<i><b>$host: $available TB free</b></i>\"],";
+       }
+    }
+   echo "  ]);";
+   echo "   var options = {";
+   echo "     title: 'Nebulous Disk Use across IPP Clusters',";
+   echo "     titleTextStyle: {color: 'black', fontSize: 15},";
+   echo "     width: '100%',";
+   echo "     height: '100%',";
+   echo "     tooltip: {isHtml: true},";
+   echo "     legend: { position: 'none',";
+   echo "               alignment: 'end',";
+   echo "               maxLines: 3},";
+   echo "     hAxis: {  title: 'Space (TB)',";
+   echo "               gridlines: {count: 10}";
+   echo "     },";
+   echo "     bar: { groupWidth: '95%' },";
+   echo "     chartArea: {left:70, top:30, right:20, bottom:40},";
+   echo "     fontSize: 12,";
+   echo "     isStacked: true";
+   echo "   };";
+   echo "   var chart = new google.visualization.BarChart(document.getElementById('disk_div'));";
+   echo "   chart.draw(data, options);";
+   echo " }";
+   echo "</script>";
+    $time = microtime();
+    $time = explode(' ', $time);
+    $time = $time[1] + $time[0];
+    $finish = $time;
+    $total_time = round(($finish - $start), 3);
+    $start= $finish;
+    echo "<center>loading in $total_time seconds<br></center>";
+}
+
+###########################################################################
+#
+# Gets disk spaces status
+#
+###########################################################################
+function getSpaces($db) {
+    // timer start
+    $time = microtime();
+    $time = explode(' ', $time);
+    $time = $time[1] + $time[0];
+    $start = $time;
+
+    $db->query("SELECT sum(format(available, 2)) FROM hosts where host like 'ippb%'")->fetchInto($row);
+    $ippbusable = $row[0];
+    $db->query("SELECT sum(format(available, 2)) FROM hosts where host like 'ippb%' and writable = 1")->fetchInto($row);
+    $ippbfree = $row[0];
+
+    $db->query("SELECT sum(format(available, 2)) FROM hosts where host not like 'ippb%'")->fetchInto($row);
+    $ippusable = $row[0];
+    $db->query("SELECT sum(format(available, 2)) FROM hosts where host not like 'ippb%' and writable = 1")->fetchInto($row);
+    $ippfree = $row[0];
+
+    $sql = "select format(used/total*100,1), usable from cluster_space order by timestamp desc limit 1;";
+
+    if ($debug) {echo "$sql<br>";}
+    $qry = $db->query($sql);
+    if (dberror($qry)) {echo "<b>error with $sql </b><br>\n";}
+    $qry->fetchInto($row);
+    $allocated = $row[0];
+    $usable    = $row[1];
+
+    #echo "<script type=\"text/javascript\" src=\"https://www.gstatic.com/charts/loader.js\"></script>";
+    echo "<script type=\"text/javascript\" src=\"loader.js\"></script>";
+    echo "<br><div class=\"chartWithOverlay\" style=\"position: relative; width: 640; height:400\">"; 
+    echo "  <div id=\"space_div\" style=\"width:1000; \"></div>";
+    echo "  <div class=\"overlay\" style=\"position: absolute; width: 400px; bottom: 60px; left: 85px;\">";
+    echo "    <div style=\"font-size: 16px; color:#0000ff; background-color:#ffffff\"><b>ipp + ippb nodes: $ippusable + $ippbusable TB (latest usable)</b></div>";
+    echo "    <div style=\"font-size: 16px; color:#33a532; background-color:#ffffff\"><b>ipp + ippb nodes: $ippfree + $ippbfree TB (latest free)</b></div>";
+    echo "  </div>";
+    echo "</div>";
+
+    echo "<script type=\"text/javascript\">";
+    echo "google.charts.load('current', {packages: ['corechart']});";
+    echo "google.charts.setOnLoadCallback(drawChart);";
+    echo "function drawChart() {";
+    echo "  var data = new google.visualization.DataTable();";
+    echo "        data.addColumn('datetime', 'Day');";
+    echo "        data.addColumn('number', 'Usable');";
+    echo "        data.addColumn('number', 'Free');";
+    echo "   data.addRows([";
+    $interval = 10;
+    $sql = "select sub.dated, sub.usable, sub.available from (select date_format(timestamp, \"%Y.%m.%d.%H.%i\") as dated, usable, available from cluster_space where timestamp > curdate() - INTERVAL $interval DAY) as sub group by dated;";
+    if ($debug) {echo "$sql<br>";}
+    $qry = $db->query($sql);
+    if (dberror($qry)) {echo "<b>error with $sql </b><br>\n";}
+    while ($qry->fetchInto($row)) {
+        $tsp = explode('.', $row[0]);
+	$mon = $tsp[1]-1;
+        $timestamp = $row[0];
+        $usable    = $row[1];
+        $available = $row[2];
+#	new Date(Year, Month, Day, Hours, Minutes, Seconds, Milliseconds)
+       echo "[new Date($tsp[0], $mon, $tsp[2], $tsp[3], $tsp[4]), $usable, $available],";
+    }
+   echo "  ]);";
+   echo "   var options = {";
+   echo "      chart: {";  
+   echo "               position: 'center', " ;
+   echo "              },";
+   echo "     title: 'Total Available Cluster Space in the Past $interval Days ($allocated% of total allocated)',";
+   echo "     titleTextStyle: {color: 'black', fontSize: 15},";
+   echo "     width: '100%',";
+   echo "     height: 400,";
+   echo "     legend: { position: 'top',";
+   echo "               alignment: 'center',";
+   echo "              },";
+   echo "     lineWidth: 2, ";
+   echo "     series: {";
+   echo "         0: { color: '#0000ff', lineWidth: 3 },      ";
+   echo "         1: { color: '#33a532', lineWidth: 3 },      ";
+   echo "              },";
+   echo "     hAxis: {  ";
+   echo "             title: 'Date/Time (HST)',";
+   echo "             format: 'MMM dd',";
+   echo "            gridlines: {count: -1},"; 
+   echo "     },";
+   echo "     vAxis: {  ";
+   echo "                  title: 'Available (TB)',";
+   echo "     viewWindow: {   min: 500    },  ";
+   echo "     },";
+   echo "     chartArea: {left:80, top:50, right:20, bottom:50},";
+   echo "     fontSize: 12,";
+   echo "   };";
+   echo "   var chart = new google.visualization.LineChart(document.getElementById('space_div'));";
+   echo "   chart.draw(data, options);";
+   echo " }";
+   echo "</script>";
+    $time = microtime();
+    $time = explode(' ', $time);
+    $time = $time[1] + $time[0];
+    $finish = $time;
+    $total_time = round(($finish - $start), 3);
+    $start= $finish;
+    echo "<center>loading in $total_time seconds<br></center>";
+}
+
+
+?>
+
