Changeset 42923
- Timestamp:
- Sep 11, 2025, 12:59:29 PM (8 months ago)
- Location:
- trunk/ippMonitor
- Files:
-
- 6 edited
-
czartool/czarpoll.pl (modified) (5 diffs)
-
czartool/czartool/CzarDb.pm (modified) (1 diff)
-
czartool/czartool/Nebulous.pm (modified) (1 diff)
-
czartool/czartool/Pantasks.pm (modified) (1 diff)
-
raw/czartool_labels.php (modified) (3 diffs)
-
raw/storage.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippMonitor/czartool/czarpoll.pl
r42921 r42923 260 260 $pantasks->getServerStatus($server,'gpc1', \$alive, \$running, \$pan_host); 261 261 $czarDb->updateServerStatusLive($server,'gpc1', $alive, $running, $pan_host); 262 print "Server: $server | Telescope: gpc1 | Alive: $alive | Running: $running | Host: " . (defined $pan_host ? $pan_host : "undef") . "\n";262 #print "Server: $server | Telescope: gpc1 | Alive: $alive | Running: $running | Host: " . (defined $pan_host ? $pan_host : "undef") . "\n"; 263 263 # For gpc2 264 264 $pantasks->getServerStatus($server,'gpc2', \$alive, \$running, \$pan_host); 265 265 $czarDb->updateServerStatusLive($server,'gpc2', $alive, $running, $pan_host); 266 print "Server: $server | Telescope: gpc2 | Alive: $alive | Running: $running | Host: " . (defined $pan_host ? $pan_host : "undef") . "\n";266 #print "Server: $server | Telescope: gpc2 | Alive: $alive | Running: $running | Host: " . (defined $pan_host ? $pan_host : "undef") . "\n"; 267 267 } 268 268 } … … 318 318 if($timediff > 120.) { 319 319 print "There is no recent Czarpoll iteration\n"; 320 print " * Updating database entries*\n";320 print "== Updating database entries ==\n"; 321 321 $dbupdate = 1; 322 322 } else { 323 323 print "There is a recent Czarpoll iteration already made ($timediff sec ago)\n"; 324 print " * Skipping database queries and entries\n";324 print "== Skipping database queries and entries ==\n"; 325 325 $dbupdate = 0; 326 326 } … … 390 390 # check ippdb host IPP-2338 391 391 print "* Checking ippdb hosts\n"; 392 my @hosts = qw(ipphome 0 ipphome1ippdb01 ippdb05 ippdb06 ippdb09 ippdb11 ippdb12 ippdb13 ippdb14);392 my @hosts = qw(ipphome2 ipphome3 ippdb01 ippdb05 ippdb06 ippdb09 ippdb11 ippdb12 ippdb13 ippdb14); 393 393 if($dbupdate == 1) {check_disk_usage_and_update($czarDb, @hosts);} 394 394 … … 626 626 627 627 foreach my $host (@hosts) { 628 print " Checking $host...\n";628 print " - Checking $host...\n"; 629 629 630 630 for my $suffix (0, 1) { … … 654 654 my $readable = 1; 655 655 my $writable = 1; 656 my $xattr = 0;656 my $xattr = 9; 657 657 658 658 #print "Mount $mount_point: total=${total_tb}TB, used=${used_tb}TB (${used_percent}%), available=${available_tb}TB (${available_percent}%)\n"; 659 659 660 # Example: ippdb01.0(3.5T)661 #my $host_label = "$host.$suffix(${total_tb}T)";662 660 my $host_label = "$host.$suffix"; 661 662 # --- Skip update if total TB < 1 --- 663 if ($total_tb < 1) { 664 warn " ! Skipping $host_label because total TB ($total_tb) < 1\n"; 665 next; 666 } 667 668 # Update host in DB 663 669 $czarDb->updateHost($host_label, $total_tb, $available_tb, $used_tb, $readable, $writable, $xattr); 664 670 } -
trunk/ippMonitor/czartool/czartool/CzarDb.pm
r42921 r42923 175 175 ########################################################################### 176 176 sub updateServerStatusLive { 177 177 178 my ($self, $server,$telescope, $alive, $running, $pan_host) = @_; 178 179 179 my $query = $self->{_db}->prepare(<<SQL); 180 DELETE FROM live_servers where timestamp < CURRENT_TIMESTAMP - INTERVAL 12 hour; 181 SQL 182 $query->execute; 183 184 $query = $self->{_db}->prepare(<<SQL); 185 INSERT INTO live_servers 186 (server,telescope, alive, running, host) 187 VALUES 188 ('$server','$telescope', $alive, $running, '$pan_host'); 189 SQL 190 $query->execute; 180 # --- Provide defaults if undefined --- 181 $server = defined $server ? $server : ''; # empty string if undef 182 $telescope = defined $telescope ? $telescope : ''; # empty string if undef 183 $alive = defined $alive ? $alive : 0; # default 0 if undef 184 $running = defined $running ? $running : 0; # default 0 if undef 185 $pan_host = defined $pan_host ? $pan_host : ''; # empty string if undef 186 187 ## Debug print so you can see the values 188 #warn sprintf( 189 # "server=%s telescope=%s alive=%s running=%s pan_host=%s\n", 190 # $server, $telescope, $alive, $running, $pan_host 191 #); 192 193 # --- Delete old records --- 194 my $query = $self->{_db}->prepare( 195 'DELETE FROM live_servers WHERE timestamp < CURRENT_TIMESTAMP - INTERVAL 12 HOUR' 196 ); 197 $query->execute or die $query->errstr; 198 199 $query = $self->{_db}->prepare( 200 'INSERT INTO live_servers (server, telescope, alive, running, host) 201 VALUES (?, ?, ?, ?, ?)' 202 ); 203 $query->execute($server, $telescope, $alive, $running, $pan_host); 204 191 205 } 192 206 -
trunk/ippMonitor/czartool/czartool/Nebulous.pm
r42921 r42923 122 122 123 123 $self->getReadableWritableStatus($1, \$readable, \$writable, \$xattr); 124 print "Host: $1, Readable: $readable, Writable: $writable, Xattr: $xattr\n";124 #print "Host: $1, Readable: $readable, Writable: $writable, Xattr: $xattr\n"; 125 125 126 126 -
trunk/ippMonitor/czartool/czartool/Pantasks.pm
r42858 r42923 109 109 my $today = sprintf("%04d-%02d-%02d", $year+1900, $month+1, $day); 110 110 111 print "stdscience : $ipphome/stdscience/ptolemy.rc\n";111 #print "stdscience : $ipphome/stdscience/ptolemy.rc\n"; 112 112 my @cmdOut = `echo "ns.show.dates;quit" | pantasks_client -c $ipphome/stdscience/ptolemy.rc 2>&1`; 113 113 my $line; -
trunk/ippMonitor/raw/czartool_labels.php
r42922 r42923 1827 1827 $start = microtime(true); 1828 1828 1829 echo "<script type=\"text/javascript\" src=\"loader.js\"></script>";1830 echo "<br><div class=\"chartWithOverlay\" style=\"position: relative; width: 100%\">";1831 echo " <div id=\"disk_div\" style=\"width:100%; height:5000px\"></div>";1832 echo " <div class=\"overlay\" style=\"position: absolute; width: 100px; top: 50px; right: 20px;\">";1833 echo " <div style=\"font-size: 12px; height: 14px; border: 1px solid; background-color: lightgreen\"><center>Free</div>";1834 echo " <div style=\"font-size: 12px; height: 14px; border: 1px solid; background-color: yellow\"><center>Used</div>";1835 echo " <div style=\"font-size: 12px; height: 14px; border: 1px solid; background-color: pink\"><center>> 97% limit</div>";1836 echo " <div style=\"font-size: 12px; height: 14px; border: 1px solid; background-color: lightgrey\"><center>Down | Repair</div>";1837 echo " <div style=\"font-size: 12px; height: 14px; border: 1px solid; background-color: white\"><center>Offline</div>";1838 echo " </div>";1839 echo "</div>";1840 1829 1841 1830 // Set environment variables … … 1943 1932 legend: { position: 'none', alignment: 'end', maxLines: 3 }, 1944 1933 hAxis: { title: 'Space (TB)', gridlines: {count: 20} }, 1945 vAxis: { textStyle: {fontSize: 1 4}, format: 'string', textPosition: 'in', direction: 1},1934 vAxis: { textStyle: {fontSize: 15}, format: 'string', textPosition: 'in', direction: 1}, 1946 1935 bar: { groupWidth: '95%' }, 1947 1936 chartArea: {left:40, top:50, right:20, bottom:40}, … … 1955 1944 } 1956 1945 </script>"; 1946 1947 echo "<script type='text/javascript' src='loader.js'></script> 1948 <br> 1949 <div class='chartWithOverlay' style='position: relative; width: 100%'> 1950 1951 <div id='disk_div' style='width:100%; height:5000px'></div> 1952 1953 <div class='overlay' style='position: absolute; width:160px; top:50px; right:30px; font-family:Arial, sans-serif;'> 1954 1955 <div style='font-size:15px; border:1px solid #888; background-color:lightgreen; color:black; text-align:center; margin-bottom:1px;'>Free</div> 1956 <div style='font-size:15px; border:1px solid #888; background-color:yellow ; color:black; text-align:center; margin-bottom:1px;'>Used</div> 1957 <div style='font-size:15px; border:1px solid #888; background-color:pink ; color:black; text-align:center; margin-bottom:1px;'>97% Usage</div> 1958 <div style='font-size:15px; border:1px solid #888; background-color:lightgrey ; color:black; text-align:center; margin-bottom:1px;'>Down/Repair</div> 1959 <div style='font-size:15px; border:1px solid #888; background-color:white ; color:black; text-align:center; margin-bottom:1px;'>Offline</div> 1960 <div style='font-size:15px; border:1px solid #888; background-color:#42a5f5 ; color:white; text-align:center; margin-bottom:1px;'> 1961 <a href='https://atrcganglia.ifa.hawaii.edu/' target='_blank' style='text-decoration:none; color:white; font-weight:bold;'>ATRC ganglia</a> 1962 </div> 1963 1964 </div> 1965 1966 </div>"; 1957 1967 1958 1968 $total_time = round(microtime(true) - $start, 3); -
trunk/ippMonitor/raw/storage.php
r42922 r42923 58 58 exec("neb-host |cut -b 17-30,86-", $hostnoteall); 59 59 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;";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, xattr, host;"; 61 61 $qry = $db->query($sql); 62 62
Note:
See TracChangeset
for help on using the changeset viewer.
