AFS-Monitor
view release on metacpan or search on metacpan
Makefile.PL view on Meta::CPAN
system("cp ./pod/xstat_fs_test.pod lib/AFS/Monitor/xstat_fs_test.pod");
WriteMakefile(
'NAME' => 'AFS::Monitor',
'VERSION' => $VERSION,
($] >= 5.005 ?
('AUTHOR' => 'Alf Wachsmann, Elizabeth Cassell, and Steven Jenkins',
'ABSTRACT' => 'Perl interface to AFS monitoring and debugging APIs'
) : () ),
'realclean' => {FILES => 'Makefile.bak pod/*.html pod/pod2htm* lib/AFS/*.pod lib/AFS/Monitor/*.pod examples/debug_out/debug examples/debug_out/outputfile lib'},
);
sub MY::postamble {
'
html: Makefile
cd pod && $(MAKE) html
pod: blib
cp pod/Monitor.pod lib/AFS/Monitor.pod
examples/afsmonitor view on Meta::CPAN
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
examples/afsmonitor view on Meta::CPAN
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]);
examples/afsmonitor view on Meta::CPAN
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(
pod/Makefile view on Meta::CPAN
xstat_cm_test.html \
xstat_fs_test.html
html: $(P2H) $(HTML)
.SUFFIXES: .pm .pod
.SUFFIXES: .html
.pod.html:
$(POD2HTML) --infile=$*.pod --outfile=$*.html
clean:
rm -f $(HTML)
rm -f pod2html-*cache
rm -f pod2htmi.x* pod2htmd.x*
realclean: clean
rm -f $(CONVERTERS)
distclean: realclean
pod/afsmonitor.pod view on Meta::CPAN
($fs, $cm) = afsmonitor(cmhosts => "hostName1");
($fs, $cm) = afsmonitor(
cmhosts => ["hostName1", "hostName2"],
fshosts => ["hostName3", "hostName4"],
);
($fs, $cm) = afsmonitor(
config => "configfilename",
output => "outputfilename",
detailed => 1,
);
foreach $host (@$fs) {
print "FS Host: $host->{hostName}\n";
if($host->{probeOK}) {
print "probe successful\n";
}
else {
print "probe failed\n";
src/Monitor.xs view on Meta::CPAN
my_Print_fs_DetailedPerfInfo(&(fullPerfP->det), fs_outFD);
}
/*
* from src/afsmonitor/afsmon-output.c
* ("$Header: /afs/slac/g/scs/slur/Repository/AFSDebug/Debug/src/Monitor.xs,v 1.2 2006/07/05 22:25:10 alfw Exp $");
*/
void
my_afsmon_fsOutput(a_outfile, a_detOutput, xstat_fs_Results)
char *a_outfile; /* ptr to output file name */
int a_detOutput; /* detailed output ? */
struct xstat_fs_ProbeResults xstat_fs_Results;
{
char *printTime = 0; /* ptr to time string */
char *hostname = 0; /* fileserner name */
afs_int32 numLongs = 0; /* longwords in result */
afs_int32 *currLong = 0; /* ptr to longwords in result */
int i = 0;
FILE *fs_outFD = 0;
fs_outFD = fopen(a_outfile, "a");
if (fs_outFD == (FILE *) NULL) {
warn("failed to open output file %s", a_outfile);
return;
}
/* get the probe time and strip the \n at the end */
printTime = ctime((time_t *) & (xstat_fs_Results.probeTime));
printTime[strlen(printTime) - 1] = '\0';
hostname = xstat_fs_Results.connP->hostName;
/* print "time hostname FS" */
fprintf(fs_outFD, "\n%s %s FS ", printTime, hostname);
src/Monitor.xs view on Meta::CPAN
*/
int
my_afsmon_FS_Handler(xstat_fs_Results, numFS, conn_idx, buffer, argp)
struct xstat_fs_ProbeResults xstat_fs_Results;
int numFS;
int conn_idx;
char *buffer;
va_list argp;
{
char *outputfile = va_arg(argp, char *);
int detailed = va_arg(argp, int);
AV *FILESERV = va_arg(argp, AV *);
struct afsmon_hostEntry *FSnameList =
va_arg(argp, struct afsmon_hostEntry *);
short *fs_showFlags = va_arg(argp, short *);
int fs_showDefault = va_arg(argp, int);
HV *HOSTINFO = newHV();
int code = 0;
if (outputfile)
my_afsmon_fsOutput(outputfile, detailed, xstat_fs_Results);
/* add everything to data structure */
code =
my_save_FS_data_forDisplay(&xstat_fs_Results, HOSTINFO, numFS,
FSnameList, fs_showFlags, fs_showDefault,
buffer);
if (code) {
return (code);
}
src/Monitor.xs view on Meta::CPAN
* authorP = &(fullP->author); */
} /* my_Print_cm_FullPerfInfo() */
/*
* from src/afsmonitor/afsmon-output.c
* ("$Header: /afs/slac/g/scs/slur/Repository/AFSDebug/Debug/src/Monitor.xs,v 1.2 2006/07/05 22:25:10 alfw Exp $");
*/
void
my_afsmon_cmOutput(a_outfile, a_detOutput, xstat_cm_Results)
char *a_outfile; /* ptr to output file name */
int a_detOutput; /* detailed output ? */
struct xstat_cm_ProbeResults xstat_cm_Results;
{
char *printTime = 0; /* ptr to time string */
char *hostname = 0; /* fileserner name */
afs_int32 numLongs = 0; /* longwords in result */
afs_int32 *currLong = 0; /* ptr to longwords in result */
int i = 0;
FILE *cm_outFD = 0;
cm_outFD = fopen(a_outfile, "a");
if (cm_outFD == (FILE *) NULL) {
warn("failed to open output file %s", a_outfile);
return;
}
/* get the probe time and strip the \n at the end */
printTime = ctime((time_t *) & (xstat_cm_Results.probeTime));
printTime[strlen(printTime) - 1] = '\0';
hostname = xstat_cm_Results.connP->hostName;
/* print "time hostname CM" prefix */
fprintf(cm_outFD, "\n%s %s CM ", printTime, hostname);
src/Monitor.xs view on Meta::CPAN
int
my_afsmon_CM_Handler(xstat_cm_Results, numCM, conn_idx, buffer, argp)
struct xstat_cm_ProbeResults xstat_cm_Results;
int numCM;
int conn_idx;
char *buffer;
va_list argp;
{
int code = 0;
char *outputfile = va_arg(argp, char *);
int detailed = va_arg(argp, int);
AV *CACHEMAN = va_arg(argp, AV *);
struct afsmon_hostEntry *CMnameList =
va_arg(argp, struct afsmon_hostEntry *);
short *cm_showFlags = va_arg(argp, short *);
int cm_showDefault = va_arg(argp, int);
HV *HOSTINFO = newHV();
if (outputfile) {
my_afsmon_cmOutput(outputfile, detailed, xstat_cm_Results);
}
/* add everything to data structure */
code =
my_save_CM_data_forDisplay(&xstat_cm_Results, HOSTINFO, numCM,
CMnameList, cm_showFlags, cm_showDefault,
buffer);
if (code) {
return (code);
}
( run in 0.809 second using v1.01-cache-2.11-cpan-4d50c553e7e )