Index: trunk/ippMonitor/raw/storage.php
===================================================================
--- trunk/ippMonitor/raw/storage.php	(revision 42736)
+++ trunk/ippMonitor/raw/storage.php	(revision 42921)
@@ -52,11 +52,11 @@
     echo "<script type=\"text/javascript\" src=\"loader.js\"></script>";
     echo "<br><div class=\"chartWithOverlay\" style=\"position: relative; width: 100%\">";
-    echo "  <div id=\"disk_div\" style=\"width:100%; height:4000px\"></div>";
+    echo "  <div id=\"disk_div\" style=\"width:100%; height:5000px\"></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: lightgreen\"><center>Free</div>";
+    echo "    <div style=\"font-size: 12px; height: 14px; border: 1px solid; background-color: yellow\"><center>Used</div>";
+    echo "    <div style=\"font-size: 12px; height: 14px; border: 1px solid; background-color: pink\"><center>> 97% limit</div>";
+    echo "    <div style=\"font-size: 12px; height: 14px; border: 1px solid; background-color: lightgrey\"><center>Down | Repair</div>";
+    echo "    <div style=\"font-size: 12px; height: 14px; border: 1px solid; background-color: white\"><center>Offline</div>";
     echo "  </div>";
     echo "</div>";
@@ -69,7 +69,5 @@
     exec("neb-host |cut -b 17-30,86-", $hostnoteall);
 
-    $sql = "SELECT host, format(total, 2), format(available, 2), format(used, 2), writable, readable, format(used/total*100,3) as ratio 
-            FROM hosts 
-            ORDER BY host";
+    $sql = "SELECT host, format(total, 2), format(available, 2), format(used, 2), writable, readable, format(used/total*100,3) as ratio FROM hosts where xattr <> 3 ";
     $qry = $db->query($sql);
 
@@ -80,32 +78,72 @@
 
     $dataRows = array();
+    $maxUsed = 0;   // initialize before the while loop
+
     while ($qry->fetchInto($row)) {
-        // Access data using numeric indices
-        $host = $row[0]; // ipp071.0
-        $total = $row[1]; // 80.0352
-        $available = $row[2]; // 10.8096
-        $used = $row[3]; // 69.2256
-        $writable = $row[4]; // 0
-        $readable = $row[5]; // 1
-        $ratio = $row[6]; // 86.493950215116
-
+        // Access by index
+        $host      = $row[0]; // ipp071.0
+        $total     = $row[1]; // 80.0352 TB
+        $available = $row[2]; // 10.8096 TB
+        $used      = $row[3]; // 69.2256 TB
+        $writable  = $row[4]; // 0
+        $readable  = $row[5]; // 1
+        $ratio     = $row[6]; // 86.4939 %
+
+        // update maxUsed
+        if ($total > $maxUsed) {
+            $maxUsed = $total/2;
+        }
+
+        // Match notes
         $hostnotes = preg_grep("/$host/", $hostnoteall);
         $hostnote = reset($hostnotes);
 
-        $styles = "stroke-width: 0.5; stroke-color: black;";
+        // Defaults
+        $styles    = "stroke-width: .5; stroke-color: black;";
+        $status    = "down";
+        $usedColor = "lightgrey";
+        $freeColor = "lightgrey";
+
+        // Status logic
         if ($writable == 1 && $readable == 1) {
-            $usedColor = $ratio >= 97 ? "#ff0000" : "#ffff00";
-            $freeColor = "#00ff00";
+            $status    = "up";
+            $usedColor = ($ratio >= 97) ? "pink" : "yellow"; // red if â¥97%
+            $freeColor = "#a6ec99"; // green free
         } elseif ($writable == 0 && $readable == 1) {
-            $usedColor = $ratio >= 97 ? "#ff0000" : "#ffff00";
-            $freeColor = "#bbbbbb";
+            $status    = "repair";
+            $usedColor = ($ratio >= 97) ? "pink" : "yellow";
+            $freeColor = "lightgrey"; // grey free
+        } elseif ($available < 1) {
+            $used      = $maxUsed;
+            $available = $maxUsed;
+            $status    = "offline";
+            $usedColor = "white";
+            $freeColor = "white";
+        }
+    
+        if ($status == "down") {
+            $tooltipUsed = $host . ": " . round($ratio, 1) . "% of " . $total . " TB used ". 
+                           "<span style='color:red; font-weight:bold;'> <br>" . $hostnote .  "</span>";
+            $tooltipFree = "<span style='color:red; font-weight:bold;'>" .
+                           $host . ": " . $available . " TB free" .
+                           "</span>";
+        } elseif ($status == "offline") {
+            $tooltipUsed = $host . ": " . round($ratio, 1) . "% of " . $total . " TB used ". 
+                           "<span style='color:red; font-weight:bold;'> <br>" . $hostnote .  "</span>";
+            $tooltipFree = "<span style='color:red; font-weight:bold;'>" .
+                           $host . ": " . $total . " TB free" .
+                           "</span>";
         } else {
-            $usedColor = $freeColor = "#bbbbbb";
+            $tooltipUsed = $host . ": " . round($ratio, 1) . "% of " . $total . " TB used<br>" . $hostnote;
+            $tooltipFree = $host . ": " . $available . " TB free";
         }
 
-        $dataRows[] = "[ \"$host\", $used, \"$styles color: $usedColor;\", \"$host: $ratio% of $total TB used<br>$hostnote\", 
-                       $available, \"$styles color: $freeColor;\", \"$host: $available TB free\"]";
+        // Build data row (manual string concatenation for old PHP)
+        $dataRows[] =
+            "[ \"" . $host . ":" . $status . "\", " .
+            $used . ", \"" . $styles . " color: " . $usedColor . ";\", \"" . $tooltipUsed . "\", " .
+            $available . ", \"" . $styles . " color: " . $freeColor . ";\", \"" . $tooltipFree . "\" ]";
+
     }
-
     echo "<script type=\"text/javascript\">
             google.charts.load('current', {packages: ['corechart', 'bar']});
@@ -126,8 +164,10 @@
                     tooltip: {isHtml: true},
                     legend: { position: 'none', alignment: 'end', maxLines: 3 },
-                    hAxis: { title: 'Space (TB)', gridlines: {count: 10} },
+                    hAxis: { title: 'Space (TB)', gridlines: {count: 20} },
+                    vAxis: { textStyle: {fontSize: 14}, format: 'string',  textPosition: 'in', direction: 1},
                     bar: { groupWidth: '95%' },
-                    chartArea: {left:100, top:50, right:20, bottom:40},
+                    chartArea: {left:40, top:50, right:20, bottom:40},
                     fontSize: 15,
+                    allowHtml: true,
                     isStacked: true
                 };
@@ -155,13 +195,19 @@
     $start = $time;
 
-    $db->query("SELECT sum(format(available, 2)) FROM hosts where host like 'ippb%'")->fetchInto($row);
+    $db->query("SELECT FORMAT(IFNULL(SUM(available), 0), 1) FROM hosts where host like 'ippb%' and xattr <> 3")->fetchInto($row);
     $ippbusable = $row[0];
-    $db->query("SELECT sum(format(available, 2)) FROM hosts where host like 'ippb%' and writable = 1")->fetchInto($row);
+    $db->query("SELECT FORMAT(IFNULL(SUM(available), 0), 1) FROM hosts where host like 'ippb%' and writable = 1 and xattr <> 3")->fetchInto($row);
     $ippbfree = $row[0];
 
-    $db->query("SELECT sum(format(available, 2)) FROM hosts where host not like 'ippb%'")->fetchInto($row);
+    $db->query("SELECT FORMAT(IFNULL(SUM(available), 0), 1) FROM hosts where host not like 'ippb%' and xattr <> 3")->fetchInto($row);
     $ippusable = $row[0];
-    $db->query("SELECT sum(format(available, 2)) FROM hosts where host not like 'ippb%' and writable = 1")->fetchInto($row);
+    $db->query("SELECT FORMAT(IFNULL(SUM(available), 0), 1) FROM hosts where host not like 'ippb%' and writable = 1 and xattr <> 3")->fetchInto($row);
     $ippfree = $row[0];
+
+    $db->query("SELECT FORMAT(IFNULL(SUM(available), 0), 1) FROM hosts where host like 'ipp%_bck.0' and xattr <> 3")->fetchInto($row);
+    $bckusable = $row[0];
+    $db->query("SELECT FORMAT(IFNULL(SUM(available), 0), 1) FROM hosts where host like 'ipp%_bck.0' and writable = 1 and xattr <> 3")->fetchInto($row);
+    $bckfree = $row[0];
+
 
     $sql = "select format(used/total*100,1), usable from cluster_space order by timestamp desc limit 1;";
@@ -178,7 +224,7 @@
     echo "<br><div class=\"chartWithOverlay\" style=\"position: relative; width: 100%; height:400\">"; 
     echo "  <div id=\"space_div\" style=\"width:100%; \"></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 class=\"overlay\" style=\"position: absolute; width: 500px; bottom: 60px; left: 80px;\">";
+    echo "    <div style=\"font-size: 16px; color:#0000ff; \"><b>ipp*_bck: $bckusable TB (usable)</b></div>";
+    echo "    <div style=\"font-size: 16px; color:#33a532; \"><b>ipp*_bck: $bckfree   TB (free)</b></div>";
     echo "  </div>";
     echo "</div>";
@@ -190,6 +236,6 @@
     echo "  var data = new google.visualization.DataTable();";
     echo "        data.addColumn('datetime', 'Day');";
-    echo "        data.addColumn('number', 'Usable');";
-    echo "        data.addColumn('number', 'Free');";
+    echo "        data.addColumn('number', 'Usable (ipp:$ippusable, ippb:$ippbusable) TB');";
+    echo "        data.addColumn('number', 'Free (ipp:$ippfree, ippb:$ippbfree) TB');";
     echo "   data.addRows([";
     $interval = 10;
