AFS-Monitor
view release on metacpan or search on metacpan
examples/afsmonitor view on Meta::CPAN
#!/usr/bin/perl -w
#
# Copyright © 2004 Alf Wachsmann <alfw@slac.stanford.edu> and
# Elizabeth Cassell <e_a_c@mailsnare.net>
#
# $Revision: 1.14 $ $Date: 2004/10/22 15:04:40 $ $Author: alfw $
#
use blib;
use strict;
use AFS::Monitor;
use Data::Dumper;
my @cmhosts = ("www.openafs.org", "virtue.openafs.org", "andrew.e.kth.se"); # cache manager machines to monitor
my @fshosts = ("www.openafs.org", "virtue.openafs.org", "andrew.e.kth.se"); # file server machines to monitor
my $configfilename = 'configs/configfile';
my $badconfigfile = 'configs/badconfig';
my $outputfilename = 'debug_out/outputfile';
my @tests; # choose which tests to run
$tests[1] = 1; # test of FS afsmonitor with detailed output file
$tests[2] = 2; # test of CM afsmonitor
$tests[3] = 0; # test of invalid file name
$tests[4] = 0; # test of detailed flag without output flag
$tests[5] = 0; # test of invalid FS host
$tests[6] = 0; # test of invalid CM host
$tests[7] = 0; # test of no flags
$tests[8] = 0; # test of cmhosts and fshosts and config flags all at once
$tests[9] = 0; # test of cmhosts and fshosts
$tests[10] = 0; # test of config file
$tests[11] = 0; # test of invalid config file
$tests[12] = 0; # test of config file with output file
$tests[13] = 0; # test of show and threshold parameters
my $all = 1; # show all tests
my $showdump = 0; # print entire contents of hash for each test
my $readable = 1; # print readable formatted output (and execute
# threshold handler functions if they exist)
my $shortoutput = 0; # print shorter, harder to read output (don't
# execute handlers)
# available options:
#
# afsmonitor(
# cmhosts => \@cmhosts,
# fshosts => \@fshosts,
# config => $configfilename,
# detailed => 1,
# output => $outputfilename,
# );
#
# You must give cmhosts and/or fshosts, or a config file which specifies
# the cm and fs hosts.
print "# Starting now... #\n";
my ($fsinfo, $cminfo);
if ($all || $tests[1]) {
print "\n******** TEST 1a: ********\n";
print "\nafsmonitor -fshosts ", $fshosts[0], "\n\n";
($fsinfo, $cminfo) = afsmonitor(fshosts => $fshosts[0]);
parse_results($fsinfo, $cminfo);
print "\n******** TEST 1b: ********\n";
print "\nafsmonitor -fshosts ", join(" ", @fshosts),
" -output $outputfilename -detailed\n\n";
($fsinfo, $cminfo) = afsmonitor(detailed => 1,
fshosts => \@fshosts,
output => $outputfilename
);
parse_results($fsinfo, $cminfo);
}
if ($all || $tests[2]) {
print "\n******** TEST 2a: ********\n";
print "\nafsmonitor -cmhosts ", $cmhosts[0], "\n\n";
($fsinfo, $cminfo) = afsmonitor(cmhosts => $cmhosts[0]);
parse_results($fsinfo, $cminfo);
( run in 0.609 second using v1.01-cache-2.11-cpan-cdf2f3d4e48 )