Changeset 42931
- Timestamp:
- Oct 1, 2025, 4:09:43 PM (10 months ago)
- Location:
- trunk/ippMonitor/czartool
- Files:
-
- 6 edited
-
czarpoll.pl (modified) (3 diffs)
-
czartool/Config.pm (modified) (1 diff)
-
czartool/DayMetrics.pm (modified) (1 diff)
-
czartool/Metrics.pm (modified) (1 diff)
-
czartool/MetricsIndex.pm (modified) (1 diff)
-
czartool/MultiDayMetrics.pm (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippMonitor/czartool/czarpoll.pl
r42930 r42931 13 13 use List::MoreUtils qw(uniq); 14 14 use DateTime; 15 # This tells Perl: âalso look in the same directory where this script livesâ. 16 use FindBin; 17 use lib "$FindBin::Bin"; 15 18 16 19 # local classes … … 390 393 # check ippdb host IPP-2338 391 394 print "* Checking ippdb hosts\n"; 392 my @ hosts = qw(ipphome2 ipphome3 ippdb01 ippdb05 ippdb06 ippdb09 ippdb11 ippdb12 ippdb13 ippdb14);393 if($dbupdate == 1) {check_disk_usage_and_update($czarDb, @ hosts);}395 my @ippdb_hosts = qw(ipphome2 ipphome3 ippdb01 ippdb05 ippdb06 ippdb09 ippdb11 ippdb12 ippdb13 ippdb14); 396 if($dbupdate == 1) {check_disk_usage_and_update($czarDb, @ippdb_hosts);} 394 397 395 398 print "* Checking ippdvo hosts\n"; 396 my @ hosts = qw(ippdvo00 ippdvo01 ippdvo02 ippdvo03 ippdvo04 ippdvo05 ippdvo06 ippdvo07 ippdvo08 ippdvo09 ippdvo10 ippdvo11 ippdvo12 ippdvo13 ippdvo14 ippdvo15);397 if($dbupdate == 1) {check_disk_usage_and_update($czarDb, @ hosts);}399 my @ippdvo_hosts = qw(ippdvo00 ippdvo01 ippdvo02 ippdvo03 ippdvo04 ippdvo05 ippdvo06 ippdvo07 ippdvo08 ippdvo09 ippdvo10 ippdvo11 ippdvo12 ippdvo13 ippdvo14 ippdvo15); 400 if($dbupdate == 1) {check_disk_usage_and_update($czarDb, @ippdvo_hosts);} 398 401 399 402 # check pantasks status … … 632 635 print " - Checking $host...\n"; 633 636 634 for my $suffix (0, 1) { 637 # Determine which suffixes to check 638 my @suffixes; 639 if ($host eq 'ippdb06') { 640 @suffixes = (1); # only .1 641 } else { 642 @suffixes = (0); # all others only .0 643 } 644 645 foreach my $suffix (@suffixes) { 635 646 my $mount_point = "/export/$host.$suffix"; 636 647 637 # Use SSH to get disk stats 648 # --- Default values --- 649 my $total_tb = 0; 650 my $used_tb = 0; 651 my $available_tb = 0; 652 my $readable = 0; 653 my $writable = 0; 654 my $xattr = 9; 655 656 # SSH/df 638 657 my $df_output = `ssh $host df -k $mount_point 2>/dev/null`; 639 658 640 #if (!$df_output || $df_output !~ /\d/) { 641 # warn "Failed to get disk usage for $host on $mount_point\n"; 642 # next; 643 #} 644 645 my @lines = split /\n/, $df_output; 646 my $line = $lines[1] || next; 647 648 my ($filesystem, $blocks, $used, $available, $percent, $mount) = split /\s+/, $line; 649 650 # Convert KB to TB 651 my $total_tb = sprintf("%.3f", $blocks / 1024 / 1024 / 1024 ); 652 my $used_tb = sprintf("%.3f", $used / 1024 / 1024 / 1024 ); 653 my $available_tb = sprintf("%.3f", $available / 1024 / 1024 / 1024 ); 654 655 my $used_percent = sprintf("%.3f", $used / $blocks * 100); 656 my $available_percent = sprintf("%.3f", $available / $blocks * 100); 657 658 my $readable = 1; 659 my $writable = 1; 660 my $xattr = 9; 661 662 #print "Mount $mount_point: total=${total_tb}TB, used=${used_tb}TB (${used_percent}%), available=${available_tb}TB (${available_percent}%)\n"; 659 if ($df_output && $df_output =~ /\d/) { 660 my @lines = split /\n/, $df_output; 661 my $line = $lines[1]; 662 663 if ($line) { 664 my ($filesystem, $blocks, $used, $available, $percent, $mount) = split /\s+/, $line; 665 666 if ($blocks && $blocks > 0) { 667 $total_tb = sprintf("%.3f", $blocks / 1024 / 1024 / 1024 ); 668 $used_tb = sprintf("%.3f", $used / 1024 / 1024 / 1024 ); 669 $available_tb = sprintf("%.3f", $available / 1024 / 1024 / 1024 ); 670 671 $readable = 1; 672 $writable = 1; 673 } 674 } 675 } else { 676 warn " ! Failed to SSH/df $host:$mount_point, defaulting to zeros\n"; 677 } 663 678 664 679 my $host_label = "$host.$suffix"; 665 680 666 if ($host_label =~ /ippdvo/i) { # case-insensitive match667 $xattr = 8; # override for ippdvo hosts681 if ($host_label =~ /ippdvo/i) { 682 $xattr = 8; 668 683 } 669 684 670 # --- Skip update if total TB < 1 --- 671 if ($total_tb < 1) { 672 warn " ! Skipping $host_label because total TB ($total_tb) < 1\n"; 673 next; 674 } 675 676 # Update host in DB 685 # Update DB 677 686 $czarDb->updateHost($host_label, $total_tb, $available_tb, $used_tb, $readable, $writable, $xattr); 678 687 } -
trunk/ippMonitor/czartool/czartool/Config.pm
r41302 r42931 6 6 use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt ); 7 7 use POSIX qw/strftime/; 8 use CGI::Pretty qw[:standard]; 8 # use CGI::Pretty qw[:standard]; 9 use CGI qw(:standard -utf8); 9 10 use XML::LibXML; 10 11 -
trunk/ippMonitor/czartool/czartool/DayMetrics.pm
r38258 r42931 6 6 use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt ); 7 7 use POSIX qw/strftime/; 8 use CGI::Pretty qw[:standard]; 8 #use CGI::Pretty qw[:standard]; 9 use CGI qw(:standard -utf8); 9 10 10 11 use czartool::CzarDb; -
trunk/ippMonitor/czartool/czartool/Metrics.pm
r38258 r42931 6 6 use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt ); 7 7 use POSIX qw/strftime/; 8 use CGI::Pretty qw[:standard]; 8 #use CGI::Pretty qw[:standard]; 9 use CGI qw(:standard -utf8); 9 10 10 11 use czartool::CzarDb; -
trunk/ippMonitor/czartool/czartool/MetricsIndex.pm
r38258 r42931 6 6 use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt ); 7 7 use POSIX qw/strftime/; 8 use CGI::Pretty qw[:standard]; 8 # use CGI::Pretty qw[:standard]; 9 use CGI qw(:standard -utf8); 9 10 10 11 use czartool::CzarDb; -
trunk/ippMonitor/czartool/czartool/MultiDayMetrics.pm
r32093 r42931 6 6 use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt ); 7 7 use POSIX qw/strftime/; 8 use CGI::Pretty qw[:standard]; 8 #use CGI::Pretty qw[:standard]; 9 use CGI qw(:standard -utf8); 9 10 10 11 use czartool::CzarDb;
Note:
See TracChangeset
for help on using the changeset viewer.
