AFS-Monitor

 view release on metacpan or  search on metacpan

CHANGES  view on Meta::CPAN

 * changed permissions from 755 to 0755 in Makefile.PL
 * ExtUtils::MakeMaker's PERL_MM_USE_DEFAULT environment variable is now obeyed
 * fixed a problem to make it compile on 32 bit RHEL4
 All fixes were submitted by Wolfgang Friebel <Wolfgang.Friebel at desy.de> - Thanks!


Version 0.3.0 (released April 27, 2006)

 * made everything work with OpenAFS-1.4.1
 * cmdebug: PrintCacheEntries() now contains the strings and not the number of the file types
 * added new CallBack statistics from OpenAFS-1.4.1 file servers to xstat_fs_test()
 * added example for CallBack statistics to examples/xstat_fs_test
 * added new statistics "rx_nBusies", "fs_nBusies", "fs_GetCapabilities" to xstat_fs_test()
 * changed call by value to call by reference in a number of functions which reduces the
   memory usage
 * some general code cleanup


Version 0.2.2 (released January 17, 2005)

 * Added a README file as preparation for CPAN


LICENSES/Artistic  view on Meta::CPAN

fall under the restrictions of Paragraphs 3 and 4, provided that you do
not represent such an executable image as a Standard Version of this
Package.

7. C subroutines (or comparably compiled subroutines in other
languages) supplied by you and linked into this Package in order to
emulate subroutines and variables of the language defined by this
Package shall not be considered part of this Package, but are the
equivalent of input as in Paragraph 6, provided these subroutines do
not change the language in any way that would cause it to fail the
regression tests for the language.

8. Aggregation of this Package with a commercial distribution is always
permitted provided that the use of this Package is embedded; that is,
when no overt attempt is made to make this Package's interfaces visible
to the end user of the commercial distribution.  Such use shall not be
construed as a distribution of this Package.

9. The name of the Copyright Holder may not be used to endorse or promote
products derived from this software without specific prior written permission.

LICENSES/COPYING  view on Meta::CPAN

These requirements apply to the modified work as a whole.  If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works.  But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.

Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.

In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.

  3. You may copy and distribute the Program (or a work based on it,

LICENSES/COPYING  view on Meta::CPAN

all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.

If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.

It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices.  Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.

This section is intended to make thoroughly clear what is believed to

LICENSES/COPYING  view on Meta::CPAN

OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.

		     END OF TERMS AND CONDITIONS

	Appendix: How to Apply These Terms to Your New Programs

  If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.

  To do so, attach the following notices to the program.  It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.

    <one line to give the program's name and a brief idea of what it does.>
    Copyright (C) 19yy  <name of author>

MANIFEST  view on Meta::CPAN

Makefile.PL
examples/configs/configfile
examples/configs/badconfig
examples/Meltdown.pl
examples/scripts/HandlerScript
examples/udebug
examples/afsmonitor
examples/scout
examples/cmdebug
examples/rxdebug
examples/xstat_cm_test
examples/xstat_fs_test
pod/Makefile
pod/cmdebug.pod
pod/rxdebug.pod
pod/scout.pod
pod/afsmonitor.pod
pod/udebug.pod
pod/xstat_cm_test.pod
pod/xstat_fs_test.pod
pod/afsmon_stats.pod
pod/Monitor.pod
src/Monitor.xs
src/Makefile.PL
src/ppport.h
src/t/Monitor.t
src/afsmon-labels.h
src/Monitor.pm
src/typemap

Makefile.PL  view on Meta::CPAN

mkdir('./lib', 0755);
mkdir('./lib/AFS', 0755);
mkdir('./lib/AFS/Monitor', 0755);
system("cp ./pod/Monitor.pod       lib/AFS/Monitor.pod");
system("cp ./pod/afsmon_stats.pod  lib/AFS/Monitor/afsmon_stats.pod");
system("cp ./pod/afsmonitor.pod    lib/AFS/Monitor/afsmonitor.pod");
system("cp ./pod/cmdebug.pod       lib/AFS/Monitor/cmdebug.pod");
system("cp ./pod/rxdebug.pod       lib/AFS/Monitor/rxdebug.pod");
system("cp ./pod/scout.pod         lib/AFS/Monitor/scout.pod");
system("cp ./pod/udebug.pod        lib/AFS/Monitor/udebug.pod");
system("cp ./pod/xstat_cm_test.pod lib/AFS/Monitor/xstat_cm_test.pod");
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'},

Makefile.PL  view on Meta::CPAN

	cd pod && $(MAKE) html

pod: blib
	cp pod/Monitor.pod       lib/AFS/Monitor.pod
	cp pod/afsmon_stats.pod  lib/AFS/Monitor/afsmon_stats.pod
	cp pod/afsmonitor.pod    lib/AFS/Monitor/afsmonitor.pod
	cp pod/cmdebug.pod       lib/AFS/Monitor/cmdebug.pod
	cp pod/rxdebug.pod       lib/AFS/Monitor/rxdebug.pod
	cp pod/scout.pod         lib/AFS/Monitor/scout.pod
	cp pod/udebug.pod        lib/AFS/Monitor/udebug.pod
	cp pod/xstat_cm_test.pod lib/AFS/Monitor/xstat_cm_test.pod
	cp pod/xstat_fs_test.pod lib/AFS/Monitor/xstat_fs_test.pod
';
}

README  view on Meta::CPAN

    The AFS::Monitor module is a dynamically loadable extension to
    Perl. It gives the AFS user and administrator access to most of the
    AFS monitoring and debugging functions, allowing you to make these calls
    directly from Perl, rather than processing the output of a command.


REQUIREMENTS
    Before you can build the AFS module you need to have the
    following installed on your system:

        * Perl 5.6.1 or newer (haven't tested on any older versions)
        * system libraries for OpenAFS 1.2.x and newer (it is unknown
	whether IBM AFS wil work)


COMPATIBILITY
    Please consult the 'pod/Monitor.pod' file for a complete list of AFS
    @sys variable, OS and compiler versions this Perl module is known to
    work with


AVAILABILITY
    The latest version of the AFS::Monitor module is currently available at

 http://github.com/stevenjenkins/AFS-Monitor as well as CPAN.


BUILDING & INSTALLING
    Assuming you have met all the prerequisites, building the module
    should be straightforward. The AFS::Monitor module is distributed as a
    single gzipped tar archive file:

            AFS-Monitor-0.3.3.tar.gz

    Unpack the archive to create an AFS-Monitor installation directory:

        tar zxvf AFS-Monitor-0.3.3.tar.gz

    'cd' into that directory, make, test and install the modules. You
    have to specify the location of the AFS system libraries. While
    running the 'perl Makefile.PL' step you will be prompted for the
    location of the AFS system libraries.  If you want to avoid that
    query, you should specify the environment variable 'AFSPATH'
    before you start[1].  If your AFS system type is not yet known by
    the make file, please follow the printed message.

    This is the sequence of commands to build the modules:

        cd AFS-Monitor-0.3.2

        [1] this step is optional
        setenv AFSPATH 'path_to_the_AFS_system_libraries' # tcsh-shell
        export AFSPATH='path_to_the_AFS_system_libraries' # sh-shell

        perl Makefile.PL
             ---->  Which AFS system libraries should be used? [/usr/afsws]
        make
        make test
        make install


DOCUMENTATION
    POD-format documentation can be found in the directory 'pod'.
    The POD documentation gets automatically installed to the system wide
    Perl documentation. It is readable with the 'perldoc' utility.

    To create a HTML version of the documentation, execute

 cd pod
 make html


EXAMPLES
    The 'examples' directory contains example how to use the
    AFS::Monitor module. The scripts contain almost all ways how to call
    the different functions. We have used these scripts as regression tests
    during development. They should ive you enough ideas how to use the
    different functions.


BUGS
    Please send all bug reports and suggestions for improvements to
    Steven Jenkins <steven.jenkins@gmail.com>. When reporting
    bugs/problems please include information about operating system
    version, perl version, AFS version, AFS::Monitor module version.
    Comments, suggestions and patches are always welcome.

examples/afsmonitor  view on Meta::CPAN

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,

examples/afsmonitor  view on Meta::CPAN

#            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);

  print "\n******** TEST 2b: ********\n";

  print "\nafsmonitor -cmhosts ", join(" ", @cmhosts), "\n\n";

  ($fsinfo, $cminfo) = afsmonitor(cmhosts => \@cmhosts);

  parse_results($fsinfo, $cminfo);
}

if ($all || $tests[3]) {
  print "\n******** TEST 3: ********\n";

  print "\nafsmonitor -cmhosts ", join(" ", @cmhosts), " -output /\n\n";

  ($fsinfo, $cminfo) = afsmonitor(cmhosts => \@cmhosts,
                                  output  => '/'
                                 );

  parse_results($fsinfo, $cminfo);
}

if ($all || $tests[4]) {
  print "\n******** TEST 4: ********\n";

  print "\nafsmonitor -cmhosts ", join(" ", @cmhosts), " -detailed\n\n";

  ($fsinfo, $cminfo) = afsmonitor(cmhosts  => \@cmhosts,
                                  detailed => 1
                                 );

  parse_results($fsinfo, $cminfo);
}

if ($all || $tests[5]) {
  print "\n******** TEST 5: ********\n";

  print "\nafsmonitor -fshosts \"something that won't work\"\n\n";

  ($fsinfo, $cminfo) = afsmonitor(fshosts => [ "something that won't work" ]);

  parse_results($fsinfo, $cminfo);
}

if ($all || $tests[6]) {
  print "\n******** TEST 6: ********\n";

  print "\nafsmonitor -cmhosts notreal fake\n\n";

  ($fsinfo, $cminfo) = afsmonitor(cmhosts => [ 'notreal', 'fake' ]);

  parse_results($fsinfo, $cminfo);
}

if ($all || $tests[7]) {
  print "\n******** TEST 7: ********\n";

  print "\nafsmonitor\n\n";

  ($fsinfo, $cminfo) = afsmonitor();

  parse_results($fsinfo, $cminfo);
}

if ($all || $tests[8]) {
  print "\n******** TEST 8: ********\n";

  print "\nafsmonitor -cmhosts ", join(" ", @cmhosts),
                    " -fshosts ", join(" ", @fshosts),
                    " -config $configfilename\n\n";

 ($fsinfo, $cminfo) = afsmonitor(cmhosts => \@cmhosts,
                                 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

examples/cmdebug  view on Meta::CPAN


use blib;
use strict;
use AFS::Monitor qw(cmdebug constant);
use Data::Dumper;

#my $server = "virtue.openafs.org";
my $server = "afs04.slac.stanford.edu";
my $port   = 7001;

my @tests;      # choose which tests to run
$tests[1] = 1;  # test of server $server, port $port, long output
$tests[2] = 0;  # test of server $server, no port
$tests[3] = 0;  # test of nonexistant server
$tests[4] = 0;  # test of server $server, bad port
$tests[5] = 0;  # test of server $server, port $port

my $all = 0;

my $showdump = 1;   # print entire contents of hash for each test
my $formatted = 1;  # print output formatted like the c cmdebug program

print "# Starting now... #\n";
my $locks;
my $cache_entries;

if ($all || $tests[1]) {
  print "\n******** TEST 1: ********\n";

  print "\ncmdebug -server $server -port $port -long\n\n";

  ($locks, $cache_entries) = cmdebug(server => $server,
                                     port   => $port,
                                     long   => 1
                                    );
  parse_result($locks, $cache_entries);
}

if ($all || $tests[2]) {
  print "\n******** TEST 2: ********\n";

  print "\ncmdebug -server $server\n\n";

  ($locks, $cache_entries) = cmdebug(server => $server);
  parse_result($locks, $cache_entries);
}

if ($all || $tests[3]) {
  print "\n******** TEST 3: ********\n";

  print "\ncmdebug -server nonexistant\n\n";

  ($locks, $cache_entries) = cmdebug(server => "nonexistant");
  parse_result($locks, $cache_entries);
}

if ($all || $tests[4]) {
  print "\n******** TEST 4: ********\n";

  print "\ncmdebug -server $server -port 7001\n\n";

  ($locks, $cache_entries) = cmdebug(server => $server,
                                     port   => 7001
                                    );
  parse_result($locks, $cache_entries);
}

if ($all || $tests[5]) {
  print "\n******** TEST 5: ********\n";

  print "\ncmdebug -server $server -port $port\n\n";

  ($locks, $cache_entries) = cmdebug(server => $server,
                                     port   => $port
                                    );
  parse_result($locks, $cache_entries);
}

examples/rxdebug  view on Meta::CPAN

# $Revision: 1.9 $ $Date: 2004/10/22 15:04:40 $ $Author: alfw $
#

use blib;
use strict;
use AFS::Monitor qw(rxdebug constant);
use Data::Dumper;

my $servers  = 'virtue.openafs.org'; # machine to run this on
my $port     = 7001;      # port to run this on
my $onlyhost = 'andrew.e.kth.se';  # some of the tests will show only connections from this host
my $onlyport = 7000;      # some of the tests will show only connections on this port
my $onlyauth = 'auth';    # some of the tests will show only connections with this auth level

my @tests;      # choose which tests to run
$tests[1] = 1;  # prints version
$tests[2] = 0;  # prints all peers and all non-dallying connections.
                # (can be long)
$tests[3] = 0;  # nonexistant host
$tests[4] = 0;  # nonexistant port
$tests[5] = 0;  # bad port; getstats fails. (can be slow)
$tests[6] = 0;  # prints long version of all peers. (can be long)
$tests[7] = 0;  # server $servers port $port. prints default info.
$tests[8] = 0;  # prints rxstats, no connections.
$tests[9] = 0;  # prints only auth $onlyauth
$tests[10] = 0; # shows all connections. (can be long)
$tests[11] = 0; # shows all server connections. (can be long)
$tests[12] = 0; # shows all client connections on port $port from host $onlyhost
$tests[13] = 0; # doesn't give port, tries default (7000).
$tests[14] = 0; # no arguments, runs on current machine with default port.
$tests[15] = 0; # port $port, runs on current machine.
$tests[16] = 0; # prints rxstats, all connections, long version of all peers.
                # (can be very long)

my $all = 1;    # show all tests

my $showdump = 0; # dump contents of hash to the screen for each test instead of printing rxdebug formatted output

# all available options:
# rxdebug(nodally        => 1,
#         allconnections => 1,
#         rxstats        => 1,
#         onlyserver     => 1,
#         onlyclient     => 1,
#         onlyport       => $onlyport,
#         version        => 1,
#         noconns        => 1,

examples/rxdebug  view on Meta::CPAN

#         long           => 1,
#         servers        => $servers, # required
#         port           => $port,
#         onlyhost       => $onlyhost,
#         onlyauth       => $onlyauth,
#        );

print "***** Starting now... *****\n";
my $rxdeb;

if ($all || $tests[1]) {
  print "\n******** TEST 1: ********\n";

  print "\nrxdebug -version -servers $servers -port $port\n\n";

  $rxdeb = rxdebug(version => 1,
                   servers => $servers, # required
                   port    => $port
                  );
  parse_results($rxdeb);
}

if ($all || $tests[2]) {
  print "\n******** TEST 2: ********\n";

  print "\nrxdebug -nodally -allconnections -peers -servers $servers -port $port\n\n";

  $rxdeb = rxdebug(nodally        => 1,
                   allconnections => 1,
                   peers          => 1,
                   servers        => $servers,
                   port           => $port
                  );
  parse_results($rxdeb);
}

if ($all || $tests[3]) {
  print "\n******** TEST 3: ********\n";

  print "\nrxdebug -servers speedy1 -port $port\n\n";

  $rxdeb = rxdebug(servers => 'speedy1',
                   port    => $port
                  );
  parse_results($rxdeb);
}

if ($all || $tests[4]) {
  print "\n******** TEST 4 ********\n";

  print "\nrxdebug -servers $servers -port no\n\n";

  $rxdeb = rxdebug(servers => $servers,
                   port    => 'no'
                  );
  parse_results($rxdeb);
}

if ($all || $tests[5]) {
  print "\n******** TEST 5 ********\n";

  print "\nrxdebug -servers $servers -port 643543\n(may take a while..)\n\n";

  $rxdeb = rxdebug(servers => $servers,
                   port    => 643543
                  );
  parse_results($rxdeb);
}

if ($all || $tests[6]) {
  print "\n******** TEST 6 ********\n";

  print "\nrxdebug -servers $servers -port $port -noconns -peers -long\n\n";

  $rxdeb = rxdebug(servers => $servers,
                   port    => $port,
                   noconns => 1,
                   peers   => 1,
                   long    => 1
                  );
  parse_results($rxdeb);
}

if ($all || $tests[7]) {
  print "\n******** TEST 7 ********\n";

  print "\nrxdebug -servers $servers -port $port\n\n";

  $rxdeb = rxdebug(servers => $servers,
                   port    => $port
                  );
  parse_results($rxdeb);
}

if ($all || $tests[8]) {
  print "\n******** TEST 8 ********\n";

  print "\nrxdebug -noconns -servers $servers -port $port -rxstats\n\n";

  $rxdeb = rxdebug(noconns => 1,
                   servers => $servers,
                   port    => $port,
                   rxstats => 1
                  );
  parse_results($rxdeb);
}

if ($all || $tests[9]) {
  print "\n******** TEST 9 ********\n";

  print "\nrxdebug -servers $servers -port $port -onlyauth $onlyauth\n\n";

  $rxdeb = rxdebug(servers  => $servers,
                   port     => $port,
                   onlyauth => $onlyauth
                  );
  parse_results($rxdeb);
}

if ($all || $tests[10]) {
  print "\n******** TEST 10 ********\n";

  print "\nrxdebug -servers $servers -port $port -allconnections\n\n";

  $rxdeb = rxdebug(servers        => $servers,
                   port           => $port,
                   allconnections => 1
                  );
  parse_results($rxdeb);
}

if ($all || $tests[11]) {
  print "\n******** TEST 11 ********\n";

  print "\nrxdebug -servers $servers -port $port -allconnections -onlyserver\n\n";

  $rxdeb = rxdebug(allconnections => 1,
                   onlyserver     => 1,
                   servers        => $servers,
                   port           => $port
                  );
  parse_results($rxdeb);
}

if ($all || $tests[12]) {
  print "\n******** TEST 12 ********\n";

  print "\nrxdebug -servers $servers -port $port -allconnections -onlyclient -onlyport $onlyport -onlyhost $onlyhost\n\n";

  $rxdeb = rxdebug(allconnections => 1,
                   onlyclient     => 1,
                   onlyport       => $onlyport,
                   servers        => $servers,
                   port           => $port,
                   onlyhost       => $onlyhost
                  );
  parse_results ($rxdeb);
}

if ($all || $tests[13]) {
  print "\n******** TEST 13 ********\n";

  print "\nrxdebug -servers $servers\n\n";

  $rxdeb = rxdebug(servers => $servers);
  parse_results ($rxdeb);
}

if ($all || $tests[14]) {
  print "\n******** TEST 14 ********\n";

  print "\nrxdebug 0\n\n";

  $rxdeb = rxdebug();
  parse_results ($rxdeb);
}

if ($all || $tests[15]) {
  print "\n******** TEST 15 ********\n";

  print "\nrxdebug 0 -port $port\n\n";

  $rxdeb = rxdebug(port => $port);
  parse_results ($rxdeb);
}

if ($all || $tests[16]) {
  print "\n******** TEST 16 ********\n";

  print "\nrxdebug -servers $servers -port $port -allconnections -peers -long -rxstats\n\n";

  $rxdeb = rxdebug(allconnections => 1,
                   rxstats        => 1,
                   peers          => 1,
                   long           => 1,
                   servers        => $servers,
                   port           => $port

examples/scout  view on Meta::CPAN


use blib;
use strict;
use AFS::Monitor;
use Data::Dumper;

my @servers   = ("virtue");
my $debugfile = "debug_out/debug";
my $basename  = "openafs.org";

my @tests;      # choose which tests to run
$tests[1] = 1;  # blank
$tests[2] = 1;  # blank

my $all = 0;

my $showdump = 1;   # print entire contents of hash for each test
my $formatted = 0;  # print formatted, easy to read output
my $scout = 1;      # print only the information displayed by the original (c) scout program

print "# Starting now... #\n";
my $result;


if ($all || $tests[1]) {
  print "\n******** TEST 1: ********\n";

  print "\nscout -server ", join(" ", @servers),
        " -debug $debugfile -basename $basename\n\n";

  $result = scout(server   => \@servers,
                  debug    => $debugfile,
                  basename => $basename);
  parse_result($result);
}


if ($all || $tests[2]) {
  print "\n******** TEST 2: ********\n";

  print "\nscout -server virtue.openafs.org\n\n";

  $result = scout(server   => "virtue.openafs.org");
  parse_result($result);
}


sub parse_result {

examples/udebug  view on Meta::CPAN


use blib;
use strict;
use AFS::Monitor qw(udebug constant);
use Data::Dumper;

my $server          = "virtue.openafs.org";
my $non_sync_server = "andrew.e.kth.se";
my $port            = 7003;

my @tests;      # choose which tests to run
$tests[1] = 0;  # test of server $server, port $port, long output
$tests[2] = 0;  # test of server $non_sync_server, port $port, short output
$tests[3] = 0;  # test of server $non_sync_server, port $port, long output
$tests[4] = 0;  # test of server $server, no port
$tests[5] = 1;  # test of nonexistant server
$tests[6] = 1;  # test of server $server, bad port
$tests[7] = 0;  # test of server $server, port $port

my $all = 0;

my $showdump = 0;   # print entire contents of hash for each test
my $formatted = 1;  # print output formatted like the C udebug program


print "# Starting now... #\n";
my $result;

if ($all || $tests[1]) {
  print "\n******** TEST 1: ********\n";

  print "\nudebug -server $server -port $port -long\n\n";

  $result = udebug(server => $server,
                   port   => $port
                  );
  parse_result($result);
}

if ($all || $tests[2]) {
  print "\n******** TEST 2: ********\n";

  print "\nudebug -server $non_sync_server -port $port\n\n";

  $result = udebug(server => $non_sync_server,
                   port   => $port
                  );
  parse_result($result);
}

if ($all || $tests[3]) {
  print "\n******** TEST 3: ********\n";

  print "\nudebug -server $non_sync_server -port $port -long\n\n";

  $result = udebug(server => $non_sync_server,
                   port   => $port,
                   long   => 1
                  );
  parse_result($result);
}

if ($all || $tests[4]) {
  print "\n******** TEST 4: ********\n";

  print "\nudebug -server $server\n\n";

  $result =udebug(server => $server);
  parse_result($result);
}

if ($all || $tests[5]) {
  print "\n******** TEST 5: ********\n";

  print "\nudebug -server nonexistant\n\n";

  $result = udebug(server => "nonexistant");
  parse_result($result);
}

if ($all || $tests[6]) {
  print "\n******** TEST 6: ********\n";

  print "\nudebug -server $server -port 7001\n\n";

  $result = udebug(server => $server,
                   port   => 7001
                  );
  parse_result($result);
}

if ($all || $tests[7]) {
  print "\n******** TEST 7: ********\n";

  print "\nudebug -server $server -port $port\n\n";

  $result = udebug(server => $server,
                   port   => $port
                  );
  parse_result($result);
}

examples/xstat_cm_test  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.8 $ $Date: 2006/05/31 16:22:51 $ $Author: alfw $
#

use blib;
use strict;
use AFS::Monitor qw(xstat_cm_test constant);
use Data::Dumper;

my @cmname = ("virtue.openafs.org", "andrew.e.kth.se");
my @collID = (0, 1, 2);

my @tests;      # choose which tests to run
$tests[1] = 1;  # test of cmname @cmname and collIDs @collID
$tests[2] = 0;  # test of cmname but no collID
$tests[3] = 0;  # test of single cmname with collID
$tests[4] = 0;  # test of single cmname but no single collID

my $all = 1;

my $showdump = 0;   # print entire contents of hash for each test
my $formatted = 1;  # print formatted like original xstat_cm_test program

print "# Starting now... #\n";
my $result;


if ($all || $tests[1]) {
  print "\n******** TEST 1: ********\n";

  print "\nxstat_cm_test -cmname ", join(" ", @cmname),
        " -collID ", join(" ", @collID), "\n\n";

  $result = xstat_cm_test(cmname => \@cmname,
                          collID => \@collID);
  parse_result($result);
}

if ($all || $tests[2]) {
  print "\n******** TEST 2: ********\n";

  print "\nxstat_cm_test -cmname ", join(" ", @cmname), "\n\n";

  $result = xstat_cm_test(cmname => \@cmname);
  parse_result($result);
}


if ($all || $tests[3]) {
  print "\n******** TEST 3: ********\n";

  print "\nxstat_cm_test -cmname ", $cmname[0],
                       " -collID 2\n\n";

  $result = xstat_cm_test(cmname => $cmname[0],
                          collID => 2);
  parse_result($result);
}


if ($all || $tests[4]) {
  print "\n******** TEST 4: ********\n";

  print "\nxstat_cm_test -cmname ", $cmname[0], "\n\n";

  $result = xstat_cm_test(cmname => $cmname[0]);
  parse_result($result);
}



sub parse_result {
  my $info = shift;

  if ($AFS::CODE) {
    print "Error case: ", ref($info), "\n" if (defined($info));
    # 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::Quotekeys = 0;
    local $Data::Dumper::Sortkeys = 1;
    local $Data::Dumper::Indent = 1;
    local $Data::Dumper::Maxdepth = 2;
    local $Data::Dumper::Varname = "xstat_cm_test";
    print Dumper($info);
  }

  if ($formatted) {
    foreach my $host (@$info) {
      if ($host->{probeOK} == 0) {
        printf("CM_Handler: Probe 1, collection %d to CM on '%s' failed\n",
                $host->{collectionNumber},
                $host->{hostName});
        return;

examples/xstat_cm_test  view on Meta::CPAN

  printf "\t\t%10d numTtlRecords\n",	$updown->{numTtlRecords};
  printf "\t\t%10d numUpRecords\n",	$updown->{numUpRecords};
  printf "\t\t%10d numDownRecords\n",	$updown->{numDownRecords};
  printf "\t\t%10d sumOfRecordAges\n",$updown->{sumOfRecordAges};
  printf "\t\t%10d ageOfYoungestRecord\n",$updown->{ageOfYoungestRecord};
  printf "\t\t%10d ageOfOldestRecord\n",$updown->{ageOfOldestRecord};
  printf "\t\t%10d numDowntimeIncidents\n",$updown->{numDowntimeIncidents};
  printf "\t\t%10d numRecordsNeverDown\n",$updown->{numRecordsNeverDown};
  printf "\t\t%10d maxDowntimesInARecord\n",$updown->{maxDowntimesInARecord};
  printf "\t\t%10d sumOfDowntimes\n",	$updown->{sumOfDowntimes};
  printf "\t\t%10d shortestDowntime\n",$updown->{shortestDowntime};
  printf "\t\t%10d longestDowntime\n",$updown->{longestDowntime};

  printf "\t\tDowntime duration distribution:\n";
  printf "\t\t\t%8d: 0 min .. 10 min\n",  $updown->{downDurations}->[0];
  printf "\t\t\t%8d: 10 min .. 30 min\n", $updown->{downDurations}->[1];
  printf "\t\t\t%8d: 30 min .. 1 hr\n",   $updown->{downDurations}->[2];
  printf "\t\t\t%8d: 1 hr .. 2 hr\n",     $updown->{downDurations}->[3];
  printf "\t\t\t%8d: 2 hr .. 4 hr\n",     $updown->{downDurations}->[4];
  printf "\t\t\t%8d: 4 hr .. 8 hr\n",     $updown->{downDurations}->[5];
  printf "\t\t\t%8d: > 8 hr\n",           $updown->{downDurations}->[6];

examples/xstat_fs_test  view on Meta::CPAN

#
# Copyright © 2004-2006
#		Alf Wachsmann <alfw@slac.stanford.edu> and
#		Elizabeth Cassell <e_a_c@mailsnare.net>
#
# $Revision: 1.8 $ $Date: 2006/07/05 22:25:10 $ $Author: alfw $
#

use blib;
use strict;
use AFS::Monitor qw(xstat_fs_test constant);
use Data::Dumper;

#my @fsname = ("virtue.openafs.org", "andrew.e.kth.se");
my @fsname = ("afs101.slac.stanford.edu");
my @collID = (0, 1, 2, 3);

my @tests;      # choose which tests to run
$tests[1] = 0;  # test of fsname @fsname and collIDs @collID
$tests[2] = 0;  # test of fsname but no collID
$tests[3] = 1;  # test of single fsname with collID 0
$tests[4] = 1;  # test of single fsname with collID 1
$tests[5] = 0;  # test of single fsname with collID 2
$tests[6] = 1;  # test of single fsname with collID 3
$tests[7] = 0;  # test of single fsname but no single collID

my $all = 0;

my $showdump = 0;   # print entire contents of hash for each test
my $formatted = 1;  # print formatted like original xstat_fs_test program

print "# Starting now... #\n";
my $result;

if ($all || $tests[1]) {
  print "\n******** TEST 1: ********\n";

  print "\nxstat_fs_test -fsname ", join(" ", @fsname),
        " -collID ", join(" ", @collID), "\n\n";

  $result = xstat_fs_test(fsname => \@fsname,
                          collID => \@collID);
  parse_result($result);
}

if ($all || $tests[2]) {
  print "\n******** TEST 2: ********\n";

  print "\nxstat_fs_test -fsname ", join(" ", @fsname), "\n\n";

  $result = xstat_fs_test(fsname => \@fsname);
  parse_result($result);
}


if ($all || $tests[3]) {
  print "\n******** TEST 3: ********\n";

  print "\nxstat_fs_test -fsname ", $fsname[0],
                       " -collID 0\n\n";

  $result = xstat_fs_test(fsname => $fsname[0],
                          collID => 0);
  parse_result($result);
}

if ($all || $tests[4]) {
  print "\n******** TEST 4: ********\n";

  print "\nxstat_fs_test -fsname ", $fsname[0],
                       " -collID 1\n\n";

  $result = xstat_fs_test(fsname => $fsname[0],
                          collID => 1);
  parse_result($result);
}

if ($all || $tests[5]) {
  print "\n******** TEST 5: ********\n";

  print "\nxstat_fs_test -fsname ", $fsname[0],
                       " -collID 2\n\n";

  $result = xstat_fs_test(fsname => $fsname[0],
                          collID => 2);
  parse_result($result);
}


if ($all || $tests[6]) {
  print "\n******** TEST 6: ********\n";

  print "\nxstat_fs_test -fsname ", $fsname[0],
                       " -collID 3\n\n";

  $result = xstat_fs_test(fsname => $fsname[0],
                          collID => 3);
  parse_result($result);
}


if ($all || $tests[7]) {
  print "\n******** TEST 7: ********\n";

  print "\nxstat_fs_test -fsname ", $fsname[0], "\n\n";

  $result = xstat_fs_test(fsname => $fsname[0]);
  parse_result($result);
}


sub parse_result {
  my $info = shift;

  if ($AFS::CODE) {
    print "Error case: ", ref($info), "\n" if (defined($info));
    # 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::Quotekeys = 0;
    local $Data::Dumper::Sortkeys = 1;
    local $Data::Dumper::Indent = 1;
    local $Data::Dumper::Varname = "xstat_fs_test";
    local $Data::Dumper::Maxdepth = 2;
    print Dumper($info);
  }

  if ($formatted) {
    foreach my $host (@$info) {
      print "\n------------------------------------------------------------\n";
      if ($host->{probeOK} == 0) {
        printf "FS_Handler: Probe 1 to File Server '$host->{hostName}' failed\n",
      } elsif($host->{collectionNumber} == constant("AFS_XSTATSCOLL_CALL_INFO")) {

pod/Makefile  view on Meta::CPAN

CONVERTERS = pod2html

POD2HTML = $(P2H) \
	    --htmlroot=./ \
	    --podpath=./ \
	    --verbose \
	    --noindex \
	    --libpods=Monitor:afsmon_stats:afsmonitor:cmdebug:rxdebug:scout:udebug:xstat_cm_test:xstat_fs_test

all: $(CONVERTERS)

converters: $(CONVERTERS)

P2H = /usr/local/bin/pod2html

POD = \
	afsmon_stats.pod  \
	afsmonitor.pod    \
	Monitor.pod  \
	cmdebug.pod       \
	rxdebug.pod       \
	scout.pod         \
	udebug.pod        \
	xstat_cm_test.pod \
	xstat_fs_test.pod

HTML = \
	afsmon_stats.html  \
	afsmonitor.html    \
	Monitor.html  \
	cmdebug.html       \
	rxdebug.html       \
	scout.html         \
	udebug.html        \
	xstat_cm_test.html \
	xstat_fs_test.html

html:	$(P2H) $(HTML)

.SUFFIXES: .pm .pod

.SUFFIXES: .html

.pod.html:
	$(POD2HTML) --infile=$*.pod --outfile=$*.html

pod/Monitor.pod  view on Meta::CPAN

=item B<scout>

Gathers statistics from the File Server processes running on the specified
machines. See L<scout(1)>

=item B<udebug>

Reports the status of the Ubik process associated with a database server
process. See L<udebug(1)>

=item B<xstat_cm_test>

Gathers the specified data collections associated with the specified Cache
Manager. See L<xstat_cm_test(1)>

=item B<xstat_fs_test>

Gathers the specified data collections associated with the specified File
Server process. See L<xstat_fs_test(1)>

=back

=head1 COMPATIBILITY

The configurations that this package has been tested on are listed below:

  OS              @sys            Perl            	OpenAFS
  -----------------------------------------------------------------------------
  FC5             amd64_linux26   v5.8.8			1.4.2-beta1
  RHEL4-64        amd64_linux26   v5.8.5			1.4.1
  RHEL4-32        no machine
  RHEL3-32        i386linux24     v5.8.0, v5.8.8, v5.6.0	1.4.1, 1.2.10
  RHEL3-64        no machine
  SLES9           ia64_linux26    v5.8.3			1.4.1

pod/afsmon_stats.pod  view on Meta::CPAN

=item *

fs_sc_maxDowntimesInARecord: Maximum downtimes seen by any fileserver record.

=item *

fs_sc_sumOfDowntimes: Sum of all (completed) downtimes, in seconds.

=item *

fs_sc_shortestDowntime: Shortest downtime, in seconds.

=item *

fs_sc_longestDowntime: Longest downtime, in seconds.

=item *

fs_sc_down_0_10_min: Down time incidents: 0-10 minutes.

=item *

pod/afsmon_stats.pod  view on Meta::CPAN

=item *

fs_oc_maxDowntimesInARecord: Maximum downtimes seen by any fileserver.

=item *

fs_oc_sumOfDowntimes: Sum of all (completed) downtimes, in seconds.

=item *

fs_oc_shortestDowntime: Shortest downtime, in seconds.

=item *

fs_oc_longestDowntime: Longest downtime, in seconds.

=item *

fs_oc_down_0_10_min: Down time incidents: 0-10 minutes.

=item *

pod/afsmon_stats.pod  view on Meta::CPAN

=item *

vl_sc_maxDowntimesInARecord: Maximum downtimes seen by any vlserver record.

=item *

vl_sc_sumOfDowntimes: Sum of all (completed) downtimes, in seconds.

=item *

vl_sc_shortestDowntime: Shortest downtime, in seconds.

=item *

vl_sc_longestDowntime: Longest downtime, in seconds.

=item *

vl_sc_down_0_10_min: Down time incidents: 0-10 minutes.

=item *

pod/afsmon_stats.pod  view on Meta::CPAN

=item *

vl_oc_maxDowntimesInARecord: Maximum downtimes seen by any vlserver record.

=item *

vl_oc_sumOfDowntimes: Sum of all (completed) downtimes, in seconds.

=item *

vl_oc_shortestDowntime: Shortest downtime, in seconds.

=item *

vl_oc_longestDowntime: Longest downtime, in seconds.

=item *

vl_oc_down_0_10_min: Down time incidents: 0-10 minutes.

=item *

pod/afsmonitor.pod  view on Meta::CPAN

=item B<# I<comments>>

Displays a line of text that the B<afsmonitor> function ignores because
of the initial number (#) sign, which must appear in the very first
column of the line.

=back

=head1 KNOWN BUGS

Some statistical values reported by L<xstat_fs_test(1)> are not yet
included in afsmonitor. This is a problem of the underlying OpenAFS
libraries and will be fixed in this Perl module as soon as those
libraries are fixed.

=head1 AUTHORS

The code and documentation for this class were contributed by Stanford
Linear Accelerator Center, a department of Stanford University.  This
documentation was written by

pod/rxdebug.pod  view on Meta::CPAN


=head1 OPTIONS

=over

=item B<servers>

Specifies the machine that is running the Cache Manager or server process for
which to trace Rx activity. Provide the machine's IP address in dotted decimal
format, its fully qualified host name (for example, B<fs1.abc.com>), or the
shortest abbreviated form of its host name that distinguishes it from other
machines. Successful use of an abbreviated form depends on the availability of
a name resolution service (such as the Domain Name Service or a local host
table) at the time the function is issued.

=item B<port>

Specifies the process for which to trace Rx activity. Omit this argument to
specify the File Server (B<fileserver> process), or provide one of the
following values:

pod/scout.pod  view on Meta::CPAN

=over

=item B<server>

String with one name or reference to an array with names of one or
more machines from which to gather File Server statistics.
Specifies each file server machine running a File Server process to monitor.
Provide each machine's fully qualified hostname unless the B<basename>
argument is used. In that case, specify only the unique initial part of each
machine name, omitting the domain name suffix (the basename) common to all the
names. It is also acceptable to use the shortest abbreviated form of a host
name that distinguishes it from other machines, but successful resolution
depends on the availability of a name resolution service (such as the Domain
Name Service or a local host table) at the time the command is issued.

=item B<basename>

String that specifies the basename (domain name) suffix common to all of the
file server machine names specified with the B<server> argument, and is
automatically appended to them. This argument is normally the name of the cell
to which the machines belong. Do not include the period that separates this

pod/udebug.pod  view on Meta::CPAN


=head1 OPTIONS

=over

=item B<server>

Names the database server machine that is running the process
for which to collect status information. Provide the machine's
IP address in dotted decimal format, its fully qualified host
name (for example, B<fs1.abc.com>), or the shortest abbreviated
form of its host name that distinguishes it from other machines.
Successful use of an abbreviated form depends on the availability
of a name resolution service (such as the Domain Name Service
or a local host table) at the time the function is issued.

=item B<port>

Identifies the database server process for which to collect
status information, either by its process name or port number.
Provide one of the following values:

pod/xstat_cm_test.pod  view on Meta::CPAN

#------------------------------------------------------------------------------
# xstat_cm_test.pod
#
# Copyright © 2004 Alf Wachsmann <alfw@slac.stanford.edu> and
#                  Elizabeth Cassell <e_a_c@mailsnare.net>
#
# This library is free software; you can redistribute it and/or modify it
# under the same terms as Perl itself.
#------------------------------------------------------------------------------

=head1 NAME

B<xstat_cm_test> - Gathers data collections from the Cache Manager

=head1 SYNOPSIS

  use AFS::Monitor qw(xstat_cm_test);

  my $result = xstat_cm_test(
                             cmname => ["hostName1", "hostName2"],
                             collID => [0, 1, 2],
                            );

  foreach my $probe (@$result) {
    print "For host: $probe->{hostName}, ";
    print "Collection $probe->{collectionNumber}\n";
    if ($probe->{probeOK}) {
      print "probe successful\n";
    } else {
      print "probe failed\n";
    }
  }

=head1 DESCRIPTION

The B<xstat_cm_test> function returns the data collections from B<libxstat_cm.a>
associated with the Cache Manager.

=head1 OPTIONS

=over

=item B<cmname>

String with one name or reference to an array with names of one or
more machines from which to monitor the Cache Manager.

pod/xstat_cm_test.pod  view on Meta::CPAN


=item B<probeOK>

1 if the probe was successful, 0 if the probe failed.

=item B<data>

If the probe was not successful, this key will not exist. Otherwise, this
entry will contain a reference to a hash containing all of the data collected.
For details on the contents of this hash, and an example of printing it in a
readable format, refer to the B<xstat_cm_test> script in the B<examples>
directory.

=back

=head1 AUTHORS

The code and documentation for this class were contributed by Stanford
Linear Accelerator Center, a department of Stanford University.  This
documentation was written by

pod/xstat_fs_test.pod  view on Meta::CPAN

#------------------------------------------------------------------------------
# xstat_fs_test.pod
#
# Copyright © 2004 Alf Wachsmann <alfw@slac.stanford.edu> and
#                  Elizabeth Cassell <e_a_c@mailsnare.net>
#
# This library is free software; you can redistribute it and/or modify it
# under the same terms as Perl itself.
#------------------------------------------------------------------------------

=head1 NAME

B<xstat_fs_test> - Gathers data collections from the File Server process.

=head1 SYNOPSIS

  use AFS::Monitor qw(xstat_fs_test);

  my $result = xstat_fs_test(
                             fsname => ["hostName1", "hostName2"],
                             collID => [0, 1, 2],
                            );

  foreach my $probe (@$result) {
    print "For host: $probe->{hostName}, ";
    print "Collection $probe->{collectionNumber}\n";
    if ($probe->{probeOK}) {
      print "probe successful\n";
    } else {
      print "probe failed\n";
    }
  }

=head1 DESCRIPTION

The B<xstat_fs_test> function tests the routines in the B<libxstat_fs.a>
library and returns the data collections associated with the File Server (the
fs process).

=head1 OPTIONS

=over

=item B<fsname>

String with one name or reference to an array with names of one or

pod/xstat_fs_test.pod  view on Meta::CPAN


=item B<probeOK>

1 if the probe was successful, 0 if the probe failed.

=item B<data>

If the probe was not successful, this key will not exist. Otherwise, this
entry will contain a reference to a hash containing all of the data collected.
For details on the contents of this hash, and an example of printing it in a
readable format, refer to the B<xstat_fs_test> script in the B<examples>
directory.

=back

=head1 AUTHORS

The code and documentation for this class were contributed by Stanford
Linear Accelerator Center, a department of Stanford University.  This
documentation was written by

src/Makefile.PL  view on Meta::CPAN

int main(void) {
  extern char *AFSVersion;
  printf(">%s<\n",AFSVersion);
}
EOF
close FILE;

system("$Config::Config{cc} fotav.c -L$AFSPath/lib -lubik");
if ($CHILD_ERROR) {
  unlink 'fotav.c';
  die "\nCould not compile test code to retrieve the version of AFS system libraries...\n";
}
my $version = `./a.out` || die "\nCould not run test code to retrieve the version of AFS system libraries...\n";
unlink 'a.out', 'fotav.c';
print "AFS Version = $version \n";

if ($version =~ /3.[4,5]/) {
  die("This release does not support AFS 3.4/3.5 system libraries ...\n");
}

# set the compiler flag "-D$version" according to the AFS version
my ($d_flag, $a_flag) = ('', '');
if    ($version =~ /3.4/)   { $d_flag = 'AFS 3.4'; }

src/Makefile.PL  view on Meta::CPAN

} elsif ($Config{osname} =~ /linux/) {
  $MakefileArgs{LIBS}->[0] .= ' -lresolv';
###  $MakefileArgs{LDFLAGS} = "-Wl,-rpath -Wl,$AFSPath/lib";
} elsif ($Config{osname} =~ /darwin/) {
  $MakefileArgs{LDDLFLAGS} = $Config{lddlflags} . ' -lresolv -multiply_defined suppress -read_only_relocs suppress';
}
# elsif ($Config{osname} =~ /dec_osf/) {
# # hier fehlt noch was !!!!!
# }
else {
  warn("System type '$Config{osname}' not yet tested with this Makefile.PL...\n\n"
       . "Using the default values, which may or may not work\n"
       . "If it is working, please inform the maintainer of this package.\n"
       . "Thank you.\n\n");
}

WriteMakefile(%MakefileArgs);

# change the library name of the AFS system library "util.a"
my $command = "\'s#-lutil#$AFSPath/lib/afs/util.a#\'";
system("perl -p -i.bak -e $command Makefile") unless -f "$AFSPath/lib/afs/libutil.a";

src/Makefile.PL  view on Meta::CPAN

$command = "\'s#-lcmd#$AFSPath/lib/afs/libcmd.a#\'";
system("perl -p -i.bak -e $command Makefile");

# make changes to the typemap file if Perl < 5.6.0
$command = "\'s#T_UV#T_IV#\'";
system("perl -p -i.bak -e $command typemap") unless $] >= 5.006;



sub version {
  my ($testver, $compver) = @_;

  $compver = $ENV{VERSION} unless defined $compver;

  # Remove possible package name from both strings.
  $testver =~ s/^([a-zA-Z][^-]*-)*//;
  $compver =~ s/^([a-zA-Z][^-]*-)*//;

  for my $char ('-', '\.') {
    if ("$testver$compver" =~ /$char/) {
      my @testlist = split(/$char/, $testver);
      my @complist = split(/$char/, $compver);

      my $result = 0;
      for my $comp (@complist) {
        my $test = shift(@testlist);

        return $result unless defined $test;

        $result = version($test, $comp);
        return $result unless $result == 0;
      }
      return $result;
    }
  }

   if ("$testver$compver" =~ /^\d+$/) { return $compver <=> $testver }
   else                               { return $compver cmp $testver }
}

src/Monitor.pm  view on Meta::CPAN

@ISA = qw(Exporter AutoLoader DynaLoader);

$VERSION = "0.3.2";

@EXPORT = qw (
              afsmonitor
              rxdebug
              udebug
              cmdebug
              scout
              xstat_fs_test
              xstat_cm_test
             );


# Other items we are prepared to export if requested
@EXPORT_OK = qw(
                error_message
		constant
               );

sub rxdebug {

src/Monitor.pm  view on Meta::CPAN

      }
      else {
        $subreq{$_} = 1;
      }
    }
    my $result = do_scout(\%subreq);
    return $result;
  }
}

sub xstat_fs_test {
  my %subreq;

  return eval {
    while (@_) {
     $_ = shift;

      if ( @_ and $_[0] !~ /^-/ ) {
        $subreq{$_} = shift;
      }
      else {
        $subreq{$_} = 1;
      }
    }
    my $result = do_xstat_fs_test(\%subreq);
    return $result;
  }
}

sub xstat_cm_test {
  my %subreq;

  return eval {
    while (@_) {
     $_ = shift;

      if ( @_ and $_[0] !~ /^-/ ) {
        $subreq{$_} = shift;
      }
      else {
        $subreq{$_} = 1;
      }
    }
    my $result = do_xstat_cm_test(\%subreq);
    return $result;
  }
}



sub AUTOLOAD {
    # This AUTOLOAD is used to 'autoload' constants from the constant()
    # XS function.  If a constant is not found then control is passed
    # to the AUTOLOAD in AutoLoader.

src/Monitor.xs  view on Meta::CPAN

   "GetVolumeInfo",
   "GetVolumeStatus",
   "SetVolumeStatus",
   "GetRootVolume",
   "CheckToken",
   "GetTime",
   "NGetVolumeInfo",
   "BulkStatus",
   "XStatsVersion",
   "GetXStats",
   "XLookup"	/* from xstat/xstat_cm_test.c */
};


/*
 * 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 $");
 */

static char *cmOpNames[] = {
   "CallBack",

src/Monitor.xs  view on Meta::CPAN

           a_upDownP->ageOfYoungestRecord);
   fprintf(cm_outFD, "\t\t%10d ageOfOldestRecord\n",
           a_upDownP->ageOfOldestRecord);
   fprintf(cm_outFD, "\t\t%10d numDowntimeIncidents\n",
           a_upDownP->numDowntimeIncidents);
   fprintf(cm_outFD, "\t\t%10d numRecordsNeverDown\n",
           a_upDownP->numRecordsNeverDown);
   fprintf(cm_outFD, "\t\t%10d maxDowntimesInARecord\n",
           a_upDownP->maxDowntimesInARecord);
   fprintf(cm_outFD, "\t\t%10d sumOfDowntimes\n", a_upDownP->sumOfDowntimes);
   fprintf(cm_outFD, "\t\t%10d shortestDowntime\n",
           a_upDownP->shortestDowntime);
   fprintf(cm_outFD, "\t\t%10d longestDowntime\n",
           a_upDownP->longestDowntime);

   /*
    * Now, print the array values.
    */
   fprintf(cm_outFD, "\t\tDowntime duration distribution:\n");
   fprintf(cm_outFD, "\t\t\t%8d: 0 min .. 10 min\n",
           a_upDownP->downDurations[0]);
   fprintf(cm_outFD, "\t\t\t%8d: 10 min .. 30 min\n",

src/Monitor.xs  view on Meta::CPAN



/*
 * from src/fsprobe/fsprobe.c
 *    ("$Header: /afs/slac/g/scs/slur/Repository/AFSDebug/Debug/src/Monitor.xs,v 1.2 2006/07/05 22:25:10 alfw Exp $");
 */

int
my_fsprobe_Init(fsprobe_Results, fsprobe_ConnInfo, a_numServers,
                a_socketArray, RETVAL, scout_debugfd, buffer)
   struct fsprobe_ProbeResults *fsprobe_Results;    /*Latest probe results */
   struct fsprobe_ConnectionInfo **fsprobe_ConnInfo;    /*Ptr to connection array */
   int a_numServers;
   struct sockaddr_in *a_socketArray;
   AV *RETVAL;
   FILE *scout_debugfd;
   char *buffer;
{
   static char rn[] = "my_fsprobe_Init";
   struct fsprobe_ConnectionInfo *curr_conn;    /*Current connection */
   int fsprobe_statsBytes;      /*Num bytes in stats block */

src/Monitor.xs  view on Meta::CPAN

      my_fsprobe_Cleanup(&fsprobe_Results, fsprobe_ConnInfo, numServers,
                         scout_debugfd, buffer);

   return code;
}

/* end of scout helper functions */



/* xstat_fs_test helper functions */

/*
 * from src/xstat/xstat_fs_test.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_PrintOpTiming(int a_opIdx, struct fs_stats_opTimingData *a_opTimeP, HV *DATA)
{
   HV *OPTIMING = newHV();

   hv_store(OPTIMING, "sumTime", 7,
            newSVnv(a_opTimeP->sumTime.tv_sec +

src/Monitor.xs  view on Meta::CPAN

   hv_store(OPTIMING, "numSuccesses", 12, newSViv(a_opTimeP->numSuccesses),
            0);
   hv_store(OPTIMING, "numOps", 6, newSViv(a_opTimeP->numOps), 0);

   hv_store(DATA, fsOpNames[a_opIdx], strlen(fsOpNames[a_opIdx]),
            newRV_inc((SV *) OPTIMING), 0);
}


/*
 * from src/xstat/xstat_fs_test.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_PrintXferTiming(int a_opIdx, struct fs_stats_xferData *a_xferP, HV *DATA)
{
   HV *XFERTIMING = newHV();
   AV *COUNT = newAV();
   int i;

src/Monitor.xs  view on Meta::CPAN

      av_store(COUNT, i, newSViv(a_xferP->count[i]));

   hv_store(XFERTIMING, "count", 5, newRV_inc((SV *) COUNT), 0);

   hv_store(DATA, xferOpNames[a_opIdx], strlen(xferOpNames[a_opIdx]),
            newRV_inc((SV *) XFERTIMING), 0);
}


/*
 * from src/xstat/xstat_fs_test.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_PrintDetailedPerfInfo(struct fs_stats_DetailedStats *a_detP, HV *DATA)
{
   int currIdx;
   HV *OPTIMES = newHV();
   HV *XFERS = newHV();

src/Monitor.xs  view on Meta::CPAN

   hv_store(DATA, "rpcOpTimes", 10, newRV_inc((SV *) OPTIMES), 0);

   for (currIdx = 0; currIdx < FS_STATS_NUM_XFER_OPS; currIdx++)
      my_PrintXferTiming(currIdx, &(a_detP->xferOpTimes[currIdx]), XFERS);

   hv_store(DATA, "xferOpTimes", 11, newRV_inc((SV *) XFERS), 0);
}


/*
 * from src/xstat/xstat_fs_test.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_PrintOverallPerfInfo(struct afs_PerfStats *a_ovP, HV *DATA)
{
   hv_store(DATA, "numPerfCalls", strlen("numPerfCalls"),
            newSViv(a_ovP->numPerfCalls), 0);

   /*

src/Monitor.xs  view on Meta::CPAN

   hv_store(DATA, "host_ClientBlocks", strlen("host_ClientBlocks"),
            newSViv(a_ovP->host_ClientBlocks), 0);

   hv_store(DATA, "sysname_ID", strlen("sysname_ID"),
            newSViv(a_ovP->sysname_ID), 0);
}



/*
 * from src/xstat/xstat_fs_test.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_PrintCallInfo(struct xstat_fs_ProbeResults *xstat_fs_Results, HV *HOSTINFO)
{
   int numInt32s;
   afs_int32 *currInt32;
   register int i;
   char temp[100];

src/Monitor.xs  view on Meta::CPAN

   currInt32 = (afs_int32 *) (xstat_fs_Results->data.AFS_CollData_val);
   for (i = 0; i < numInt32s; i++) {
      sprintf(temp, "%d", i);
      hv_store(DATA, temp, strlen(temp), newSViv(*currInt32++), 0);
   }
   hv_store(HOSTINFO, "data", 4, newRV_inc((SV *) DATA), 0);
}


/*
 * from src/xstat/xstat_fs_test.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_PrintPerfInfo(struct xstat_fs_ProbeResults *xstat_fs_Results, HV *HOSTINFO)
{
   /* Correct # int32s to rcv */
   static afs_int32 perfInt32s = (sizeof(struct afs_PerfStats) >> 2);
   /* # int32words received */
   afs_int32 numInt32s;

src/Monitor.xs  view on Meta::CPAN

   perfP = (struct afs_PerfStats *)
      (xstat_fs_Results->data.AFS_CollData_val);

   my_PrintOverallPerfInfo(perfP, DATA);

   hv_store(HOSTINFO, "data", 4, newRV_inc((SV *) DATA), 0);
}


/*
 * from src/xstat/xstat_fs_test.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_fs_PrintFullPerfInfo(struct xstat_fs_ProbeResults *xstat_fs_Results, HV *HOSTINFO)
{
   /* Correct # int32s to rcv */
   static afs_int32 fullPerfInt32s = (sizeof(struct fs_stats_FullPerfStats) >> 2);
   /* # int32words received */
   afs_int32 numInt32s;

src/Monitor.xs  view on Meta::CPAN

      (xstat_fs_Results->data.AFS_CollData_val);

   my_PrintOverallPerfInfo(&(fullPerfP->overall), DATA);
   my_PrintDetailedPerfInfo(&(fullPerfP->det), DATA);

   hv_store(HOSTINFO, "data", 4, newRV_inc((SV *) DATA), 0);
}


/*
 * from src/xstat/xstat_fs_test.c
 *    ("$Header: /afs/slac/g/scs/slur/Repository/AFSDebug/Debug/src/Monitor.xs,v 1.2 2006/07/05 22:25:10 alfw Exp $");
 */

static char *CbCounterStrings[] = {
    "DeleteFiles",
    "DeleteCallBacks",
    "BreakCallBacks",
    "AddCallBack",
    "GotSomeSpaces",
    "DeleteAllCallBacks",
    "nFEs", "nCBs", "nblks",
    "CBsTimedOut",
    "nbreakers",
    "GSS1", "GSS2", "GSS3", "GSS4", "GSS5"
};


/*
 * from src/xstat/xstat_fs_test.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_fs_PrintCbCounters(struct xstat_fs_ProbeResults *xstat_fs_Results, HV *HOSTINFO)
{
    int numInt32s = sizeof(CbCounterStrings)/sizeof(char *);
    int i;
    afs_uint32 *val = xstat_fs_Results->data.AFS_CollData_val;
    HV *DATA = newHV();

src/Monitor.xs  view on Meta::CPAN

        hv_store(DATA, CbCounterStrings[i], strlen(CbCounterStrings[i]), newSViv(val[i]), 0);
    }

   hv_store(HOSTINFO, "CbCounters", 10, newRV_inc((SV *) DATA), 0);
}




/*
 * from src/xstat/xstat_fs_test.c
 *    ("$Header: /afs/slac/g/scs/slur/Repository/AFSDebug/Debug/src/Monitor.xs,v 1.2 2006/07/05 22:25:10 alfw Exp $");
 */

int
my_xstat_FS_Handler(xstat_fs_Results, xstat_fs_numServers, index, buffer,
                    argp)
   struct xstat_fs_ProbeResults xstat_fs_Results;
   int xstat_fs_numServers;
   int index;
   char *buffer;

src/Monitor.xs  view on Meta::CPAN

           sprintf(buffer, "** Unknown collection: %d",
                   xstat_fs_Results.collectionNumber);
           return (-1);
      }
   }

   av_store(RETVAL, index, newRV_inc((SV *) HOSTINFO));
   return (0);
}

/* end of xstat_fs_test helper functions */



/* xstat_cm_test helper functions */


/*
 * from src/xstat/xstat_cm_test.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_print_cmCallStats(struct xstat_cm_ProbeResults *xstat_cm_Results, HV *HOSTINFO)
{
   struct afs_CMStats *cmp;
   HV *DATA = newHV();
   char *data_name;

src/Monitor.xs  view on Meta::CPAN

   hv_store(DATA, data_name, strlen(data_name),
            newSViv(cmp->callInfo.C_PFlushMount), 0);


   hv_store(HOSTINFO, "data", 4, newRV_inc((SV *) DATA), 0);

}


/*
 * from src/xstat/xstat_cm_test.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_cm_PrintUpDownStats(struct afs_stats_SrvUpDownInfo *a_upDownP, AV *UPDOWN, int index)
{
   HV *INFO = newHV();
   AV *DOWNDURATIONS = newAV();
   AV *DOWNINCIDENTS = newAV();
   int i;

src/Monitor.xs  view on Meta::CPAN

   hv_store(INFO, "ageOfOldestRecord", strlen("ageOfOldestRecord"),
            newSViv(a_upDownP->ageOfOldestRecord), 0);
   hv_store(INFO, "numDowntimeIncidents", strlen("numDowntimeIncidents"),
            newSViv(a_upDownP->numDowntimeIncidents), 0);
   hv_store(INFO, "numRecordsNeverDown", strlen("numRecordsNeverDown"),
            newSViv(a_upDownP->numRecordsNeverDown), 0);
   hv_store(INFO, "maxDowntimesInARecord", strlen("maxDowntimesInARecord"),
            newSViv(a_upDownP->maxDowntimesInARecord), 0);
   hv_store(INFO, "sumOfDowntimes", strlen("sumOfDowntimes"),
            newSViv(a_upDownP->sumOfDowntimes), 0);
   hv_store(INFO, "shortestDowntime", strlen("shortestDowntime"),
            newSViv(a_upDownP->shortestDowntime), 0);
   hv_store(INFO, "longestDowntime", strlen("longestDowntime"),
            newSViv(a_upDownP->longestDowntime), 0);

   /*
    * Now, print the array values.
    */
   for (i = 0; i <= 6; i++) {
      av_store(DOWNDURATIONS, i, newSViv(a_upDownP->downDurations[i]));
   }
   for (i = 0; i <= 5; i++) {
      av_store(DOWNINCIDENTS, i, newSViv(a_upDownP->downIncidents[i]));
   }
   hv_store(INFO, "downDurations", 13, newRV_inc((SV *) DOWNDURATIONS), 0);
   hv_store(INFO, "downIncidents", 13, newRV_inc((SV *) DOWNINCIDENTS), 0);
   av_store(UPDOWN, index, newRV_inc((SV *) INFO));
}


/*
 * from src/xstat/xstat_cm_test.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_cm_PrintOverallPerfInfo(struct afs_stats_CMPerf *a_ovP, HV *PERF)
{
   char *data_name;
   AV *FS_UPDOWN = newAV();
   AV *VL_UPDOWN = newAV();

src/Monitor.xs  view on Meta::CPAN


   my_cm_PrintUpDownStats(&(a_ovP->vl_UpDown[1]), VL_UPDOWN, 1);

   hv_store(PERF, "fs_UpDown", 9, newRV_inc((SV *) FS_UPDOWN), 0);
   hv_store(PERF, "vl_UpDown", 9, newRV_inc((SV *) VL_UPDOWN), 0);

}


/*
 * from src/xstat/xstat_cm_test.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_cm_PrintOpTiming(a_opIdx, a_opNames, a_opTimeP, RPCTIMES)
   int a_opIdx;
   char *a_opNames[];
   struct afs_stats_opTimingData *a_opTimeP;
   HV *RPCTIMES;
{

src/Monitor.xs  view on Meta::CPAN

   hv_store(TIMES, "maxTime", 7,
            newSVnv(a_opTimeP->maxTime.tv_sec +
                    (a_opTimeP->maxTime.tv_usec / 1000000.0)), 0);

   hv_store(RPCTIMES, a_opNames[a_opIdx], strlen(a_opNames[a_opIdx]),
            newRV_inc((SV *) TIMES), 0);
}


/*
 * from src/xstat/xstat_cm_test.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_cm_PrintErrInfo(a_opIdx, a_opNames, a_opErrP, RPCERRORS)
   int a_opIdx;
   char *a_opNames[];
   struct afs_stats_RPCErrors *a_opErrP;
   HV *RPCERRORS;
{

src/Monitor.xs  view on Meta::CPAN

   hv_store(ERRORS, "err_Volume",       10, newSViv(a_opErrP->err_Volume), 0);
   hv_store(ERRORS, "err_VolumeBusies", 16, newSViv(a_opErrP->err_VolumeBusies), 0);
   hv_store(ERRORS, "err_Other",         9, newSViv(a_opErrP->err_Other), 0);

   hv_store(RPCERRORS, a_opNames[a_opIdx], strlen(a_opNames[a_opIdx]),
            newRV_inc((SV *) ERRORS), 0);
}


/*
 * from src/xstat/xstat_cm_test.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_cm_PrintXferTiming(a_opIdx, a_opNames, a_xferP, XFERTIMES)
   int a_opIdx;
   char *a_opNames[];
   struct afs_stats_xferData *a_xferP;
   HV *XFERTIMES;
{

src/Monitor.xs  view on Meta::CPAN

      av_store(COUNT, i, newSViv(a_xferP->count[i]));

   hv_store(TIMES, "count", 5, newRV_inc((SV *) COUNT), 0);

   hv_store(XFERTIMES, a_opNames[a_opIdx], strlen(a_opNames[a_opIdx]),
            newRV_inc((SV *) TIMES), 0);
}


/*
 * from src/xstat/xstat_cm_test.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_PrintRPCPerfInfo(struct afs_stats_RPCOpInfo *a_rpcP, HV *RPC)
{
   int currIdx;
   HV *FSRPCTIMES  = newHV();
   HV *FSRPCERRORS = newHV();
   HV *FSXFERTIMES = newHV();

src/Monitor.xs  view on Meta::CPAN

   for (currIdx = 0; currIdx < AFS_STATS_NUM_CM_RPC_OPS; currIdx++)
      my_cm_PrintOpTiming(currIdx, cmOpNames, &(a_rpcP->cmRPCTimes[currIdx]),
                          CMRPCTIMES);

   hv_store(RPC, "cmRPCTimes", 10, newRV_inc((SV *) CMRPCTIMES), 0);

}


/*
 * from src/xstat/xstat_cm_test.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_cm_PrintFullPerfInfo(struct xstat_cm_ProbeResults *xstat_cm_Results, HV *HOSTINFO)
{
   /*Ptr to authentication stats */
   struct afs_stats_AuthentInfo *authentP;
   /*Ptr to access stats */
   struct afs_stats_AccessInfo *accessinfP;

src/Monitor.xs  view on Meta::CPAN

            newSViv(accessinfP->maxReplicasPerRef), 0);
   hv_store(ACCESSINF, "refFirstReplicaOK", 17,
            newSViv(accessinfP->refFirstReplicaOK), 0);
   hv_store(DATA, "accessinf", 9, newRV_inc((SV *) ACCESSINF), 0);

   hv_store(HOSTINFO, "data", 4, newRV_inc((SV *) DATA), 0);
}


/*
 * from src/xstat/xstat_cm_test.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_cm_PrintPerfInfo(struct xstat_cm_ProbeResults *xstat_cm_Results, HV *HOSTINFO)
{
   /*Correct # int32s to rcv */
   static afs_int32 perfInt32s = (sizeof(struct afs_stats_CMPerf) >> 2);
   /*# int32words received */
   afs_int32 numInt32s;

src/Monitor.xs  view on Meta::CPAN

   }
   perfP = (struct afs_stats_CMPerf *)
      (xstat_cm_Results->data.AFSCB_CollData_val);

   my_cm_PrintOverallPerfInfo(perfP, DATA);
   hv_store(HOSTINFO, "data", 4, newRV_inc((SV *) DATA), 0);
}


/*
 * from src/xstat/xstat_cm_test.c
 *    ("$Header: /afs/slac/g/scs/slur/Repository/AFSDebug/Debug/src/Monitor.xs,v 1.2 2006/07/05 22:25:10 alfw Exp $");
 */

int
my_xstat_CM_Handler(xstat_cm_Results, xstat_cm_numServers, index, buffer,
                    argp)
   struct xstat_cm_ProbeResults xstat_cm_Results;
   int xstat_cm_numServers;
   int index;
   char *buffer;

src/Monitor.xs  view on Meta::CPAN

           return (-1);
      }
   }


   av_store(RETVAL, index, newRV_inc((SV *) HOSTINFO));
   return (0);
}


/* end of xstat_cm_test helper functions */



MODULE = AFS::Monitor    PACKAGE = AFS::Monitor    PREFIX = afs_
PROTOTYPES: ENABLE

BOOT:
    initialize_rxk_error_table();


void
afs_do_xstat_cm_test(args)
    HV* args = (HV*) SvRV($arg);
  PREINIT:
  PPCODE:
  {
    SV *value;
    I32 keylen = 0;
    char *key;
    int num_args = 0;
    char buffer[256] = "";
    AV *host_array=0;

src/Monitor.xs  view on Meta::CPAN

       XSRETURN_UNDEF;
    }

    ST(0) = sv_2mortal(newRV_inc((SV*)RETVAL));
    SETCODE(0);
    XSRETURN(1);
  }


void
afs_do_xstat_fs_test(args)
    HV* args = (HV*) SvRV($arg);
  PREINIT:
  PPCODE:
  {
    SV *value;
    I32 keylen = 0;
    char *key;
    int num_args = 0;
    char buffer[256] = "";
    AV *host_array=0;

src/afsmon-labels.h  view on Meta::CPAN

"fs_sc_numTtlRecords",	/* file server server up/down stats for same cell */
"fs_sc_numUpRecords",
"fs_sc_numDownRecords",
"fs_sc_sumOfRecordAges",
"fs_sc_ageOfYoungestRecord",
"fs_sc_ageOfOldestRecord",
"fs_sc_numDowntimeIncidents",
"fs_sc_numRecordsNeverDown",
"fs_sc_maxDowntimesInARecord",
"fs_sc_sumOfDowntimes",
"fs_sc_shortestDowntime",
"fs_sc_longestDowntime",
"fs_sc_down_0_10_min",
"fs_sc_down_10_30_min",
"fs_sc_down_half_1_hr",
"fs_sc_down_1_2_hr",
"fs_sc_down_2_4_hr",
"fs_sc_down_4_8_hr",
"fs_sc_down_more_8_hr",
"fs_sc_downDst_0",
"fs_sc_downDst_1",

src/afsmon-labels.h  view on Meta::CPAN

"fs_oc_numTtlRecords",	/* file server server up/down stats for other cells */
"fs_oc_numUpRecords",
"fs_oc_numDownRecords",
"fs_oc_sumOfRecordAges",
"fs_oc_ageOfYoungestRecord",
"fs_oc_ageOfOldestRecord",
"fs_oc_numDowntimeIncidents",
"fs_oc_numRecordsNeverDown",
"fs_oc_maxDowntimesInARecord",
"fs_oc_sumOfDowntimes",
"fs_oc_shortestDowntime",
"fs_oc_longestDowntime",
"fs_oc_down_0_10_min",
"fs_oc_down_10_30_min",
"fs_oc_down_half_1_hr",
"fs_oc_down_1_2_hr",
"fs_oc_down_2_4_hr",
"fs_oc_down_4_8_hr",
"fs_oc_down_more_8_hr",
"fs_oc_downDst_0",
"fs_oc_downDst_1",

src/afsmon-labels.h  view on Meta::CPAN

"vl_sc_numTtlRecords",	/* vl server up/down stats for same cell */
"vl_sc_numUpRecords",
"vl_sc_numDownRecords",
"vl_sc_sumOfRecordAges",
"vl_sc_ageOfYoungestRecord",
"vl_sc_ageOfOldestRecord",
"vl_sc_numDowntimeIncidents",
"vl_sc_numRecordsNeverDown",
"vl_sc_maxDowntimesInARecord",
"vl_sc_sumOfDowntimes",
"vl_sc_shortestDowntime",
"vl_sc_longestDowntime",
"vl_sc_down_0_10_min",
"vl_sc_down_10_30_min",
"vl_sc_down_half_1_hr",
"vl_sc_down_1_2_hr",
"vl_sc_down_2_4_hr",
"vl_sc_down_4_8_hr",
"vl_sc_down_more_8_hr",
"vl_sc_downDst_0",
"vl_sc_downDst_1",

src/afsmon-labels.h  view on Meta::CPAN

"vl_oc_numTtlRecords",	/* vl server up/down stats for other cells */
"vl_oc_numUpRecords",
"vl_oc_numDownRecords",
"vl_oc_sumOfRecordAges",
"vl_oc_ageOfYoungestRecord",
"vl_oc_ageOfOldestRecord",
"vl_oc_numDowntimeIncidents",
"vl_oc_numRecordsNeverDown",
"vl_oc_maxDowntimesInARecord",
"vl_oc_sumOfDowntimes",
"vl_oc_shortestDowntime",
"vl_oc_longestDowntime",
"vl_oc_down_0_10_min",
"vl_oc_down_10_30_min",
"vl_oc_down_half_1_hr",
"vl_oc_down_1_2_hr",
"vl_oc_down_2_4_hr",
"vl_oc_down_4_8_hr",
"vl_oc_down_more_8_hr",
"vl_oc_downDst_0",
"vl_oc_downDst_1",

src/ppport.h  view on Meta::CPAN


#ifndef _P_P_PORTABILITY_H_
#define _P_P_PORTABILITY_H_

/* Perl/Pollution/Portability Version 1.0007 */

/* Copyright (C) 1999, Kenneth Albanowski. This code may be used and
   distributed under the same license as any version of Perl. */

/* For the latest version of this code, please retreive the Devel::PPPort
   module from CPAN, contact the author at <kjahds@kjahds.com>, or check
   with the Perl maintainers. */

/* If you needed to customize this file for your project, please mention
   your changes, and visible alter the version number. */


/*
   In order for a Perl extension module to be as portable as possible
   across differing versions of Perl itself, certain steps need to be taken.

src/ppport.h  view on Meta::CPAN

   your source code. Simply say:

   	perl -x ppport.h *.c *.h *.xs foo/*.c [etc]

   The result will be a list of patches suggesting changes that should at
   least be acceptable, if not necessarily the most efficient solution, or a
   fix for all possible problems. It won't catch where dTHR is needed, and
   doesn't attempt to account for global macro or function definitions,
   nested includes, typemaps, etc.

   In order to test for the need of dTHR, please try your module under a
   recent version of Perl that has threading compiled-in.

*/


/*
#!/usr/bin/perl
@ARGV = ("*.xs") if !@ARGV;
%badmacros = %funcs = %macros = (); $replace = 0;
foreach (<DATA>) {

src/t/Monitor.t  view on Meta::CPAN

use strict;

use lib qw(../../inc ../inc ./inc);

use Test::More tests => 11;

BEGIN {
  use_ok('AFS::Monitor', qw(error_message constant));
}

# Some very basic tests first:

sub foo { return &AFS::Monitor::RX_CALL_CLEARED }

# test error_message
is(error_message(267274), 'Unknown code pt 10 (267274)', 'Return Code 267274');

# test subroutine returning a constant
is(foo(42,17), 64, 'Sub Foo returns constant (2 args)');
is(foo(42), 64, 'Sub Foo returns constant (1 arg)');
is(foo(), 64, 'Sub Foo returns constant (no args)');

# test constant
is(constant('RX_CONN_DESTROY_ME'), 2, 'Constant RX_CONN_DESTROY_ME');
is(constant('RX_CONN_DESTROY_ME', 2), 2, 'Constant RX_CONN_DESTROY_ME with argument');
isnt(constant('zzz'), 2, 'Unknown Constant zzz');

# test AUTOLOAD running function "constant"
is(&AFS::Monitor::RX_CONN_DESTROY_ME, 2, 'AutoLoad Constant RX_CONN_DESTROY_ME');


# Now some more AFS function tests:

use AFS::Monitor;
can_ok('AFS::Monitor', qw(rxdebug));

my $servers = 'afs02.slac.stanford.edu';
my $port    = 7001;
my $rxdeb   = rxdebug(version => 1,
                      servers => $servers,
                      port    => $port
                     );



( run in 0.550 second using v1.01-cache-2.11-cpan-87723dcf8b7 )