IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 13, 2025, 1:13:09 PM (14 months ago)
Author:
cclin33
Message:

add disk usage in Database status section

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippMonitor/czartool/czarpoll.pl

    r42798 r42858  
    229229
    230230    my $server = undef;
    231     my $alive = undef;
    232     my $running = undef;
     231
     232    my ($alive, $running);
     233
    233234    foreach $server (@{$servers}) {
     235        # For gpc1
    234236        $pantasks->getServerStatus($server,'gpc1', \$alive, \$running);
    235237        $czarDb->updateServerStatus($server,'gpc1', $alive, $running);
     238        # For gpc2
    236239        $pantasks->getServerStatus($server,'gpc2', \$alive, \$running);
    237240        $czarDb->updateServerStatus($server,'gpc2', $alive, $running);
     241
    238242   }
    239243}
     
    245249###########################################################################
    246250sub updateServerStatusLive {
    247     print "* Checking all pantasks servers\n";
     251    print "* Checking all pantasks live servers\n";
    248252
    249253    my $servers = $pantasks->getServerList();
    250254
    251255    my $server = undef;
    252     my $alive = undef;
    253     my $running = undef;
     256    my ($alive, $running, $pan_host);
     257
    254258    foreach $server (@{$servers}) {
    255         $pantasks->getServerStatus($server,'gpc1', \$alive, \$running);
    256         $czarDb->updateServerStatusLive($server,'gpc1', $alive, $running);
    257         $pantasks->getServerStatus($server,'gpc2', \$alive, \$running);
    258         $czarDb->updateServerStatusLive($server,'gpc2', $alive, $running);
     259        # For gpc1
     260        $pantasks->getServerStatus($server,'gpc1', \$alive, \$running, \$pan_host);
     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";
     263        # For gpc2
     264        $pantasks->getServerStatus($server,'gpc2', \$alive, \$running, \$pan_host);
     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";
    259267   }
    260268}
     
    637645
    638646            # Convert KB to TB
    639             my $total_tb     = sprintf("%.1f", $blocks    / 1024 / 1024 / 1024);
    640             my $used_tb      = sprintf("%.1f", $used      / 1024 / 1024 / 1024);
    641             my $available_tb = sprintf("%.1f", $available / 1024 / 1024 / 1024);
     647            my $total_tb     = sprintf("%.3f", $blocks    / 1024 / 1024 / 1024 );
     648            my $used_tb      = sprintf("%.3f", $used      / 1024 / 1024 / 1024 );
     649            my $available_tb = sprintf("%.3f", $available / 1024 / 1024 / 1024 );
    642650
    643651            my $used_percent      = sprintf("%.3f", $used / $blocks * 100);
     
    650658
    651659            # Example: ippdb01.0(3.5T)
    652             my $host_label = "$host.$suffix(${total_tb}T)";
    653             $czarDb->updateHost($host_label, 100, $available_percent, $used_percent, $readable, $writable);
    654         }
    655     }
    656 }
     660            #my $host_label = "$host.$suffix(${total_tb}T)";
     661            my $host_label = "$host.$suffix";
     662            $czarDb->updateHost($host_label, $total_tb, $available_tb, $used_tb, $readable, $writable);
     663        }
     664    }
     665}
Note: See TracChangeset for help on using the changeset viewer.