Changeset 42922 for trunk/ippMonitor/raw/storage.php
- Timestamp:
- Sep 10, 2025, 3:57:45 PM (8 months ago)
- File:
-
- 1 edited
-
trunk/ippMonitor/raw/storage.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippMonitor/raw/storage.php
r42921 r42922 50 50 $start = microtime(true); 51 51 52 echo "<script type=\"text/javascript\" src=\"loader.js\"></script>";53 echo "<br><div class=\"chartWithOverlay\" style=\"position: relative; width: 100%\">";54 echo " <div id=\"disk_div\" style=\"width:100%; height:5000px\"></div>";55 echo " <div class=\"overlay\" style=\"position: absolute; width: 100px; top: 50px; right: 20px;\">";56 echo " <div style=\"font-size: 12px; height: 14px; border: 1px solid; background-color: lightgreen\"><center>Free</div>";57 echo " <div style=\"font-size: 12px; height: 14px; border: 1px solid; background-color: yellow\"><center>Used</div>";58 echo " <div style=\"font-size: 12px; height: 14px; border: 1px solid; background-color: pink\"><center>> 97% limit</div>";59 echo " <div style=\"font-size: 12px; height: 14px; border: 1px solid; background-color: lightgrey\"><center>Down | Repair</div>";60 echo " <div style=\"font-size: 12px; height: 14px; border: 1px solid; background-color: white\"><center>Offline</div>";61 echo " </div>";62 echo "</div>";63 52 64 53 // Set environment variables … … 69 58 exec("neb-host |cut -b 17-30,86-", $hostnoteall); 70 59 71 $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 ";60 $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 ORDER BY CASE WHEN ROUND(used/total*100,3) = 100 THEN 0 ELSE 1 END, CASE WHEN host LIKE '%\_bck.0' THEN 1 ELSE 0 END, host;"; 72 61 $qry = $db->query($sql); 73 62 … … 77 66 } 78 67 68 $sqlMax = "SELECT MAX(total) AS max_total FROM hosts WHERE xattr <> 3"; 69 $qryMax = $db->query($sqlMax); 70 $maxUsed = 0; 71 72 if ($qryMax && $qryMax->fetchInto($rowMax)) { 73 $maxUsed = $rowMax[0]; // max_total value 74 } 75 79 76 $dataRows = array(); 80 $maxUsed = 0; // initialize before the while loop81 82 77 while ($qry->fetchInto($row)) { 83 78 // Access by index … … 89 84 $readable = $row[5]; // 1 90 85 $ratio = $row[6]; // 86.4939 % 91 92 // update maxUsed93 if ($total > $maxUsed) {94 $maxUsed = $total/2;95 }96 86 97 87 // Match notes … … 116 106 } elseif ($available < 1) { 117 107 $used = $maxUsed; 118 $available = $maxUsed;108 $available = 0; 119 109 $status = "offline"; 120 110 $usedColor = "white"; … … 135 125 "</span>"; 136 126 } else { 137 $tooltipUsed = $host . ": " . round($ratio, 1) . "% of " . $total . " TB used<br>" . $hostnote ;127 $tooltipUsed = $host . ": " . round($ratio, 1) . "% of " . $total . " TB used<br>" . $hostnote ; 138 128 $tooltipFree = $host . ": " . $available . " TB free"; 139 129 } 130 140 131 141 132 // Build data row (manual string concatenation for old PHP) … … 177 168 } 178 169 </script>"; 170 171 echo "<script type='text/javascript' src='loader.js'></script> 172 <br> 173 <div class='chartWithOverlay' style='position: relative; width: 100%'> 174 175 <div id='disk_div' style='width:100%; height:5000px'></div> 176 177 <div class='overlay' style='position: absolute; width:160px; top:50px; right:30px; font-family:Arial, sans-serif;'> 178 179 <div style='font-size:15px; border:1px solid #888; background-color:lightgreen; color:black; text-align:center; margin-bottom:1px;'>Free</div> 180 <div style='font-size:15px; border:1px solid #888; background-color:yellow ; color:black; text-align:center; margin-bottom:1px;'>Used</div> 181 <div style='font-size:15px; border:1px solid #888; background-color:pink ; color:black; text-align:center; margin-bottom:1px;'>97% Usage</div> 182 <div style='font-size:15px; border:1px solid #888; background-color:lightgrey ; color:black; text-align:center; margin-bottom:1px;'>Down/Repair</div> 183 <div style='font-size:15px; border:1px solid #888; background-color:white ; color:black; text-align:center; margin-bottom:1px;'>Offline</div> 184 <div style='font-size:15px; border:1px solid #888; background-color:#42a5f5 ; color:white; text-align:center; margin-bottom:1px;'> 185 <a href='https://atrcganglia.ifa.hawaii.edu/' target='_blank' style='text-decoration:none; color:white; font-weight:bold;'>ATRC ganglia</a> 186 </div> 187 188 </div> 189 190 </div>"; 179 191 180 192 $total_time = round(microtime(true) - $start, 3);
Note:
See TracChangeset
for help on using the changeset viewer.
