AFS-Monitor
view release on metacpan or search on metacpan
examples/afsmonitor view on Meta::CPAN
fshosts => \@fshosts,
config => $configfilename
);
parse_results($fsinfo, $cminfo);
}
if ($all || $tests[9]) {
print "\n******** TEST 9: ********\n";
print "\nafsmonitor -cmhosts ", join(" ", @cmhosts),
" -fshosts ", join(" ", @fshosts), "\n\n";
($fsinfo, $cminfo) = afsmonitor(cmhosts => \@cmhosts,
fshosts => \@fshosts
);
parse_results($fsinfo, $cminfo);
}
if ($all || $tests[10]) {
print "\n******** TEST 10: ********\n";
print "\nafsmonitor -config $configfilename\n\n";
($fsinfo, $cminfo) = afsmonitor(config => $configfilename);
parse_results($fsinfo, $cminfo);
}
if ($all || $tests[11]) {
print "\n******** TEST 11: ********\n";
print "\nafsmonitor -config $badconfigfile\n\n";
($fsinfo, $cminfo) = afsmonitor(config => $badconfigfile);
parse_results($fsinfo, $cminfo);
}
if ($all || $tests[12]) {
print "\n******** TEST 12: ********\n";
print "\nafsmonitor -config $configfilename -output $outputfilename\n\n";
($fsinfo, $cminfo) = afsmonitor(config => $configfilename,
output => $outputfilename
);
parse_results($fsinfo, $cminfo);
}
if ($all || $tests[13]) {
print "\n******** TEST 13: ********\n";
($fsinfo, $cminfo) =
afsmonitor(
cmhosts => \@cmhosts,
fshosts => \@fshosts,
# show statments
cmshow => ["PerfStats_section", "fs_oc_downDst_more_50"],
fsshow => ["VnodeCache_group", "FetchData_sqr"],
# thresholds
fsthresh => [
{ vcache_S_Entries => 1 },
{ vcache_L_Allocs => 1 },
{ host => "andrew.e.kth.se",
vcache_L_Entries => 1,
handler => "scripts/HandlerScript"
},
{ host => "www.openafs.org",
vcache_L_Writes => -1,
handler => "scripts/HandlerScript"
},
{ host => "virtue.openafs.org",
vcache_L_Writes => 2,
handler => "scripts/HandlerScript"
}
],
cmthresh => [
{ host => "www.openafs.org",
numPerfCalls => 1,
handler => "scripts/HandlerScript"
},
{ fs_oc_downDst_more_50 => 0 },
{ cacheNumEntries => 1,
handler => "scripts/HandlerScript"
},
{ host => "virtue.openafs.org",
dlocalAccesses => 1
}
],
);
parse_results($fsinfo, $cminfo);
}
sub parse_results {
if ($AFS::CODE) {
print "Error case: ", ref($fsinfo), "\n" if (defined($fsinfo));
print "Error case: ", ref($cminfo), "\n" if (defined($cminfo));
# die("Error: AFS::CODE = $AFS::CODE (", ($AFS::CODE+0), ")\n");
print "Error: AFS::CODE = $AFS::CODE (", ($AFS::CODE+0), ")\n";
return;
}
if ($showdump) {
local $Data::Dumper::Indent = 1;
local $Data::Dumper::Quotekeys = 0;
local $Data::Dumper::Maxdepth = 2;
local $Data::Dumper::Varname = "File Servers ";
print Dumper($fsinfo);
local $Data::Dumper::Varname = "Cache Managers ";
print Dumper($cminfo);
}
if ($readable) {
print "\nFile Servers:\n";
foreach my $host (@$fsinfo) {
print "\nFS HOSTNAME: $host->{hostName}\n";
if ($host->{probeOK}) {
print " probe successful\n";
foreach my $section (sort keys %$host) {
if (ref $host->{$section}) {
print "\n $section:\n";
foreach my $group (sort keys %{$host->{$section}}) {
print "\n $group\n";
foreach my $item (sort keys %{$host->{$section}->{$group}}) {
print " $item";
for (my $i = 0; $i <= 30 - length($item); $i++) {
print " ";
}
print "$host->{$section}->{$group}->{$item}->{value}";
if ($host->{$section}->{$group}->{$item}->{overflow}) {
print " (overflow)\n";
print " threshold: $host->{$section}->{$group}->{$item}->{threshold}\n";
if ($host->{$section}->{$group}->{$item}->{overflow} ne 1) {
print "\n";
system($host->{$section}->{$group}->{$item}->{overflow});
}
}
print "\n";
}
}
}
}
}
else {
print "\n probe failed";
}
print "\n";
}
print "\nCache Managers:\n";
foreach my $host (@$cminfo) {
print "\nCM HOSTNAME: $host->{hostName}\n";
if ($host->{probeOK}) {
print " probe successful\n";
foreach my $section (sort keys %$host) {
if (ref $host->{$section}) {
print "\n $section:\n";
foreach my $group (sort keys %{$host->{$section}}) {
print "\n $group\n";
foreach my $item (sort keys %{$host->{$section}->{$group}}) {
print " $item";
for (my $i = 0; $i <= 30 - length($item); $i++) {
print " ";
}
print "$host->{$section}->{$group}->{$item}->{value}";
if ($host->{$section}->{$group}->{$item}->{overflow}) {
print " (overflow)\n";
print " threshold: $host->{$section}->{$group}->{$item}->{threshold}\n";
if ($host->{$section}->{$group}->{$item}->{overflow} ne 1) {
print "\n";
system($host->{$section}->{$group}->{$item}->{overflow});
}
}
print "\n";
}
}
}
}
}
else {
print "\n probe failed";
}
print "\n";
}
}
if ($shortoutput) {
print "\nFile Servers:\n";
foreach my $host (@$fsinfo) {
print "\nHOST: $host->{hostName}";
if ($host->{probeOK}) {
foreach my $section (sort keys %$host) {
if (ref $host->{$section}) {
print "\n******* $section *******";
foreach my $group (sort keys %{$host->{$section}}) {
print "\n [[$group]] ";
foreach my $item (sort keys %{$host->{$section}->{$group}}) {
print "$item $host->{$section}->{$group}->{$item}->{value}";
if ($host->{$section}->{$group}->{$item}->{overflow}) {
print " (";
print "thresh: $host->{$section}->{$group}->{$item}->{threshold}";
if ($host->{$section}->{$group}->{$item}->{overflow} ne 1) {
print ", handler";
}
print ")";
}
print " | ";
}
}
}
}
}
else {
print "probe failed\n";
}
print "\n";
}
print "\nCache Managers:\n";
foreach my $host (@$cminfo) {
print "\nHOST: $host->{hostName}";
if ($host->{probeOK}) {
foreach my $section (sort keys %$host) {
if (ref $host->{$section}) {
print "\n******* $section *******";
foreach my $group (sort keys %{$host->{$section}}) {
print "\n [[$group]] ";
foreach my $item (sort keys %{$host->{$section}->{$group}}) {
print "$item $host->{$section}->{$group}->{$item}->{value}";
if ($host->{$section}->{$group}->{$item}->{overflow}) {
print " (";
print "thresh: $host->{$section}->{$group}->{$item}->{threshold}";
if ($host->{$section}->{$group}->{$item}->{overflow} ne 1) {
print ", handler";
}
print ")";
}
print " | ";
}
}
}
}
}
else {
print "probe failed\n";
}
print "\n";
}
}
}
print "\n# ...Done #\n";
( run in 0.513 second using v1.01-cache-2.11-cpan-39bf76dae61 )