IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Sep 10, 2025, 3:57:45 PM (8 months ago)
Author:
cclin33
Message:

update storage views

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippMonitor/raw/storage.php

    r42921 r42922  
    5050    $start = microtime(true);
    5151
    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>";
    6352
    6453    // Set environment variables
     
    6958    exec("neb-host |cut -b 17-30,86-", $hostnoteall);
    7059
    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;";
    7261    $qry = $db->query($sql);
    7362
     
    7766    }
    7867
     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
    7976    $dataRows = array();
    80     $maxUsed = 0;   // initialize before the while loop
    81 
    8277    while ($qry->fetchInto($row)) {
    8378        // Access by index
     
    8984        $readable  = $row[5]; // 1
    9085        $ratio     = $row[6]; // 86.4939 %
    91 
    92         // update maxUsed
    93         if ($total > $maxUsed) {
    94             $maxUsed = $total/2;
    95         }
    9686
    9787        // Match notes
     
    116106        } elseif ($available < 1) {
    117107            $used      = $maxUsed;
    118             $available = $maxUsed;
     108            $available = 0;
    119109            $status    = "offline";
    120110            $usedColor = "white";
     
    135125                           "</span>";
    136126        } 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 ;
    138128            $tooltipFree = $host . ": " . $available . " TB free";
    139129        }
     130
    140131
    141132        // Build data row (manual string concatenation for old PHP)
     
    177168            }
    178169          </script>";
     170
     171echo "<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>";
    179191
    180192    $total_time = round(microtime(true) - $start, 3);
Note: See TracChangeset for help on using the changeset viewer.