AFS-Monitor

 view release on metacpan or  search on metacpan

LICENSES/Artistic  view on Meta::CPAN

	and so on.  (You will not be required to justify it to the
	Copyright Holder, but only to the computing community at large
	as a market that must bear the fee.)

	"Freely Available" means that no fee is charged for the item
	itself, though there may be fees involved in handling the item.
	It also means that recipients of the item may redistribute it
	under the same conditions they received it.

1. You may make and give away verbatim copies of the source form of the
Standard Version of this Package without restriction, provided that you
duplicate all of the original copyright notices and associated disclaimers.

2. You may apply bug fixes, portability fixes and other modifications
derived from the Public Domain or from the Copyright Holder.  A Package
modified in such a way shall still be considered the Standard Version.

3. You may otherwise modify your copy of this Package in any way, provided
that you insert a prominent notice in each changed file stating how and
when you changed that file, and provided that you do at least ONE of the
following:

LICENSES/Artistic  view on Meta::CPAN

interpreter is so embedded.

6. The scripts and library files supplied as input to or produced as
output from the programs of this Package do not automatically fall
under the copyright of this Package, but belong to whoever generated
them, and may be sold commercially, and may be aggregated with this
Package.  If such scripts or library files are aggregated with this
Package via the so-called "undump" or "unexec" methods of producing a
binary executable image, then distribution of such an image shall
neither be construed as a distribution of this Package nor shall it
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

the GNU Library General Public License instead.)  You can apply it to
your programs, too.

  When we speak of free software, we are referring to freedom, not
price.  Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.

  To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.

  For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have.  You must make sure that they, too, receive or can get the
source code.  And you must show them these terms so they know their
rights.

  We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,

LICENSES/COPYING  view on Meta::CPAN

   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

  0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License.  The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language.  (Hereinafter, translation is included without limitation in
the term "modification".)  Each licensee is addressed as "you".

Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope.  The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.

  1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License

LICENSES/COPYING  view on Meta::CPAN


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,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:

    a) Accompany it with the complete corresponding machine-readable
    source code, which must be distributed under the terms of Sections
    1 and 2 above on a medium customarily used for software interchange; or,

    b) Accompany it with a written offer, valid for at least three
    years, to give any third party, for a charge no more than your
    cost of physically performing source distribution, a complete
    machine-readable copy of the corresponding source code, to be
    distributed under the terms of Sections 1 and 2 above on a medium
    customarily used for software interchange; or,

    c) Accompany it with the information you received as to the offer
    to distribute corresponding source code.  (This alternative is
    allowed only for noncommercial distribution and only if you
    received the program in object code or executable form with such
    an offer, in accord with Subsection b above.)

The source code for a work means the preferred form of the work for
making modifications to it.  For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable.  However, as a
special exception, the source code distributed need not include

LICENSES/COPYING  view on Meta::CPAN

operating system on which the executable runs, unless that component
itself accompanies the executable.

If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.

  4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License.  Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.

  5. You are not required to accept this License, since you have not
signed it.  However, nothing else grants you permission to modify or
distribute the Program or its derivative works.  These actions are
prohibited by law if you do not accept this License.  Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.

  6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions.  You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.

  7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License.  If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all.  For example, if a patent

LICENSES/COPYING  view on Meta::CPAN

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
be a consequence of the rest of this License.

  8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded.  In such case, this License incorporates
the limitation as if written in the body of this License.

  9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time.  Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.

Each version is given a distinguishing version number.  If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation.  If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.

  10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission.  For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this.  Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.

			    NO WARRANTY

  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS

LICENSES/COPYING  view on Meta::CPAN


The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License.  Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.

You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary.  Here is a sample; alter the names:

  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
  `Gnomovision' (which makes passes at compilers) written by James Hacker.

  <signature of Ty Coon>, 1 April 1989
  Ty Coon, President of Vice

This General Public License does not permit incorporating your program into
proprietary programs.  If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library.  If this is what you want to do, use the GNU Library General
Public License instead of this License.

LICENSES/IBM-LICENSE  view on Meta::CPAN

       the Contribution. No hardware per se is licensed hereunder.
       
   c) Recipient understands that although each Contributor grants the
       licenses to its Contributions set forth herein, no assurances are
       provided by any Contributor that the Program does not infringe the
       patent or other intellectual property rights of any other entity.
       Each Contributor disclaims any liability to Recipient for claims
       brought by any other entity based on infringement of intellectual
       property rights or otherwise. As a condition to exercising the
       rights and licenses granted hereunder, each Recipient hereby
       assumes sole responsibility to secure any other intellectual
       property rights needed, if any. For example, if a third party
       patent license is required to allow Recipient to distribute the
       Program, it is Recipient's responsibility to acquire that license
       before distributing the Program.
       
   d) Each Contributor represents that to its knowledge it has sufficient
       copyright rights in its Contribution, if any, to grant the
       copyright license set forth in this Agreement.
       
   3. REQUIREMENTS
   
   A Contributor may choose to distribute the Program in object code form
   under its own license agreement, provided that:
   a) it complies with the terms and conditions of this Agreement; and
       
   b) its license agreement:
       
   i) effectively disclaims on behalf of all Contributors all warranties
       and conditions, express and implied, including warranties or
       conditions of title and non-infringement, and implied warranties
       or conditions of merchantability and fitness for a particular
       purpose;
       
   ii) effectively excludes on behalf of all Contributors all liability
       for damages, including direct, indirect, special, incidental and
       consequential damages, such as lost profits;
       
   iii) states that any provisions which differ from this Agreement are
       offered by that Contributor alone and not by any other party; and

LICENSES/IBM-LICENSE  view on Meta::CPAN

   Copyright © {date here}, International Business Machines Corporation
       and others. All Rights Reserved.
       
   In addition, each Contributor must identify itself as the originator
   of its Contribution, if any, in a manner that reasonably allows
   subsequent Recipients to identify the originator of the Contribution.
   
   4. COMMERCIAL DISTRIBUTION
   
   Commercial distributors of software may accept certain
   responsibilities with respect to end users, business partners and the
   like. While this license is intended to facilitate the commercial use
   of the Program, the Contributor who includes the Program in a
   commercial product offering should do so in a manner which does not
   create potential liability for other Contributors. Therefore, if a
   Contributor includes the Program in a commercial product offering,
   such Contributor ("Commercial Contributor") hereby agrees to defend
   and indemnify every other Contributor ("Indemnified Contributor")
   against any losses, damages and costs (collectively "Losses") arising
   from claims, lawsuits and other legal actions brought by a third party
   against the Indemnified Contributor to the extent caused by the acts

LICENSES/IBM-LICENSE  view on Meta::CPAN

   notify the Commercial Contributor in writing of such claim, and b)
   allow the Commercial Contributor to control, and cooperate with the
   Commercial Contributor in, the defense and any related settlement
   negotiations. The Indemnified Contributor may participate in any such
   claim at its own expense.
   
   For example, a Contributor might include the Program in a commercial
   product offering, Product X. That Contributor is then a Commercial
   Contributor. If that Commercial Contributor then makes performance
   claims, or offers warranties related to Product X, those performance
   claims and warranties are such Commercial Contributor's responsibility
   alone. Under this section, the Commercial Contributor would have to
   defend claims against the other Contributors related to those
   performance claims and warranties, and if a court requires any other
   Contributor to pay any damages as a result, the Commercial Contributor
   must pay those damages.
   
   5. NO WARRANTY
   
   EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS
   PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
   KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY
   WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY
   OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely
   responsible for determining the appropriateness of using and
   distributing the Program and assumes all risks associated with its
   exercise of rights under this Agreement, including but not limited to
   the risks and costs of program errors, compliance with applicable
   laws, damage to or loss of data, programs or equipment, and
   unavailability or interruption of operations.
   
   6. DISCLAIMER OF LIABILITY
   
   EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR
   ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT,

LICENSES/IBM-LICENSE  view on Meta::CPAN

   
   7. GENERAL
   
   If any provision of this Agreement is invalid or unenforceable under
   applicable law, it shall not affect the validity or enforceability of
   the remainder of the terms of this Agreement, and without further
   action by the parties hereto, such provision shall be reformed to the
   minimum extent necessary to make such provision valid and enforceable.
   
   If Recipient institutes patent litigation against a Contributor with
   respect to a patent applicable to software (including a cross-claim or
   counterclaim in a lawsuit), then any patent licenses granted by that
   Contributor to such Recipient under this Agreement shall terminate as
   of the date such litigation is filed. In addition, If Recipient
   institutes patent litigation against any entity (including a
   cross-claim or counterclaim in a lawsuit) alleging that the Program
   itself (excluding combinations of the Program with other software or
   hardware) infringes such Recipient's patent(s), then such Recipient's
   rights granted under Section 2(b) shall terminate as of the date such
   litigation is filed.
   

LICENSES/IBM-LICENSE  view on Meta::CPAN

   survive.
   
   IBM may publish new versions (including revisions) of this Agreement
   from time to time. Each new version of the Agreement will be given a
   distinguishing version number. The Program (including Contributions)
   may always be distributed subject to the version of the Agreement
   under which it was received. In addition, after a new version of the
   Agreement is published, Contributor may elect to distribute the
   Program (including its Contributions) under the new version. No one
   other than IBM has the right to modify this Agreement. Except as
   expressly stated in Sections 2(a) and 2(b) above, Recipient receives
   no rights or licenses to the intellectual property of any Contributor
   under this Agreement, whether expressly, by implication, estoppel or
   otherwise. All rights in the Program not expressly granted under this
   Agreement are reserved.
   
   This Agreement is governed by the laws of the State of New York and
   the intellectual property laws of the United States of America. No
   party to this Agreement will bring a legal action under this Agreement
   more than one year after the cause of action arose. Each party waives
   its rights to a jury trial in any resulting litigation.

README  view on Meta::CPAN


    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.


CREDITS
    See the 'CHANGES' file for details.


COPYRIGHT AND DISCLAIMER
    Copyright 2004-2006 Alf Wachsmann <alfw@slac.stanford.edu> and
                        Elizabeth Cassell <e_a_c@mailsnare.net>.
    Copyright 2011 Steven Jenkins <steven.jenkins@gmail.com>
    All rights reserved.

    Most of the explanations in the documentation are taken from the original
    AFS documentation and the AFS Perl module.

    AFS-3 Programmer's Reference:
    Volume Server/Volume Location Server Interface
    Edward R. Zayas
    (c) 1991 Transarc Corporation.
    All rights reserved.

    IBM AFS Administration Reference
    (c) IBM Corporation 2000.
    All rights reserved.

    This library is free software; you can redistribute it and/or modify it
    under the same terms as Perl itself.

examples/Meltdown.pl  view on Meta::CPAN

	print STDERR "\n\n$progName: collect rxdebug stats on AFS process.\n";
	print STDERR "usage: $progName [options]\n";
	print STDERR "options:\n";
	print STDERR " -s <server>    (required parameter, no default).\n";
	print STDERR " -p <port>      (default: 7000).\n";
	print STDERR " -t <interval>  (default: 1200 seconds).\n";
	print STDERR " -C             \n";
	print STDERR " -h             (help: show this help message).\n\n";
	print STDERR "Example: $progName -s point -p 7000\n";
	print STDERR "Collect statistics on server point for port 7000\n";
	print STDERR "Refresh interval will default to 20 minutes (1200 seconds)\n\n";
	exit 0;
} # Usage

sub Check_data {
	#
	# If a value is going to overflow the field length,
	# then bump the field length to match the value.
	# It won't be pretty but we'll have valid data.
	#
	(length $wproc	> $Ln[0]) ? ($Ln[0] = length $wproc)	: "";
	(length $nobuf	> $Ln[1]) ? ($Ln[1] = length $nobuf)	: "";
	(length $wpack	> $Ln[2]) ? ($Ln[2] = length $wpack)	: "";
	(length $fpack	> $Ln[3]) ? ($Ln[3] = length $fpack)	: "";
	(length $calls	> $Ln[4]) ? ($Ln[4] = length $calls)	: "";
	(length $delta	> $Ln[5]) ? ($Ln[5] = length $delta)	: "";
	(length $data	> $Ln[6]) ? ($Ln[6] = length $data)	: "";
	(length $resend	> $Ln[7]) ? ($Ln[7] = length $resend)	: "";
	(length $idle	> $Ln[8]) ? ($Ln[8] = length $idle)	: "";
} # Check_data

sub Header {
    if ($csvmode != 1) {
    	print "\nhh:mm:ss wproc nobufs   wpack  fpack    calls     delta  data      resends  idle\n";
    } else { # assume CSV mode...
    	print "\nhh:mm:ss,wproc,nobufs,wpack,fpack,calls,delta,data,resends,idle\n";
    }
} # Header

#
# don't buffer the output
#
$| = 1;

#
# snag program name (drop the full pathname) :

examples/Meltdown.pl  view on Meta::CPAN

}

#
# clear the counters for the first run
#
$wproc	= 0;
$wpack	= 0;
$fpack	= 0;
$calls	= 0;
$data	= 0;
$resend	= 0;
$nobuf	= 0;
$idle	= 0;
$oldcall = 0;

#
# set the default field format lengths for
# wproc,nobuf,wpack,fpack,calls,delta,data,resend,idle
#
@Ln = (5,8,6,8,9,6,9,8,4);

#
# force header display on first call
#
$firstrun = 1;

#
# run until we get cancelled

examples/Meltdown.pl  view on Meta::CPAN

	#
	# fire the command and collect the stats
	#

	$rx = rxdebug(servers => $server,
		port => $port,
		rxstats => 1,
		noconns => 1
		);

	# $wpack doesn't seem to have a corresponding value.
        # It is always zero.

	$tstats = $rx->{tstats};

	$wproc = $tstats->{nWaiting};
	$fpack = $tstats->{nFreePackets};
	$calls = $tstats->{callsExecuted};
	if ($oldcall > 0) {
		$delta = $calls - $oldcall;
	}
	else {
		$delta = 0;
	}
	$oldcall = $calls;
	$rxstats = $rx->{rxstats};
	$data = $rxstats->{dataPacketsSent};
	$resend = $rxstats->{dataPacketsReSent};
	$nobuf = $rxstats->{noPacketBuffersOnRead};
	$idle = $tstats->{idleThreads};

	#
	# verify and fix field format lengths
	#
	Check_data;

    if ($csvmode != 1) {
    	#
    	# output the timestamp and current results
    	#
    	printf "%2.2d:%2.2d:%2.2d ", $hour,$min,$sec;
    	printf "%-$Ln[0].0f %-$Ln[1].0f %-$Ln[2].0f %-$Ln[3].0f ",
    		$wproc,$nobuf,$wpack,$fpack;
    	printf "%-$Ln[4].0f %-$Ln[5].0f %-$Ln[6].0f %-$Ln[7].0f %-$Ln[8].0f\n",
    		$calls,$delta,$data,$resend,$idle;
    } else { # must be csv mode then...
    	printf "%2.2d:%2.2d:%2.2d,", $hour,$min,$sec;
    	printf "$wproc,$nobuf,$wpack,$fpack";
    	printf "$calls,$delta,$data,$resend,$idle\n";
    }

  	#
	# delay for the required interval
	#
	sleep($delay);
}

exit();

examples/afsmonitor  view on Meta::CPAN

$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,

examples/afsmonitor  view on Meta::CPAN


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
              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) {

examples/afsmonitor  view on Meta::CPAN

              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";
              }
            }
          }
        }

examples/afsmonitor  view on Meta::CPAN

              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";
              }
            }
          }
        }

examples/afsmonitor  view on Meta::CPAN

          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 " | ";
              }
            }
          }
        }

examples/afsmonitor  view on Meta::CPAN

          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 " | ";
              }
            }
          }
        }

examples/cmdebug  view on Meta::CPAN


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


sub parse_result {
  my $l = shift;
  my $c = shift;

  if ($AFS::CODE) {
    print "Error case: ", ref($l), "\n" if (defined($l));
    print "Error case: ", ref($c), "\n" if (defined($c));
    # die("Error: AFS::CODE = $AFS::CODE (", ($AFS::CODE+0), ")\n");
    print "Error: AFS::CODE = $AFS::CODE (", ($AFS::CODE+0), ")\n";
    return;
  }

examples/cmdebug  view on Meta::CPAN

      }
      if (exists $centry->{lock}) {
        print "    locks: ";
        print_lock($centry->{lock});
        print "\n";
      }
      printf("    %d bytes\tDV %d refcnt %d\n",
               $centry->{Length},
               $centry->{DataVersion},
               $centry->{refCount});
      printf("    callback %08x\texpires %u\n",
               $centry->{callback},
               $centry->{cbExpires});
      printf("    %d opens\t%d writers\n",
               $centry->{opens},
               $centry->{writers});

      print "    ";
      if ($centry->{mvstat} == 0) {
        print "normal file";
      }
      elsif ($centry->{mvstat} == 1) {
        print "mount point";

examples/configs/badconfig  view on Meta::CPAN

#
# $Revision: 1.2 $ $Date: 2004/08/05 20:52:03 $ $Author: alfw $
#

# global show statments
show cm PerfStats_section
#show cm Auth_Stats_group
show cm fs_sc_numTtlRecords
show fs VnodeCache_group

#global thresholds
thresh fs FetchData_sqr 2000
thresh fs vcache_L_Allocs 20 ThreshHandlerScript
thresh cm fs_sc_maxDowntimesInARecord 100

#individual connections

cm afs01

fs sysdev11
show fs FetchData_sqr
thresh fs vcache_L_Entries 198 S 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3

cm afs03

fs afs02
show cm fs_sc_maxDowntimesInARecord

cm afs04
thresh cm fs_sc_numTtlRecords 00000000000

examples/configs/configfile  view on Meta::CPAN

#
# $Revision: 1.3 $ $Date: 2004/08/09 16:16:59 $ $Author: alfw $
#

# global show statments
show fs VnodeCache_group
show fs FetchData_sqr
show cm PerfStats_section
show cm fs_oc_downDst_more_50

#global thresholds
thresh fs vcache_S_Entries 30
thresh fs vcache_L_Allocs 20

#individual connections


fs andrew.e.kth.se
thresh fs vcache_L_Entries 198 scripts/HandlerScript panic die

cm virtue.openafs.org
thresh cm numPerfCalls 3 scripts/HandlerScript

examples/rxdebug  view on Meta::CPAN


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
                  );
  parse_results($rxdeb);
}


sub parse_results {
  my $val = shift;

  # if there was an error, print it and then return.
  if ($AFS::CODE) {
    print "Error case: ", ref($val), "\n" if (defined($val));
    # die("Error: AFS::CODE = $AFS::CODE (", ($AFS::CODE+0), ")\n");
    print "Error: AFS::CODE = $AFS::CODE (", ($AFS::CODE+0), ")\n";
    return;
  }

  # print entire hash to screen
  if ($showdump) {
    print Dumper($val);
    return;
  }

  # print ip address and port
  print "For ", $val->{address}, " (port ", $val->{port}, ") ...\n";

  # prints everything as the rxdebug function would

  # print version if it was returned
  if (exists $val->{version}) {
    print "AFS version: ", $val->{version}, "\n";
  }

  # print tstats if they were returned
  if (exists $val->{tstats}) {

examples/rxdebug  view on Meta::CPAN


  # print rxstats if they were returned
  if (exists $val->{rxstats}) {

    print "rx stats: free packets ", $val->{tstats}->{nFreePackets},
          ", allocs ", $val->{rxstats}->{packetRequests}, ", ";

    if ($val->{tstats}->{version} >=
               constant("RX_DEBUGI_VERSION_W_NEWPACKETTYPES")) {

      print "alloc-failures(rcv ", $val->{rxstats}->{receivePktAllocFailures},
        "/", $val->{rxstats}->{receiveCbufPktAllocFailures},
        ",send ", $val->{rxstats}->{sendPktAllocFailures},
        "/", $val->{rxstats}->{sendCbufPktAllocFailures},
        ",ack ", $val->{rxstats}->{specialPktAllocFailures}, ")\n";
    } else {
      print "alloc-failures(rcv ", $val->{rxstats}->{receivePktAllocFailures},
            ",send ", $val->{rxstats}->{sendPktAllocFailures},
            ",ack ", $val->{rxstats}->{specialPktAllocFailures}, ")\n";
    }

    print "   greedy ", $val->{rxstats}->{socketGreedy},
          ", bogusReads ", $val->{rxstats}->{bogusPacketOnRead},
          " (last from host ", $val->{rxstats}->{bogusHost},
          "), noPackets ", $val->{rxstats}->{noPacketOnRead},
          ", noBuffers ", $val->{rxstats}->{noPacketBuffersOnRead},
          ", selects ", $val->{rxstats}->{selects},
          ", sendSelects ", $val->{rxstats}->{sendSelects}, "\n";

examples/rxdebug  view on Meta::CPAN

          " dally ", $val->{rxstats}->{ignorePacketDally}, "\n";

    print "   packets sent: ";
    foreach my $key (sort keys %{$val->{rxstats}->{packets}}) {
      print $key, " ", $val->{rxstats}->{packets}->{$key}->{packetsSent}, " ";
    }
    print "\n";

    print "   other send counters: ack ", $val->{rxstats}->{ackPacketsSent},
          ", data ", $val->{rxstats}->{dataPacketsSent},
          " (not resends), resends ", $val->{rxstats}->{dataPacketsReSent},
          ", pushed ", $val->{rxstats}->{dataPacketsPushed},
          ", acked&ignored ", $val->{rxstats}->{ignoreAckedPacket}, "\n";
    print "   \t(these should be small) ",
          "sendFailed ", $val->{rxstats}->{netSendFailures},
          ", fatalErrors ", $val->{rxstats}->{fatalErrors}, "\n";

    if ($val->{rxstats}->{nRttSamples}) {
      my $avrtt = $val->{rxstats}->{totalRtt}->{usec} / 1000000.00;
         $avrtt = $avrtt + $val->{rxstats}->{totalRtt}->{sec};
         $avrtt = $avrtt / $val->{rxstats}->{nRttSamples};

      printf("   Average rtt is %0.3f, with %d samples\n",
                 $avrtt,
                 $val->{rxstats}->{nRttSamples});

examples/rxdebug  view on Meta::CPAN

          }
          if ($secStatsFlags & 2) {
            print " authenticated";
          }
          if ($secStatsFlags & 4) {
            print " expired";
          }
          if ($secStatsFlags & 8) {
            print " pktCksum";
          }
          if ($val->{connections}->[$i]->{secStats}->{expires}) {
            my $secStatsExpires = $val->{connections}->[$i]->{secStats}->{expires} - time();
            $secStatsExpires = $secStatsExpires / 3600.0;
            printf(", expires in %.1f hours", $secStatsExpires);
          }
          if (!($secStatsFlags & 1)) {
            print "\n  Received ", $val->{connections}->[$i]->{secStats}->{bytesReceived},
                  " bytes in ", $val->{connections}->[$i]->{secStats}->{packetsReceived}," packets\n";
            print "  Sent ", $val->{connections}->[$i]->{secStats}->{bytesSent},
                  " bytes in ", $val->{connections}->[$i]->{secStats}->{packetsSent}, " packets\n";
          } else {
            print "\n";
          }
        } else {

examples/rxdebug  view on Meta::CPAN

  # print peers if they were returned
  if (exists $val->{peers}) {
    for (my $i = 0; $i <= $#{$val->{peers}}; $i++) {
      print "Peer at host ", $val->{peers}->[$i]->{host},
            ", port ", $val->{peers}->[$i]->{port}, "\n";

      printf("\tifMTU %hu\tnatMTU %hu\tmaxMTU %hu\n",
              $val->{peers}->[$i]->{ifMTU},
              $val->{peers}->[$i]->{natMTU},
              $val->{peers}->[$i]->{maxMTU});
      printf("\tpackets sent %d\tpacket resends %d\n",
              $val->{peers}->[$i]->{nSent},
              $val->{peers}->[$i]->{reSends});
      printf("\tbytes sent high %d low %d\n",
              $val->{peers}->[$i]->{bytesSent}->{high},
              $val->{peers}->[$i]->{bytesSent}->{low});
      printf("\tbytes received high %d low %d\n",
              $val->{peers}->[$i]->{bytesReceived}->{high},
              $val->{peers}->[$i]->{bytesReceived}->{low});

      my $tpeer_rtt = $val->{peers}->[$i]->{rtt} >> 3;

examples/scout  view on Meta::CPAN

$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 {
  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) {

examples/scout  view on Meta::CPAN

      }
    }
  }

  if ($scout) {
    foreach my $connection (@$info) {
      print $connection->{hostName}, "\n";
      if ($connection->{probeOK}) {
        print "   Conn: $connection->{stats}->{CurrentConnections}\n";
        print "  Fetch: $connection->{stats}->{TotalFetchs}\n";
        print "  Store: $connection->{stats}->{TotalStores}\n";
        print "     Ws: $connection->{stats}->{WorkStations}\n";
        print "  Disk attn:\n";
        foreach my $disk (@{$connection->{stats}->{Disk}}) {
          print "         $disk->{Name}:$disk->{BlocksAvailable} (";
          printf "%0.2f%%)\n", ($disk->{TotalBlock} - $disk->{BlocksAvailable}) * 100 / $disk->{TotalBlock};
        }
      } else {
        print "  Probe Failed.\n";
      }
    }

examples/scripts/HandlerScript  view on Meta::CPAN

#
# Copyright © 2004 Alf Wachsmann <alfw@slac.stanford.edu> and
#                  Elizabeth Cassell <e_a_c@mailsnare.net>
#
# $Revision: 1.1 $ $Date: 2004/08/05 20:52:03 $ $Author: alfw $
#

print "*** Handler Script called for an overflow!   ***\n";
print "*** Host name: ", shift, " type: ", shift, "  ***\n";
print "*** Overflow in field ", shift,
                " (threshold ", shift, ",
                      actual ", shift, ") ***\n";

my $otherargs = shift;

if ($otherargs) {
  print "*** Other arguments: ", $otherargs;
  while ($otherargs = shift) {
    print " ", $otherargs;
  }
  print " ***\n";

examples/udebug  view on Meta::CPAN

$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);
}


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::Indent = 1;
    local $Data::Dumper::Quotekeys = 0;
    local $Data::Dumper::Sortkeys = 1;
    print Dumper($info);
  }

  if ($formatted) {
    my $diff;

    if (exists $info->{interfaceAddr}) {
      print "Host's addresses are: ", join(" ", @{$info->{interfaceAddr}}),
            "\n";
    }
    printf("Host's %s time is %s\n",
           $info->{host},
           scalar localtime($info->{now}));

    $diff = time - $info->{now};
    printf("Local time is %s (time differential %d secs)\n",
           scalar localtime(time),
           $diff);

examples/xstat_cm_test  view on Meta::CPAN

$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) {

examples/xstat_fs_test  view on Meta::CPAN

$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) {

pod/Monitor.pod  view on Meta::CPAN

It is not know whether version 0.3.0 of this module works with
B<IBM/Transarc AFS> because I don't have this version available any more.


=head1 PREREQUISITES

This package does not depend on any other Perl modules.

=head1 KNOWN BUGS

This package depends on the corresponding OpenAFS libraries.
These underlying libraries still don't work properly on or with
64bit Linux systems. The problem manifests itself in statistic
values beeing zero instead of the real value.
This problem will go away once the OpenAFS 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/Monitor.pod  view on Meta::CPAN


=item Alf Wachsmann <alfw@slac.stanford.edu>

=back

=head1 COPYRIGHT AND DISCLAIMER

 Copyright 2004-2006
		Alf Wachsmann <alfw@slac.stanford.edu> and
                Elizabeth Cassell <e_a_c@mailsnare.net>
 All rights reserved.

 Most of the explanations in this document are taken from the original
 AFS documentation.

 AFS-3 Programmer's Reference:
 Volume Server/Volume Location Server Interface
 Edward R. Zayas
 (c) 1991 Transarc Corporation.
 All rights reserved.

 IBM AFS Administration Reference
 (c) IBM Corporation 2000.
 All rights reserved.

 This library is free software; you can redistribute it and/or modify it
 under the same terms as Perl itself.

pod/afsmon_stats.pod  view on Meta::CPAN

=item *

OutStandingMemUsage: Amount of allocated memory.

=item *

OutStandingAllocs: Outstanding osi_allocs (no osi_frees yet).

=item *

CallBackAlloced: Number of callback structures allocated.

=item *

CallBackFlushes: Number of callback flush operations performed.

=item *

srvRecords: Number of servers currently on record.

=item *

pod/afsmon_stats.pod  view on Meta::CPAN

=item *

FetchData_ops_ok: Number of successful FetchData operations.

=item *

FetchData_sum: Sum of timings for FetchData operations.

=item *

FetchData_sqr: Sum of squares of sample timings for FetchData operations.

=item *

FetchData_min: Minimum execution time observed for FetchData operations.

=item *

FetchData_max: Maximum execution time observed for FetchData operations.

=item *

pod/afsmon_stats.pod  view on Meta::CPAN

=item *

FetchACL_ops_ok: Number of successful FetchACL operations.

=item *

FetchACL_sum: Sum of timings for FetchACL operations.

=item *

FetchACL_sqr: Sum of squares of sample timings for FetchACL operations.

=item *

FetchACL_min: Minimum execution time observed for FetchACL operations.

=item *

FetchACL_max: Maximum execution time observed for FetchACL operations.

=item *

pod/afsmon_stats.pod  view on Meta::CPAN

=item *

FetchStatus_ops_ok: Number of successful FetchStatus operations.

=item *

FetchStatus_sum: Sum of timings for FetchStatus operations.

=item *

FetchStatus_sqr: Sum of squares of sample timings for FetchStatus operations.

=item *

FetchStatus_min: Minimum execution time observed for FetchStatus operations.

=item *

FetchStatus_max: Maximum execution time observed for FetchStatus operations.

=item *

pod/afsmon_stats.pod  view on Meta::CPAN

=item *

StoreData_ops_ok: Number of successful StoreData operations.

=item *

StoreData_sum: Sum of timings for StoreData operations.

=item *

StoreData_sqr: Sum of squares of sample timings for StoreData operations.

=item *

StoreData_min: Minimum execution time observed for StoreData operations.

=item *

StoreData_max: Maximum execution time observed for StoreData operations.

=item *

pod/afsmon_stats.pod  view on Meta::CPAN

=item *

StoreACL_ops_ok: Number of successful StoreACL operation.

=item *

StoreACL_sum: Sum of timings for StoreACL operations.

=item *

StoreACL_sqr: Sum of squares of sample timings for StoreACL operations.

=item *

StoreACL_min: Minimum execution time observed for StoreACL operations.

=item *

StoreACL_max: Maximum execution time observed for StoreACL operations.

=item *

pod/afsmon_stats.pod  view on Meta::CPAN

=item *

StoreStatus_ops_ok: Number of successful StoreStatus operations.

=item *

StoreStatus_sum: Sum of timings for StoreStatus operations.

=item *

StoreStatus_sqr: Sum of squares of sample timings for StoreStatus operations.

=item *

StoreStatus_min: Minimum execution time observed for StoreStatus operations.

=item *

StoreStatus_max: Maximum execution time observed for StoreStatus operations.

=item *

pod/afsmon_stats.pod  view on Meta::CPAN

=item *

RemoveFile_ops_ok: Number of successful RemoveFile operations.

=item *

RemoveFile_sum: Sum of timings for RemoveFile operations.

=item *

RemoveFile_sqr: Sum of squares of sample timings for RemoveFile operations.

=item *

RemoveFile_min: Minimum execution time observed for RemoveFile operations.

=item *

RemoveFile_max: Maximum execution time observed for RemoveFile operations.

=item *

pod/afsmon_stats.pod  view on Meta::CPAN

=item *

CreateFile_ops_ok: Number of successful CreateFile operations.

=item *

CreateFile_sum: Sum of timings for CreateFile operations.

=item *

CreateFile_sqr: Sum of squares of sample timings for CreateFile operations.

=item *

CreateFile_min: Minimum execution time observed for CreateFile operations.

=item *

CreateFile_max: Maximum execution time observed for CreateFile operations.

=item *

pod/afsmon_stats.pod  view on Meta::CPAN

=item *

Rename_ops_ok: Number of successful Rename operations.

=item *

Rename_sum: Sum of timings for Rename operations.

=item *

Rename_sqr: Sum of squares of sample timings for Rename operations.

=item *

Rename_min: Minimum execution time observed for Rename operations.

=item *

Rename_max: Maximum execution time observed for Rename operations.

=item *

pod/afsmon_stats.pod  view on Meta::CPAN

=item *

Symlink_ops_ok: Number of successful Symlink operations.

=item *

Symlink_sum: Sum of timings for Symlink operations.

=item *

Symlink_sqr: Sum of squares of sample timings for Symlink operations.

=item *

Symlink_min: Minimum execution time observed for Symlink operations.

=item *

Symlink_max: Maximum execution time observed for Symlink operations.

=item *

pod/afsmon_stats.pod  view on Meta::CPAN

=item *

Link_ops_ok: Number of successful Link operations.

=item *

Link_sum: Sum of timings for Link operations.

=item *

Link_sqr: Sum of squares of sample timings for Link operations.

=item *

Link_min: Minimum execution time observed for Link operations.

=item *

Link_max: Maximum execution time observed for Link operations.

=item *

pod/afsmon_stats.pod  view on Meta::CPAN

=item *

MakeDir_ops_ok: Number of successful MakeDir operations.

=item *

MakeDir_sum: Sum of timings for MakeDir operations.

=item *

MakeDir_sqr: Sum of squares of sample timings for MakeDir operations.

=item *

MakeDir_min: Minimum execution time observed for MakeDir operations.

=item *

MakeDir_max: Maximum execution time observed for MakeDir operations.

=item *

pod/afsmon_stats.pod  view on Meta::CPAN

=item *

RemoveDir_ops_ok: Number of successful RemoveDir operations.

=item *

RemoveDir_sum: Sum of timings for RemoveDir operations.

=item *

RemoveDir_sqr: Sum of squares of sample timings for RemoveDir operations.

=item *

RemoveDir_min: Minimum execution time observed for RemoveDir operations.

=item *

RemoveDir_max: Maximum execution time observed for RemoveDir operations.

=item *

pod/afsmon_stats.pod  view on Meta::CPAN

=item *

SetLock_ops_ok: Number of successful SetLock operations.

=item *

SetLock_sum: Sum of timings for SetLock operations.

=item *

SetLock_sqr: Sum of squares of sample timings for SetLock operations.

=item *

SetLock_min: Minimum execution time observed for SetLock operations.

=item *

SetLock_max: Maximum execution time observed for SetLock operations.

=item *

pod/afsmon_stats.pod  view on Meta::CPAN

=item *

ExtendLock_ops_ok: Number of successful ExtendLock operations.

=item *

ExtendLock_sum: Sum of timings for ExtendLock operations.

=item *

ExtendLock_sqr: Sum of squares of sample timings for ExtendLock operations.

=item *

ExtendLock_min: Minimum execution time observed for ExtendLock operations.

=item *

ExtendLock_max: Maximum execution time observed for ExtendLock operations.

=item *

pod/afsmon_stats.pod  view on Meta::CPAN

=item *

ReleaseLock_ops_ok: Number of successful ReleaseLock operations.

=item *

ReleaseLock_sum: Sum of timings for ReleaseLock operations.

=item *

ReleaseLock_sqr: Sum of squares of sample timings for StoreStatus operations.

=item *

ReleaseLock_min: Minimum execution time observed for ReleaseLock operations.

=item *

ReleaseLock_max: Maximum execution time observed for ReleaseLock operations.

=item *

pod/afsmon_stats.pod  view on Meta::CPAN

=item *

GetStatistics_ops_ok: Number of successful GetStatistics operations.

=item *

GetStatistics_sum: Sum of timings for GetStatistics operations.

=item *

GetStatistics_sqr: Sum of squares of sample timings for GetStatistics operations.

=item *

GetStatistics_min: Minimum execution time observed for GetStatistics operations.

=item *

GetStatistics_max: Maximum execution time observed for GetStatistics operations.

=item *

pod/afsmon_stats.pod  view on Meta::CPAN

=item *

GiveUpCallbacks_ops_ok: Number of successful GiveUpCallbacks operations.

=item *

GiveUpCallbacks_sum: Sum of timings for GiveUpCallbacks operations.

=item *

GiveUpCallbacks_sqr: Sum of squares of sample timings for GiveUpCallbacks operations.

=item *

GiveUpCallbacks_min: Minimum execution time observed for GiveUpCallbacks operations.

=item *

GiveUpCallbacks_max: Maximum execution time observed for GiveUpCallbacks operations.

=item *

pod/afsmon_stats.pod  view on Meta::CPAN

=item *

GetVolumeInfo_ops_ok: Number of successful GetVolumeInfo operations.

=item *

GetVolumeInfo_sum: Sum of timings for GetVolumeInfo operations.

=item *

GetVolumeInfo_sqr: Sum of squares of sample timings for GetVolumeInfo operations.

=item *

GetVolumeInfo_min: Minimum execution time observed for GetVolumeInfo operations.

=item *

GetVolumeInfo_max: Maximum execution time observed for GetVolumeInfo operations.

=item *

pod/afsmon_stats.pod  view on Meta::CPAN

=item *

GetVolumeStatus_ops_ok: Number of successful GetVolumeStatus operations.

=item *

GetVolumeStatus_sum: Sum of timings for GetVolumeStatus operations.

=item *

GetVolumeStatus_sqr: Sum of squares of sample timings for GetVolumeStatus operations.

=item *

GetVolumeStatus_min: Minimum execution time observed for GetVolumeStatus operations.

=item *

GetVolumeStatus_max: Maximum execution time observed for GetVolumeStatus operations.

=item *

pod/afsmon_stats.pod  view on Meta::CPAN

=item *

SetVolumeStatus_ops_ok: Number of successful SetVolumeStatus operations.

=item *

SetVolumeStatus_sum: Sum of timings for SetVolumeStatus operations.

=item *

SetVolumeStatus_sqr: Sum of squares of sample timings for SetVolumeStatus operations.

=item *

SetVolumeStatus_min: Minimum execution time observed for SetVolumeStatus operations.

=item *

SetVolumeStatus_max: Maximum execution time observed for SetVolumeStatus operations.

=item *

pod/afsmon_stats.pod  view on Meta::CPAN

=item *

GetRootVolume_ops_ok: Number of successful GetRootVolume operations.

=item *

GetRootVolume_sum: Sum of timings for GetRootVolume operations.

=item *

GetRootVolume_sqr: Sum of squares of sample timings for GetRootVolume operations.

=item *

GetRootVolume_min: Minimum execution time observed for GetRootVolume operations.

=item *

GetRootVolume_max: Maximum execution time observed for GetRootVolume operations.

=item *

pod/afsmon_stats.pod  view on Meta::CPAN

=item *

CheckToken_ops_ok: Number of successful CheckToken operations.

=item *

CheckToken_sum: Sum of timings for CheckToken operations.

=item *

CheckToken_sqr: Sum of squares of sample timings for CheckToken operations.

=item *

CheckToken_min: Minimum execution time observed for CheckToken operations.

=item *

CheckToken_max: Maximum execution time observed for CheckToken operations.

=item *

pod/afsmon_stats.pod  view on Meta::CPAN

=item *

GetTime_ops_ok: Number of successful GetTime operations.

=item *

GetTime_sum: Sum of timings for GetTime operations.

=item *

GetTime_sqr: Sum of squares of sample timings for GetTime operations.

=item *

GetTime_min: Minimum execution time observed for GetTime operations.

=item *

GetTime_max: Maximum execution time observed for GetTime operations.

=item *

pod/afsmon_stats.pod  view on Meta::CPAN

=item *

NGetVolumeInfo_ops_ok: Number of successful NGetVolumeInfo operations.

=item *

NGetVolumeInfo_sum: Sum of timings for NGetVolumeInfo operations.

=item *

NGetVolumeInfo_sqr: Sum of squares of sample timings for NGetVolumeInfo operations.

=item *

NGetVolumeInfo_min: Minimum execution time observed for NGetVolumeInfo operations.

=item *

NGetVolumeInfo_max: Maximum execution time observed for NGetVolumeInfo operations.

=item *

pod/afsmon_stats.pod  view on Meta::CPAN

=item *

BulkStatus_ops_ok: Number of successful BulkStatus operations.

=item *

BulkStatus_sum: Sum of timings for BulkStatus operations.

=item *

BulkStatus_sqr: Sum of squares of sample timings for BulkStatus operations.

=item *

BulkStatus_min: Minimum execution time observed for BulkStatus operations.

=item *

BulkStatus_max: Maximum execution time observed for BulkStatus operations.

=item *

pod/afsmon_stats.pod  view on Meta::CPAN

=item *

XStatsVersion_ops_ok: Number of successful XStatsVersion operations.

=item *

XStatsVersion_sum: Sum of timings for XStatsVersion operations.

=item *

XStatsVersion_sqr: Sum of squares of sample timings for XStatsVersion operations.

=item *

XStatsVersion_min: Minimum execution time observed for XStatsVersion operations.

=item *

XStatsVersion_max: Maximum execution time observed for XStatsVersion operations.

=item *

pod/afsmon_stats.pod  view on Meta::CPAN

=item *

GetXStats_ops_ok: Number of successful GetXStats operations.

=item *

GetXStats_sum: Sum of timings for GetXStats operations.

=item *

GetXstats_sqr: Sum of squares of sample timings for GetXStats operations.

=item *

GetXStats_min: Minimum execution time observed for GetXStats operations.

=item *

GetXStats_max: Maximum execution time observed for GetXStats operations.

=back

pod/afsmon_stats.pod  view on Meta::CPAN

=item *

FetchData_xfers_ok: Number of successful FetchData operations.

=item *

FetchData_xfers_sum: Sum of timing values for FetchData operations.

=item *

FetchData_xfers_sqr: Sum of squares of sample timings for FetchData operations.

=item *

FetchData_xfers_min: Minimum transfer time observed for FetchData operations.

=item *

FetchData_xfers_max: Maximum transfer time observed for FetchData operations.

=item *

pod/afsmon_stats.pod  view on Meta::CPAN

=item *

StoreData_xfers_ok: Number of successful StoreData operations.

=item *

StoreData_xfers_sum: Sum of timing values for StoreData operations.

=item *

StoreData_xfers_sqr: Sum of squares of sample timings for StoreData operations.

=item *

StoreData_xfers_min: Minimum transfer time observed for StoreData operations.

=item *

StoreData_xfers_max: Maximum transfer time observed for StoreData operations.

=item *

pod/afsmon_stats.pod  view on Meta::CPAN

=item *

CallBack_ops_ok: Number of successful CallBack operations.

=item *

CallBack_ops_sum: Sum of timings for CallBack operations.

=item *

CallBack_ops_sqr: Sum of squares of sample timings for CallBack operations.

=item *

CallBack_ops_min: Minimum execution time observed for CallBack operations.

=item *

CallBack_ops_max: Maximum execution time observed for CallBack operations.

=item *

pod/afsmon_stats.pod  view on Meta::CPAN

=item *

InitCallBackState_ops_ok: Number of successful InitCallBackState operations.

=item *

InitCallBackState_ops_sum: Sum of timings for InitCallBackState operations.

=item *

InitCallBackState_ops_sqr: Sum of squares of sample timings for InitCallBackState operations.

=item *

InitCallBackState_ops_min: Minimum execution time observed for InitCallBackState operations.

=item *

InitCallBackState_ops_max: Maximum execution time observed for InitCallBackState operations.

=item *

pod/afsmon_stats.pod  view on Meta::CPAN

=item *

Probe_ops_ok: Number of successful Probe operations.

=item *

Probe_ops_sum: Sum of timings for Probe operations.

=item *

Probe_ops_sqr: Sum of squares of sample timings for Probe operations.

=item *

Probe_ops_min: Minimum execution time observed for Probe operations.

=item *

Probe_ops_max: Maximum execution time observed for Probe operations.

=item *

pod/afsmon_stats.pod  view on Meta::CPAN

=item *

GetLock_ops_ok: Number of successful GetLock operations.

=item *

GetLock_ops_sum: Sum of timings for GetLock operations.

=item *

GetLock_ops_sqr: Sum of squares of sample timings for GetLock operations.

=item *

GetLock_ops_min: Minimum execution time observed for GetLock operations.

=item *

GetLock_ops_max: Maximum execution time observed for GetLock operations.

=item *

pod/afsmon_stats.pod  view on Meta::CPAN

=item *

GetCE_ops_ok: Number of successful GetCE operations.

=item *

GetCE_ops_sum: Sum of timings for GetCE operations.

=item *

GetCE_ops_sqr: Sum of squares of sample timings for GetCE operations.

=item *

GetCE_ops_min: Minimum execution time observed for GetCE operations.

=item *

GetCE_ops_max: Maximum execution time observed for GetCE operations.

=item *

pod/afsmon_stats.pod  view on Meta::CPAN

=item *

XStatsVersion_CM_ops_ok: Number of successful XStatsVersion operations.

=item *

XStatsVersion_CM_ops_sum: Sum of timings for XStatsVersion operations.

=item *

XStatsVersion_CM_ops_sqr: Sum of squares of sample timings for XStatsVersion operations.

=item *

XStatsVersion_CM_ops_min: Minimum execution time observed for XStatsVersion operations.

=item *

XStatsVersion_CM_ops_max: Maximum execution time observed for XStatsVersion operations.

=item *

pod/afsmon_stats.pod  view on Meta::CPAN

=item *

GetXStats_CM_ops_ok: Number of successful GetXStats operations.

=item *

GetXStats_CM_ops_sum: Sum of timings for GetXStats operations.

=item *

GetXStats_CM_ops_sqr: Sum of squares of sample timings for GetXStats operations.

=item *

GetXStats_CM_ops_min: Minimum execution time observed for GetXStats operations.

=item *

GetXStats_CM_ops_max: Maximum execution time observed for GetXStats operations.

=back

pod/afsmon_stats.pod  view on Meta::CPAN

=item *

curr_LongestChain: Length of longest current hash chain.

=item *

PAGCreations: Number of PAG creations.

=item *

TicketUpdates: Number of ticket additions/refreshes.

=item *

HWM_PAGS: High water mark - number of PAGs.

=item *

HWM_Records: High water mark - number of records.

=item *

pod/afsmon_stats.pod  view on Meta::CPAN

=item *

rx_socketGreedy: Did SO_GREEDY succeed?

=item *

rx_bogusPacketOnRead: Short packets received.

=item *

rx_bogusHost: Host address from bogus packets.

=item *

rx_noPacketOnRead: Read packets with no packet there.

=item *

rx_noPacketBuffersOnRead: Packets dropped due to buffer shortage.

=item *

pod/afsmon_stats.pod  view on Meta::CPAN

=item *

rx_nServerConns: Total server connections.

=item *

rx_nClientConns: Total client connections.

=item *

rx_nPeerStructs: Total peer structures.

=item *

rx_nCallStructs: Total call structures.

=item *

rx_nFreeCallStructs: Total free call structures.

=back

Host Module Fields Group (HostModule_group)

=over

=item *

host_NumHostEntries: Number of host entries.

pod/afsmon_stats.pod  view on Meta::CPAN

=item *

FetchData_ops_ok: Number of successful FetchData operations.

=item *

FetchData_sum: Sum of timings for FetchData operations.

=item *

FetchData_sqr: Sum of squares of sample timings for FetchData operations.

=item *

FetchData_min: Minimum execution time observed for FetchData operations.

=item *

FetchData_max: Maximum execution time observed for FetchData operations.

=item *

pod/afsmon_stats.pod  view on Meta::CPAN

=item *

FetchACL_ops_ok: Number of successful FetchACL operations.

=item *

FetchACL_sum: Sum of timings for FetchACL operations.

=item *

FetchACL_sqr: Sum of squares of sample timings for FetchACL operations.

=item *

FetchACL_min: Minimum execution time observed for FetchACL operations.

=item *

FetchACL_max: Maximum execution time observed for FetchACL operations.

=item *

pod/afsmon_stats.pod  view on Meta::CPAN

=item *

FetchStatus_ops_ok: Number of successful FetchStatus operations.

=item *

FetchStatus_sum: Sum of timings for FetchStatus operations.

=item *

FetchStatus_sqr: Sum of squares of sample timings for FetchStatus operations.

=item *

FetchStatus_min: Minimum execution time observed for FetchStatus operations.

=item *

FetchStatus_max: Maximum execution time observed for FetchStatus operations.

=item *

pod/afsmon_stats.pod  view on Meta::CPAN

=item *

StoreData_ops_ok: Number of successful StoreData operations.

=item *

StoreData_sum: Sum of timings for StoreData operations.

=item *

StoreData_sqr: Sum of squares of sample timings for StoreData operations.

=item *

StoreData_min: Minimum execution time observed for StoreData operations.

=item *

StoreData_max: Maximum execution time observed for StoreData operations.

=item *

pod/afsmon_stats.pod  view on Meta::CPAN

=item *

StoreACL_ops_ok: Number of successful StoreACL operations.

=item *

StoreACL_sum: Sum of timings for StoreACL operations.

=item *

StoreACL_sqr: Sum of squares of sample timings for StoreACL operations.

=item *

StoreACL_min: Minimum execution time observed for StoreACL operations.

=item *

StoreACL_max: Maximum execution time observed for StoreACL operations.

=item *

pod/afsmon_stats.pod  view on Meta::CPAN

=item *

StoreStatus_ops_ok: Number of successful StoreStatus operations.

=item *

StoreStatus_sum: Sum of timings for StoreStatus operations.

=item *

StoreStatus_sqr: Sum of squares of sample timings for StoreStatus operations.

=item *

StoreStatus_min: Minimum execution time observed for StoreStatus operations.

=item *

StoreStatus_max: Maximum execution time observed for StoreStatus operations.

=item *

pod/afsmon_stats.pod  view on Meta::CPAN

=item *

RemoveFile_ops_ok: Number of successful RemoveFile operations.

=item *

RemoveFile_sum: Sum of timings for RemoveFile operations.

=item *

RemoveFile_sqr: Sum of squares of sample timings for RemoveFile operations.

=item *

RemoveFile_min: Minimum execution time observed for RemoveFile operations.

=item *

RemoveFile_max: Maximum execution time observed for RemoveFile operations.

=item *

pod/afsmon_stats.pod  view on Meta::CPAN

=item *

CreateFile_ops_ok: Number of successful CreateFile operations.

=item *

CreateFile_sum: Sum of timings for CreateFile operations.

=item *

CreateFile_sqr: Sum of squares of sample timings for CreateFile operations.

=item *

CreateFile_min: Minimum execution time observed for CreateFile operations.

=item *

CreateFile_max: Maximum execution time observed for CreateFile operations.

=item *

pod/afsmon_stats.pod  view on Meta::CPAN

=item *

Rename_ops_ok: Number of successful Rename operations.

=item *

Rename_sum: Sum of timings for Rename operations.

=item *

Rename_sqr: Sum of squares of sample timings for Rename operations.

=item *

Rename_min: Minimum execution time observed for Rename operations.

=item *

Rename_max: Maximum execution time observed for Rename operations.

=item *

pod/afsmon_stats.pod  view on Meta::CPAN

=item *

Symlink_ops_ok: Number of successful Symlink operations.

=item *

Symlink_sum: Sum of timings for Symlink operations.

=item *

Symlink_sqr: Sum of squares of sample timings for Symlink operations.

=item *

Symlink_min: Minimum execution time observed for Symlink operations.

=item *

Symlink_max: Maximum execution time observed for Symlink operations.

=item *

pod/afsmon_stats.pod  view on Meta::CPAN

=item *

Link_ops_ok: Number of successful Link operations.

=item *

Link_sum: Sum of timings for Link operations.

=item *

Link_sqr: Sum of squares of sample timings for Link operations.

=item *

Link_min: Minimum execution time observed for Link operations.

=item *

Link_max: Maximum execution time observed for Link operations.

=item *

pod/afsmon_stats.pod  view on Meta::CPAN

=item *

MakeDir_ops_ok: Number of successful MakeDir operations.

=item *

MakeDir_sum: Sum of timings for MakeDir operations.

=item *

MakeDir_sqr: Sum of squares of sample timings for MakeDir operations.

=item *

MakeDir_min: Minimum execution time observed for MakeDir operations.

=item *

MakeDir_max: Maximum execution time observed for MakeDir operations.

=item *

pod/afsmon_stats.pod  view on Meta::CPAN

=item *

RemoveDir_ops_ok: Number of successful RemoveDir operations.

=item *

RemoveDir_sum: Sum of timings for RemoveDir operations.

=item *

RemoveDir_sqr: Sum of squares of sample timings for RemoveDir operations.

=item *

RemoveDir_min: Minimum execution time observed for RemoveDir operations.

=item *

RemoveDir_max: Maximum execution time observed for RemoveDir operations.

=item *

pod/afsmon_stats.pod  view on Meta::CPAN

=item *

SetLock_ops_ok: Number of successful SetLock operations.

=item *

SetLock_sum: Sum of timings for SetLock operations.

=item *

SetLock_sqr: Sum of squares of sample timings for SetLock operations.

=item *

SetLock_min: Minimum execution time observed for SetLock operations.

=item *

SetLock_max: Maximum execution time observed for SetLock operations.

=item *

pod/afsmon_stats.pod  view on Meta::CPAN

=item *

ExtendLock_ops_ok: Number of successful ExtendLock operations.

=item *

ExtendLock_sum: Sum of timings for ExtendLock operations.

=item *

ExtendLock_sqr: Sum of squares of sample timings for ExtendLock operations.

=item *

ExtendLock_min: Minimum execution time observed for ExtendLock operations.

=item *

ExtendLock_max: Maximum execution time observed for ExtendLock operations.

=item *

pod/afsmon_stats.pod  view on Meta::CPAN

=item *

ReleaseLock_ops_ok: Number of successful ReleaseLock operations.

=item *

ReleaseLock_sum: Sum of timings for ReleaseLock operations.

=item *

ReleaseLock_sqr: Sum of squares of sample timings for ReleaseLock operations.

=item *

ReleaseLock_min: Minimum execution time observed for ReleaseLock operations.

=item *

ReleaseLock_max: Maximum execution time observed for ReleaseLock operations.

=item *

pod/afsmon_stats.pod  view on Meta::CPAN

=item *

GetStatistics_ops_ok: Number of successful GetStatistics operations.

=item *

GetStatistics_sum: Sum of timings for GetStatistics operations.

=item *

GetStatistics_sqr: Sum of squares of sample timings for GetStatistics operations.

=item *

GetStatistics_min: Minimum execution time observed for GetStatistics operations.

=item *

GetStatistics_max: Maximum execution time observed for GetStatistics operations.

=item *

pod/afsmon_stats.pod  view on Meta::CPAN

=item *

GiveUpCallbacks_ops_ok: Number of successful GiveUpCallbacks operations.

=item *

GiveUpCallbacks_sum: Sum of timings for GiveUpCallbacks operations.

=item *

GiveUpCallbacks_sqr: Sum of squares of sample timings for GiveUpCallbacks operations.

=item *

GiveUpCallbacks_min: Minimum execution time observed for GiveUpCallbacks operations.

=item *

GiveUpCallbacks_max: Maximum execution time observed for GiveUpCallbacks operations.

=item *

pod/afsmon_stats.pod  view on Meta::CPAN

=item *

GetVolumeInfo_ops_ok: Number of successful GetVolumeInfo operations.

=item *

GetVolumeInfo_sum: Sum of timings for GetVolumeInfo operations.

=item *

GetVolumeInfo_sqr: Sum of squares of sample timings for GetVolumeInfo operations.

=item *

GetVolumeInfo_min: Minimum execution time observed for GetVolumeInfo operations.

=item *

GetVolumeInfo_max: Maximum execution time observed for GetVolumeInfo operations.

=item *

pod/afsmon_stats.pod  view on Meta::CPAN

=item *

GetVolumeStatus_ops_ok: Number of successful GetVolumeStatus operations.

=item *

GetVolumeStatus_sum: Sum of timings for GetVolumeStatus operations.

=item *

GetVolumeStatus_sqr: Sum of squares of sample timings for GetVolumeStatus operations.

=item *

GetVolumeStatus_min: Minimum execution time observed for GetVolumeStatus operations.

=item *

GetVolumeStatus_max: Maximum execution time observed for GetVolumeStatus operations.

=item *

pod/afsmon_stats.pod  view on Meta::CPAN

=item *

SetVolumeStatus_ops_ok: Number of successful SetVolumeStatus operations.

=item *

SetVolumeStatus_sum: Sum of timings for SetVolumeStatus operations.

=item *

SetVolumeStatus_sqr: Sum of squares of sample timings for SetVolumeStatus operations.

=item *

SetVolumeStatus_min: Minimum execution time observed for SetVolumeStatus operations.

=item *

SetVolumeStatus_max: Maximum execution time observed for SetVolumeStatus operations.

=item *

pod/afsmon_stats.pod  view on Meta::CPAN

=item *

GetRootVolume_ops_ok: Number of successful GetRootVolume operations.

=item *

GetRootVolume_sum: Sum of timings for GetRootVolume operations.

=item *

GetRootVolume_sqr: Sum of squares of sample timings for GetRootVolume operations.

=item *

GetRootVolume_min: Minimum execution time observed for GetRootVolume operations.

=item *

GetRootVolume_max: Maximum execution time observed for GetRootVolume operations.

=item *

pod/afsmon_stats.pod  view on Meta::CPAN

=item *

CheckToken_ops_ok: Number of successful CheckToken operations.

=item *

CheckToken_sum: Sum of timings for CheckToken operations.

=item *

CheckToken_sqr: Sum of squares of sample timings for CheckToken operations.

=item *

CheckToken_min: Minimum execution time observed for CheckToken operations.

=item *

CheckToken_max: Maximum execution time observed for CheckToken operations.

=item *

pod/afsmon_stats.pod  view on Meta::CPAN

=item *

GetTime_ops_ok: Number of successful GetTime operations.

=item *

GetTime_sum: Sum of timings for GetTime operations.

=item *

GetTime_sqr: Sum of squares of sample timings for GetTime operations.

=item *

GetTime_min: Minimum execution time observed for GetTime operations.

=item *

GetTime_max: Maximum execution time observed for GetTime operations.

=item *

pod/afsmon_stats.pod  view on Meta::CPAN

=item *

NGetVolumeInfo_ops_ok: Number of successful NGetVolumeInfo operations.

=item *

NGetVolumeInfo_sum: Sum of timings for NGetVolumeInfo operations.

=item *

NGetVolumeInfo_sqr: Sum of squares of sample timings for NGetVolumeInfo operations.

=item *

NGetVolumeInfo_min: Minimum execution time observed for NGetVolumeInfo operations.

=item *

NGetVolumeInfo_max: Maximum execution time observed for NGetVolumeInfo operations.

=item *

pod/afsmon_stats.pod  view on Meta::CPAN

=item *

BulkStatus_ops_ok: Number of successful BulkStatus operations.

=item *

BulkStatus_sum: Sum of timings for BulkStatus operations.

=item *

BulkStatus_sqr: Sum of squares of sample timings for BulkStatus operations.

=item *

BulkStatus_min: Minimum execution time observed for BulkStatus operations.

=item *

BulkStatus_max: Maximum execution time observed for BulkStatus operations.

=item *

pod/afsmon_stats.pod  view on Meta::CPAN

=item *

XStatsVersion_ops_ok: Number of successful XStatsVersion operations.

=item *

XStatsVersion_sum: Sum of timings for XStatsVersion operations.

=item *

XStatsVersion_sqr: Sum of squares of sample timings for XStatsVersion operations.

=item *

XStatsVersion_min: Minimum execution time observed for XStatsVersion operations.

=item *

XStatsVersion_max: Maximum execution time observed for XStatsVersion operations.

=item *

pod/afsmon_stats.pod  view on Meta::CPAN

=item *

GetXStats_ops_ok: Number of successful GetXStats operations.

=item *

GetXStats_sum: Sum of timings for GetXStats operations.

=item *

GetXStats_sqr: Sum of squares of sample timings for GetXStats operations.

=item *

GetXStats_min: Minimum execution time observed for GetXStats operations.

=item *

GetXStats_max: Maximum execution time observed for GetXStats operations.

=back

pod/afsmon_stats.pod  view on Meta::CPAN

=item *

FetchData_xfers_ok: Number of successful FetchData operations.

=item *

FetchData_xfers_sum: Sum of timing values for FetchData operations.

=item *

FetchData_xfers_sqr: Sum of squares of sample timings for FetchData operations.

=item *

FetchData_xfers_min: Minimum transfer time observed for FetchData operations.

=item *

FetchData_xfers_max: Maximum transfer time observed for FetchData operations.

=item *

pod/afsmon_stats.pod  view on Meta::CPAN

=item *

StoreData_xfers_ok: Number of successful StoreData operations.

=item *

StoreData_xfers_sum: Sum of timing values for StoreData operations.

=item *

StoreData_xfers_sqr: Sum of squares of sample timings for StoreData operations.

=item *

StoreData_xfers_min: Minimum transfer time observed for StoreData operations.

=item *

StoreData_xfers_max: Maximum transfer time observed for StoreData operations.

=item *

pod/afsmon_stats.pod  view on Meta::CPAN

=item Elizabeth Cassell <e_a_c@mailsnare.net> and

=item Alf Wachsmann <alfw@slac.stanford.edu>

=back

=head1 COPYRIGHT AND DISCLAIMER

 Copyright 2004 Alf Wachsmann <alfw@slac.stanford.edu> and
                Elizabeth Cassell <e_a_c@mailsnare.net>
 All rights reserved.

 Most of the explanations in this document are taken from the original
 AFS documentation.

 AFS-3 Programmer's Reference:
 Volume Server/Volume Location Server Interface
 Edward R. Zayas
 (c) 1991 Transarc Corporation.
 All rights reserved.

 IBM AFS Administration Reference
 (c) IBM Corporation 2000.
 All rights reserved.

 This library is free software; you can redistribute it and/or modify it
 under the same terms as Perl itself.

pod/afsmonitor.pod  view on Meta::CPAN

      print "probe failed\n";
    }
  }

  ($fs, $cm) =
    afsmonitor(
           cmhosts  => ["hostName1", "hostName2"],
           fshosts  => ["hostName3", "hostName4", "hostName5"],
           cmshow   => ["PerfStats_section", "fs_oc_downDst_more_50"],
           fsshow   => ["VnodeCache_group", "FetchData_sqr"],
           fsthresh => [
                        { vcache_S_Entries => 10
                        },
                        { vcache_L_Allocs  => 30
                        },
                        { host => "hostName3",
                          vcache_L_Writes => 20,
                          handler => "HandlerScript arg1 arg2"
                        },
                        { host => "hostName5",
                          vcache_L_Writes => 40,
                        }
                       ],
           cmthresh => [
                        { host => "hostName1",
                          numPerfCalls => 80,
                          handler => "HandlerScript arg"
                        },
                        { fs_oc_downDst_more_50 => 90
                        },
                        { cacheNumEntries => 60,
                          handler => "HandlerScript"
                        },
                        { host => "hostName2",

pod/afsmonitor.pod  view on Meta::CPAN

The B<afsmonitor> function gathers statistics about specified File Server
and Cache Manager operations. It allows the issuer to monitor, from a
single location, a wide range of File Server and Cache Manager
operations on any number of machines in both local and foreign cells.

There are 271 available File Server statistics and 571 available Cache
Manager statistics, listed in the L<afsmon_stats(1)> documentation. By default,
the command displays all of the relevant statistics for the file server
machines named by the B<fshosts> argument and the client machines named
by the B<cmhosts> argument. To limit the display to only the statistics
of interest, list them in the configuration file specified by the
B<config> argument. In addition, use the configuration file for the
following purposes:

=over

=item *

To set threshold values for any statistic. The statistics with values exceeding
their thresholds are indicated in the returned data structure. There are no
default threshold values.

=item *

To specify a program or script to associate with a statistic when it exceeds its
threshold. The script and all of it's arguments will be included in the returned
data structure in a format easy to invoke from within a Perl script. The AFS
distribution does not include any such scripts.

=item *

To list the file server and client machines to gather statistics on, instead of
using the B<fshosts> and B<cmhosts> arguments.

=back

For a description of the configuration file, see the
L<"configuration file"|/"THE CONFIGURATION FILE"> section below.

=head1 OPTIONS

=over

=item B<config>

Names the configuration file which lists the machines to probe,
statistics to display, and threshold values, if any. A partial
pathname is interpreted relative to the current working directory.
Provide this argument if not providing the B<fshosts> argument or
B<cmhosts> argument. For instructions on creating this file, see the
L<"configuration file"|/"THE CONFIGURATION FILE"> section below.

=item B<output>

Names the file to which the B<afsmonitor> function writes all of the
statistics that it collects. By default, no output file is created.
See the L<"writing to an output file"|/"WRITING TO AN OUTPUT FILE">

pod/afsmonitor.pod  view on Meta::CPAN

=item B<detailed>

Formats the information in the output file named by B<output> argument in a
maximally readable format. Provide the B<output> argument along with this one.

=item B<fshosts>

String with one name or reference to an array with names of one or
more machines from which to gather File Server
statistics. For each machine, provide either a fully qualified
host name, or an unambiguous abbreviation (the ability to resolve
an abbreviation depends on the state of the cell's name service
at the time the command is issued). This argument can be combined
with the B<cmhosts> argument, but not with the B<config> argument.

=item B<cmhosts>

String with one name or reference to an array with names of one or
more machines from which to gather Cache Manager
statistics. For each machine, provide either a fully qualified
host name, or an unambiguous abbreviation (the ability to resolve
an abbreviation depends on the state of the cell's name service
at the time the command is issued). This argument can be combined
with the B<fshosts> argument, but not with the B<config> argument.

=item B<fsshow>

Reference to an array with the names of individual statistics, groups of
statistics, or sections of statistics to include in the File Servers (fs)
data structure. Use this only if not using a configuration file. The
L<afsmon_stats(1)> documentation specifies the group and section to which
each statistic belongs. By default, all of the statistics will be included.

=item B<cmshow>

Reference to an array with the names of individual statistics, groups of
statistics, or sections of statistics to include in the Cache Managers (cm)
data structure. Use thi sonly if not using a configuration file. The
L<afsmon_stats(1)> documentation specifies the group and section to which
each statistic belongs. By default, all of the statistics will be included.

=item B<fsthresh>

Reference to an array of hash references containing thresholds to set. Each
hash should contain a key that is the name of an individual File Server
statistic, with it's value being the desired threshold value for that
statistic. If it is a host-specific threshold, then the key B<host> should
be included, with a value corresponding to one of the File Server hosts
specified in the B<fshosts> argument. If a handler function is to be
associated with the threshold, the key B<handler>'s value should be the name
of the handler function and any arguments to be passed to the handler.

=item B<cmthresh>

Reference to an array of hash references containing thresholds to set. Each
hash should contain a key that is the name of an individual Cache Manager
statistic, with it's value being the desired threshold value for that
statistic. If it is a host-specific threshold, then the key B<host> should
be included, with a value corresponding to one of the Cache Manager hosts
specified in the B<cmhosts> argument. If a handler function is to be
associated with the threshold, the key B<handler>'s value should be the name
of the handler function and any arguments to be passed to the handler.

=back

=head1 OUTPUT

The return values are references to two arrays, one for file
servers and one for cache managers. Each entry in each array
is a reference to a hash containing information about one of
the hosts specified either by the fshosts or cmhosts options,
or in the config file. Each hash in these arrays contains the
following entries:

=over

=item B<hostName>

The name of the host that these statistics represent.

=item B<probeOK>

1 if the statistics were gathered successfully, 0 if the probe failed and no statistics were gathered.

=item B<section_names>

The rest of the keys are the names of sections of statistics (specified in the
L<afsmon_stats(1)> documentation).
Each section entry points to another hash containing entries for each group of
statistics (with keys corresponding to the group name) within that section.
Each group entry points to another hash containing entries for all of the
individual statistics (with keys corresponding to the name of the statistic)
within that group.
The individual statistics also point to hashes, containing up to three entries:

=over

=item B<value>

The value of the statistic for this host.

=item B<overflow>

This key will be present if the value has exceeded a threshold provided in the configuration file.
If a command to execute was specified for this threshold, this entry will contain a string with
the name of the command and all of the parameters that should be passed to the command.
If no command to execute was specified, the value of this entry will be 1.

=item B<threshold>

If this value has exceeded a threshold, this entry will contain the threshold value.
The threshold key will not exist in the hash if no threshold was specified, or if the
specified threshold was not exceeded.

=back

If a config file with "show" directives was given, then only the statistics specified
in the config file will be included, and any groups or sections that were not specified
by a "show" statement and in which no individual statistics were specified by a "show"
statement will not be included.

=back

For examples of accessing the information in the returned data structures
and printing it in a readable format, refer to the B<afsmonitor> script
in the B<examples> directory.

=head1 WRITING TO AN OUTPUT FILE

Include the B<output> argument to name the file into which the
B<afsmonitor> function writes all of the statistics it collects.

The output file is in ASCII format and records the same
information as is returned in the File Server and Cache Manager
data structures. The output file has the following format:

   time  host_name  CM|FS   list_of_measured_values

and specifies the time at which the list_of_measured_values were
gathered from the Cache Manager (CM) or File Server (FS) process
housed on host_name. On those occasion where probes fail, the
value -1 is reported instead of the list_of_measured_values.

If the administrator usually reviews the output file manually,
rather than using it as input to an automated analysis program or

pod/afsmonitor.pod  view on Meta::CPAN


=item *

The statistics to display. By default, the display includes 271
statistics for File Servers and 571 statistics for Cache Managers.
For information on the available statistics, see the L<afsmon_stats(1)>
documentation.

=item *

The threshold values to set for statistics and a script or program
to associate with the statistic if a threshold is exceeded. By
default, no threshold values are defined.

=back

The following list describes the instructions that can appear
in the configuration file:

=over

=item B<cm I<host_name>>

Names a client machine for which to display statistics.

=item B<fs I<host_name>>

Names a file server machine for which to display statistics.

=item B<thresh fs | cm I<field_name> I<thresh_val> [cmd_to_execute] [arg1] ... [argn]>

Assigns the threshold value thresh_val to the statistic field_name,
for either a File Server statistic (fs) or a Cache Manager statistic
(cm). The optional cmd_to_execute field names a binary or script to
associate with the statistic if the value of the statistic exceeds
thresh_val. The optional arg1 through argn fields are additional values
that the B<afsmonitor> function adds as arguments for the cmd_to_execute
command. If any of them include one or more spaces, enclose the
entire field in double quotes.

If a statistic exceeds its threshold and there is a cmd_to_execute
associated with it, afsmonitor will provide a string which can be
used to easily execute the cmd_to_execute from within perl with the
following parameters:

cmd_to_execute I<host_name> fs|cm I<field_name threshold_val actual_val> [E<lt>arg1E<gt>] . . . [E<lt>argnE<gt>]

The parameters cmd_to_execute, fs, cm, field_name, threshold_val,
and arg1 through argn correspond to the values with the same name
on the thresh line. The host_name parameter identifies the file
server or client machine where the statistic has exceeded the
threshold, and the actual_val parameter is the actual value of
field_name that equals or exceeds the threshold value.

Use the thresh line to set either a global threshold, which applies
to all file server machines listed on fs lines or client machines
listed on cm lines in the configuration file, or a machine-specific
threshold, which applies to only one file server or client machine.
To set a global threshold, place the thresh line before any of the
fs or cm lines in the file. To set a machine-specific threshold,
place the thresh line below the corresponding fs or cm line, and
above any other fs or cm lines. A machine-specific threshold value
always overrides the corresponding global threshold, if set. Do not
place a thresh fs line directly after a cm line or a thresh cm line
directly after a fs line.

=item B<show fs | cm I<field/group/section>>

Specifies which individual statistic, group of statistics, or
section of statistics to include in the File Servers (fs) and/or
Cache Managers (cm) data structure. The L<afsmon_stats(1)> documentation
specifies the group and section to which each statistic belongs.
Include as many show lines as necessary to customize the results
as desired, and place them anywhere in the file.

If there are no show lines in the configuration file, then all
statistics for both Cache Managers and File Servers will be
included. Similarly, if there are no show fs lines, then the File
Servers data structure will contain all file server statistics,
or if there are no show cm lines, then the Cache Managers data
structure will display all client statistics.

=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

pod/afsmonitor.pod  view on Meta::CPAN


=item Alf Wachsmann <alfw@slac.stanford.edu>

=back

=head1 COPYRIGHT AND DISCLAIMER

 Copyright 2004-2006
		Alf Wachsmann <alfw@slac.stanford.edu> and
                Elizabeth Cassell <e_a_c@mailsnare.net>
 All rights reserved.

 Most of the explanations in this document are taken from the original
 AFS documentation.

 AFS-3 Programmer's Reference:
 Volume Server/Volume Location Server Interface
 Edward R. Zayas
 (c) 1991 Transarc Corporation.
 All rights reserved.

 IBM AFS Administration Reference
 (c) IBM Corporation 2000.
 All rights reserved.

 This library is free software; you can redistribute it and/or modify it
 under the same terms as Perl itself.

pod/cmdebug.pod  view on Meta::CPAN

As a first step in diagnosing a problem, run B<cmdebug> without the
B<long> switch. A machine running in a normal state (i.e. not
experiencing any problems), may display some locks set, but these
locks should not be continually set over multiple B<cmdebug>s. If the
functions returns with no output, it simply means there is nothing
to report.

=head1 OUTPUT

The return values are references to two arrays.
Each entry in the first array represents the status of the cache manager's data
structures. Each entry in the second array represents an individual cache entry.

=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

=over

=item Elizabeth Cassell <e_a_c@mailsnare.net> and

=item Alf Wachsmann <alfw@slac.stanford.edu>

=back

=head1 COPYRIGHT AND DISCLAIMER

 Copyright 2004 Alf Wachsmann <alfw@slac.stanford.edu> and
                Elizabeth Cassell <e_a_c@mailsnare.net>
 All rights reserved.

 Most of the explanations in this document are taken from the original
 AFS documentation.

 AFS-3 Programmer's Reference:
 Volume Server/Volume Location Server Interface
 Edward R. Zayas
 (c) 1991 Transarc Corporation.
 All rights reserved.

 IBM AFS Administration Reference
 (c) IBM Corporation 2000.
 All rights reserved.

 This library is free software; you can redistribute it and/or modify it
 under the same terms as Perl itself.

pod/rxdebug.pod  view on Meta::CPAN


B<rxdebug> - Provides debugging trace of Rx activity

=head1 SYNOPSIS

  use AFS::Monitor qw(rxdebug);

  my $rxd = rxdebug(version => 1,
                    servers => 'hostname',
                   );
  print "AFS build level of $rxd->{address} port $rxd->{port} is:";
  print $rxd->{version};

  $rxd = rxdebug(rxstats => 1,
                 noconns => 1,
                 servers => 'hostname',
                 port    => 7001,
                );

  $rxd = rxdebug(noconns  => 1,
                 peers    => 1,

pod/rxdebug.pod  view on Meta::CPAN

process (as specified with the B<port> argument) on the
machine and one or more processes on other machines.

=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:

=over

pod/rxdebug.pod  view on Meta::CPAN

=head1 OUTPUT

The return value is a reference to a hash containing the
requested information. The keys that the hash may contain, along
with a short description of their values, are listed below:

=over

=item *

C<address>: the IP address of the machine given by the B<servers> argument.

=item *

C<port>: the port used.

=item *

C<version>: a description of the AFS build level.

=item *

pod/rxdebug.pod  view on Meta::CPAN

C<dallyCounter>: the number of dallying connections skipped.

=item *

C<peers>: a reference to an array of hash references containing information about each peer.

=back

The simplest case would be if the version flag was set.
The hash table would have only three keys in it:
C<address>, C<port>, and C<version>.

For more details about the contents of the returned hash reference,
and an example of printing its entire contents in a readable format,
refer to the B<rxdebug> script in the B<examples> directory.


=head1 AUTHORS

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

pod/rxdebug.pod  view on Meta::CPAN

=item Elizabeth Cassell <e_a_c@mailsnare.net> and

=item Alf Wachsmann <alfw@slac.stanford.edu>

=back

=head1 COPYRIGHT AND DISCLAIMER

 Copyright 2004 Alf Wachsmann <alfw@slac.stanford.edu> and
                Elizabeth Cassell <e_a_c@mailsnare.net>
 All rights reserved.

 Most of the explanations in this document are taken from the original
 AFS documentation.

 AFS-3 Programmer's Reference:
 Volume Server/Volume Location Server Interface
 Edward R. Zayas
 (c) 1991 Transarc Corporation.
 All rights reserved.

 IBM AFS Administration Reference
 (c) IBM Corporation 2000.
 All rights reserved.

 This library is free software; you can redistribute it and/or modify it
 under the same terms as Perl itself.

pod/scout.pod  view on Meta::CPAN


=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
suffix from the distinguishing part of each file server machine name, but do
include any periods that occur within the suffix itself. For example, in the

pod/scout.pod  view on Meta::CPAN


Returns a reference to an array, with one element per host specified. Each
element in the array is a reference to a hash containing information about the
file server, as described below.

=over

=item B<hostName>

This hash entry contains the name of the file server that this array entry
represents.

=item B<probeOK>

The value of this entry will be 1 if the probe was successful, and 0 if the
probe failed and was unable to gather any statistics for this File Server
process.

=item B<stats>

The value of this entry will be a reference to a hash containing all of the

pod/scout.pod  view on Meta::CPAN


The number of RPC connections open between the File Server process and client
machines. This number equals or exceeds the number in the B<WorkStations>
entry (see below), because each user on the machine can have several separate
connections open at once, and one client machine can handle several users.

=item B<TotalFetchs>

The number of fetch-type RPCs (fetch data, fetch access list, and fetch
status) that client machines have made to the File Server process since the
latter started. This number is reset to zero each time the File Server process
restarts.

=item B<TotalStores>

The number of store-type RPCs (store data, store access list, and store
status) that client machines have made to the File Server process since the
latter started. This number is reset to zero each time the File Server process
restarts.

=item B<WorkStations>

The number of client machines (workstations) that have communicated with the
File Server process within the last 15 minutes. Such machines are termed
I<active>. This number is likely to be smaller than the number in the
B<CurrentConnections> entry because a single client machine can have several
connections open to one File Server.

=item B<Disk>

pod/scout.pod  view on Meta::CPAN

=item Elizabeth Cassell <e_a_c@mailsnare.net> and

=item Alf Wachsmann <alfw@slac.stanford.edu>

=back

=head1 COPYRIGHT AND DISCLAIMER

 Copyright 2004 Alf Wachsmann <alfw@slac.stanford.edu> and
                Elizabeth Cassell <e_a_c@mailsnare.net>
 All rights reserved.

 Most of the explanations in this document are taken from the original
 AFS documentation.

 AFS-3 Programmer's Reference:
 Volume Server/Volume Location Server Interface
 Edward R. Zayas
 (c) 1991 Transarc Corporation.
 All rights reserved.

 IBM AFS Administration Reference
 (c) IBM Corporation 2000.
 All rights reserved.

 This library is free software; you can redistribute it and/or modify it
 under the same terms as Perl itself.

pod/udebug.pod  view on Meta::CPAN

and the status of the connections between them.

=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:

=over

pod/udebug.pod  view on Meta::CPAN


=head1 OUTPUT

Returns a reference to a hash containing all of the collected data.
Below is a list of keys that the hash may contain:

=over

=item B<interfaceAddr>

A reference to an array containing the IP addresses that are
configured with the operating system on the machine specified
by the B<server> argument.

=item B<now>

The time according to the clock on the database server machine
specified by the B<server> argument, measured in seconds since the
Epoch (00:00:00 UTC, January 1, 1970). For correct Ubik operation,
the database server machine clocks must agree on the time.

pod/udebug.pod  view on Meta::CPAN

writing a change into the database. The entries B<epochTime> and B<tidCounter>
identify the transaction.

=item B<isClone>

True if the machine named by the B<server> argument is a clone, which can
never become sync site.

=item B<lowestHost> and B<syncHost>

The B<lowestHost> is the lowest IP address of any peer from which the
Ubik process has received a message recently, whereas the B<syncHost>
is the IP address of the current coordinator. If they differ, the machine
with the lowest IP address is not currently the coordinator. The Ubik
process continues voting for the current coordinator as long as they
remain in contact, which provides for maximum stability. However, in
the event of another coordinator election, this Ubik process votes for
the B<lowestHost> site instead (assuming they are in contact), because
it has a bias to vote in elections for the site with the lowest IP address.

=item B<lowestTime>

The time (in seconds since the Epoch) that the B<lowestHost> (see above) was set.

=item B<syncTime>

The time (in seconds since the Epoch) that the B<syncHost> (see above) was set.

=item B<syncVersion>

A reference to a hash containing two entries, B<epoch> and B<counter>,
indicating the version number of the database at the synchronization site,
which needs to match the version number of the local databse, indicated
by B<localVersion> (see above).

=item B<lockedPages> and B<writeLockedPages>

Indicates how many VLDB records are currently locked for any operation
or for writing in particular. The values are nonzero if the B<udebug> function
is issued while an operation is in progress.

=item B<anyReadLocks> and B<anyWriteLocks>

These values are true if there are any read or write locks on database records.

=item B<currentTrans> and B<writeTrans>

These values are true if there are any read or write transactions in
progress when the B<udebug> function is issued.

=item B<syncTid>

A reference to a hash containing two entries, B<epoch> and B<counter>, indicating
the transaction tid for the transaction indicated by B<currentTrans> or B<writeTrans>
above.

=item B<epochTime>

If the machine named by the B<server> argument is the coordinator,

pod/udebug.pod  view on Meta::CPAN


If the machine named by the B<server> argument is the coordinator, B<servers>
will contain a reference to an array with an entry for each secondary site
that is participating in the quorum, in the format of hash references
containing the following entries:

=over

=item B<addr>

The site's IP address

=item B<remoteVersion>

A hash reference containing the entries B<epoch> and B<counter>,
indicating the version number of the database it is maintaining.

=item B<isClone>

True if the site is only a clone.

pod/udebug.pod  view on Meta::CPAN

=item B<currentDB>

1 if the site has the database with the highest version number, 0 if it does not.

=item B<up>

1 if the Ubik process at the site is functioning correctly, 0 if it is not.

=item B<beaconSinceDown>

1 if the site has responded to the coordinator's last request for votes, 0 if it has not

=back

Including the B<long> flag produces peer entries even when the B<server>
argument names a secondary site, but in that case only the ip address is
guaranteed to be accurate. For example, the value in the B<remoteVersion> field
is usually 0.0, because secondary sites do not poll their peers for this
information. The values in the B<lastVoteTime> and B<lastBeaconSent> fields
indicate when this site last received or requested a vote as coordinator; they
generally indicate the time of the last coordinator election.

=back

For further details of interpreting the contents of the returned hash
reference, and an example of printing its entire contents in a readable

pod/udebug.pod  view on Meta::CPAN

=item Elizabeth Cassell <e_a_c@mailsnare.net> and

=item Alf Wachsmann <alfw@slac.stanford.edu>

=back

=head1 COPYRIGHT AND DISCLAIMER

 Copyright 2004 Alf Wachsmann <alfw@slac.stanford.edu> and
                Elizabeth Cassell <e_a_c@mailsnare.net>
 All rights reserved.

 Most of the explanations in this document are taken from the original
 AFS documentation.

 AFS-3 Programmer's Reference:
 Volume Server/Volume Location Server Interface
 Edward R. Zayas
 (c) 1991 Transarc Corporation.
 All rights reserved.

 IBM AFS Administration Reference
 (c) IBM Corporation 2000.
 All rights reserved.

 This library is free software; you can redistribute it and/or modify it
 under the same terms as Perl itself.

pod/xstat_cm_test.pod  view on Meta::CPAN

#------------------------------------------------------------------------------

=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

pod/xstat_cm_test.pod  view on Meta::CPAN


=item B<1>

Reports various internal performance statistics related to the Cache Manager
(for example, statistics about how effectively the cache is being used and the
quantity of intracell and intercell data access).

=item B<2>

Reports all of the internal performance statistics provided by the B<1>
setting, plus some additional, detailed performance figures (for example,
statistics about the number of RPCs sent by the Cache Manager and how long
they take to complete, and statistics regarding authentication, access,
and PAG information associated with data access).

=back

=back

=head1 OUTPUT

The returned value is a reference to an array. There is an entry in the array
for each collection gathered for each cache manager. Each entry in the array is
a reference to a hash, containing the following keys:

=over

=item B<hostName>

The name of the cache manager this data collection represents

=item B<collectionNumber>

The data collection number

=item B<probeTime>

The time the probe was initiated, measured in seconds since the Epoch
(00:00:00 UTC, January 1, 1970).

pod/xstat_cm_test.pod  view on Meta::CPAN

=item Elizabeth Cassell <e_a_c@mailsnare.net> and

=item Alf Wachsmann <alfw@slac.stanford.edu>

=back

=head1 COPYRIGHT AND DISCLAIMER

 Copyright 2004 Alf Wachsmann <alfw@slac.stanford.edu> and
                Elizabeth Cassell <e_a_c@mailsnare.net>
 All rights reserved.

 Most of the explanations in this document are taken from the original
 AFS documentation.

 AFS-3 Programmer's Reference:
 Volume Server/Volume Location Server Interface
 Edward R. Zayas
 (c) 1991 Transarc Corporation.
 All rights reserved.

 IBM AFS Administration Reference
 (c) IBM Corporation 2000.
 All rights reserved.

 This library is free software; you can redistribute it and/or modify it
 under the same terms as Perl itself.

pod/xstat_fs_test.pod  view on Meta::CPAN

#------------------------------------------------------------------------------

=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

pod/xstat_fs_test.pod  view on Meta::CPAN

not currently implemented; it returns no data.

=item B<1>

Reports various internal performance statistics related to the File Server
(for example, vnode cache entries and Rx protocol activity).

=item B<2>

Reports all of the internal performance statistics provided by the 1 setting,
plus some additional, detailed performance figures about the File Server (for
example, minimum, maximum, and cumulative statistics regarding File Server
RPCs, how long they take to complete, and how many succeed).

=item B<3>

Only when compiled with OpenAFS-1.4.1 or newer.
Reports various internal CallBack statistics related to the File Server.

=back

pod/xstat_fs_test.pod  view on Meta::CPAN

=head1 OUTPUT

The returned value is a reference to an array. There is an entry in the array
for each collection gathered for each file server. Each entry in the array is
a reference to a hash, containing the following keys:

=over

=item B<hostName>

The name of the file server this data collection represents

=item B<collectionNumber>

The data collection number

=item B<probeTime>

The time the probe was initiated, measured in seconds since the Epoch
(00:00:00 UTC, January 1, 1970).

pod/xstat_fs_test.pod  view on Meta::CPAN

=item Elizabeth Cassell <e_a_c@mailsnare.net> and

=item Alf Wachsmann <alfw@slac.stanford.edu>

=back

=head1 COPYRIGHT AND DISCLAIMER

 Copyright 2004 Alf Wachsmann <alfw@slac.stanford.edu> and
                Elizabeth Cassell <e_a_c@mailsnare.net>
 All rights reserved.

 Most of the explanations in this document are taken from the original
 AFS documentation.

 AFS-3 Programmer's Reference:
 Volume Server/Volume Location Server Interface
 Edward R. Zayas
 (c) 1991 Transarc Corporation.
 All rights reserved.

 IBM AFS Administration Reference
 (c) IBM Corporation 2000.
 All rights reserved.

 This library is free software; you can redistribute it and/or modify it
 under the same terms as Perl itself.

src/Makefile.PL  view on Meta::CPAN

                      ],
    'realclean'    => {FILES => 'Makefile.bak lib'},
                   );

if ($Config{osname} =~ /aix/) {
  $MakefileArgs{LIBS}->[0] .= ' -ldl';
} elsif ($Config{osname} =~ /irix/) {
  # just the default LIBS
} elsif ($Config{osname} =~ /solaris/) {
  $MakefileArgs{DEFINE} .= ' -Dint32=afs_int32 -Duint32=afs_uint32' if $alpha_sys eq 'sun4x_56'; # From Peter@PSDT.com
  $MakefileArgs{LIBS}->[0] .= ' -lresolv -lsocket -lnsl -lintl -ldl';
  $MakefileArgs{CC} = 'gcc';
  #$MakefileArgs{LD} = 'gcc';
  $MakefileArgs{CCCDLFLAGS} = '-fPIC';
  $MakefileArgs{LIBS}->[0] .= " -R$AFSPath/lib";
} 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");
}

src/Makefile.PL  view on Meta::CPAN


  # 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

# License.  For details, see the IBM-LICENSE file in the LICENCES
# directory or online at http://www.openafs.org/dl/license10.html
#
# Contributors
#         2004-2006: Elizabeth Cassell <e_a_c@mailsnare.net>
#                    Alf Wachsmann <alfw@slac.stanford.edu>
#
# The code for the original library were mainly taken from the AFS
# source distribution, which comes with this message:
#
#    Copyright (C) 1989-1994 Transarc Corporation - All rights reserved
#    P_R_P_Q_# (C) COPYRIGHT IBM CORPORATION 1987, 1988, 1989
#
#**********************************************************************

package AFS::Monitor;

use Carp;

require Exporter;
require AutoLoader;

src/Monitor.pm  view on Meta::CPAN

    while (@_) {
     $_ = shift;

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

sub scout {
  my %subreq;

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

      if ( @_ and $_[0] !~ /^-/ ) {
        $subreq{$_} = shift;
      }
      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.
    # taken from perl v5.005_02 for backward compatibility

src/Monitor.xs  view on Meta::CPAN

 * License.  For details, see the IBM-LICENSE file in the LICENCES
 * directory or online at http://www.openafs.org/dl/license10.html
 *
 * Contributors
 *         2004-2006: Elizabeth Cassell <e_a_c@mailsnare.net>
 *                    Alf Wachsmann <alfw@slac.stanford.edu>
 *
 * The code for the original library were mainly taken from the AFS
 * source distribution, which comes with this message:
 *
 *    Copyright (C) 1989-1994 Transarc Corporation - All rights reserved
 *    P_R_P_Q_# (C) COPYRIGHT IBM CORPORATION 1987, 1988, 1989
 *
 ***********************************************************************/

#include "EXTERN.h"

#ifdef __sgi    /* needed to get a clean compile */
#include <setjmp.h>
#endif

src/Monitor.xs  view on Meta::CPAN

   HV *TYPE;
   HV *TOTALRTT;
   HV *MINRTT;
   HV *MAXRTT;
   int i;
   int num_unused;

   hv_store(RXSTATS, "packetRequests", 14, newSViv(rxstats->packetRequests),
            0);

   hv_store(RXSTATS, "receivePktAllocFailures", 23,
            newSViv(rxstats->receivePktAllocFailures), 0);
   hv_store(RXSTATS, "receiveCbufPktAllocFailures", 27,
            newSViv(rxstats->receiveCbufPktAllocFailures), 0);
   hv_store(RXSTATS, "sendPktAllocFailures", 20,
            newSViv(rxstats->sendPktAllocFailures), 0);
   hv_store(RXSTATS, "sendCbufPktAllocFailures", 24,
            newSViv(rxstats->sendCbufPktAllocFailures), 0);
   hv_store(RXSTATS, "specialPktAllocFailures", 23,
            newSViv(rxstats->specialPktAllocFailures), 0);

   hv_store(RXSTATS, "socketGreedy", 12, newSViv(rxstats->socketGreedy), 0);
   hv_store(RXSTATS, "bogusPacketOnRead", 17,
            newSViv(rxstats->bogusPacketOnRead), 0);
   hv_store(RXSTATS, "bogusHost", 9, newSViv(rxstats->bogusHost), 0);
   hv_store(RXSTATS, "noPacketOnRead", 14, newSViv(rxstats->noPacketOnRead),
            0);
   hv_store(RXSTATS, "noPacketBuffersOnRead", 21,
            newSViv(rxstats->noPacketBuffersOnRead), 0);
   hv_store(RXSTATS, "selects", 7, newSViv(rxstats->selects), 0);

src/Monitor.xs  view on Meta::CPAN

            0);
   hv_store(RXSTATS, "dataPacketsSent", 15, newSViv(rxstats->dataPacketsSent),
            0);
   hv_store(RXSTATS, "dataPacketsReSent", 17,
            newSViv(rxstats->dataPacketsReSent), 0);
   hv_store(RXSTATS, "dataPacketsPushed", 17,
            newSViv(rxstats->dataPacketsPushed), 0);
   hv_store(RXSTATS, "ignoreAckedPacket", 17,
            newSViv(rxstats->ignoreAckedPacket), 0);

   hv_store(RXSTATS, "netSendFailures", 15, newSViv(rxstats->netSendFailures),
            0);
   hv_store(RXSTATS, "fatalErrors", 11, newSViv(rxstats->fatalErrors), 0);

   hv_store(RXSTATS, "nServerConns", 12, newSViv(rxstats->nServerConns), 0);
   hv_store(RXSTATS, "nClientConns", 12, newSViv(rxstats->nClientConns), 0);
   hv_store(RXSTATS, "nPeerStructs", 12, newSViv(rxstats->nPeerStructs), 0);
   hv_store(RXSTATS, "nCallStructs", 12, newSViv(rxstats->nCallStructs), 0);
   hv_store(RXSTATS, "nFreeCallStructs", 16,
            newSViv(rxstats->nFreeCallStructs), 0);

src/Monitor.xs  view on Meta::CPAN

   "FetchData",
   "StoreData"
};


/*
 * from src/afsmonitor/afsmonitor.h
 *
 */

/* structure of each threshold item */
struct Threshold {
   char itemName[THRESH_VAR_NAME_LEN];  /* field name */
   int index;                   /* positional index */
   char threshVal[THRESH_VAR_LEN];  /* user provided threshold value */
   char handler[256];           /* user provided ovf handler */
};


/*
 * from src/afsmonitor/afsmonitor.h
 *
 */

/* structures to store info of hosts to be monitored */
struct afsmon_hostEntry {
   char hostName[HOST_NAME_LEN];    /* fs or cm host name */
   int numThresh;               /* number of thresholds for this host */
   struct Threshold *thresh;    /* ptr to threshold entries */
   struct afsmon_hostEntry *next;
};


/*
 * from src/afsmonitor/afsmonitor.h
 *
 */

/* structures to store statistics in a format convenient to dump to the
screen */
/* for file servers */
struct fs_Display_Data {
   char hostName[HOST_NAME_LEN];
   int probeOK;                 /* 0 => probe failed */
   char data[NUM_FS_STAT_ENTRIES][FS_STAT_STRING_LEN];
   short threshOvf[NUM_FS_STAT_ENTRIES];    /* overflow flags */
   int ovfCount;                /* overflow count */
};
/* for cache managers */
struct cm_Display_Data {
   char hostName[HOST_NAME_LEN];
   int probeOK;                 /* 0 => probe failed */
   char data[NUM_CM_STAT_ENTRIES][CM_STAT_STRING_LEN];
   short threshOvf[NUM_CM_STAT_ENTRIES];    /* overflow flags */
   int ovfCount;                /* overflow count */
};



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

src/Monitor.xs  view on Meta::CPAN

struct hostent *
GetHostByName(char *name)
{
   struct hostent *he;
#ifdef AFS_SUN5_ENV
   char ip_addr[32];
#endif

   he = gethostbyname(name);
#ifdef AFS_SUN5_ENV
   /* On solaris the above does not resolve hostnames to full names */
   if (he != NULL) {
      memcpy(ip_addr, he->h_addr, he->h_length);
      he = gethostbyaddr(ip_addr, he->h_length, he->h_addrtype);
   }
#endif
   return (he);
}


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

/*
 * Constructs a string to pass back to Perl for easy execution of the threshold handler.
 * DOES NOT execute the threshold handler.
 *
 * from src/afsmonitor/afsmonitor.c
 *
 * int
 * execute_thresh_handler(a_handler, a_hostName, a_hostType,
 *                         a_threshName,a_threshValue, a_actValue)
 * char *a_handler;
 * char *a_hostName;
 * int a_hostType;
 * char *a_threshName;
 * char *a_threshValue;
 * char *a_actValue;
 */

int
my_execute_thresh_handler(a_handler, a_hostName, a_hostType, a_threshName,
                          a_threshValue, a_actValue,
                          ENTRY, buffer)
   char *a_handler;             /* ptr to handler function + args */
   char *a_hostName;            /* host name for which threshold crossed */
   int a_hostType;              /* fs or cm ? */
   char *a_threshName;          /* threshold variable name */
   char *a_threshValue;         /* threshold value */
   char *a_actValue;            /* actual value */
   HV *ENTRY;
   char *buffer;
{
   char fileName[256];          /* file name to execute */
   int i;
   char *ch;
   int argNum;
   int anotherArg;              /* boolean used to flag if another arg is available */
   char args[20 * 256] = "";

src/Monitor.xs  view on Meta::CPAN

   sscanf(a_handler, "%s", fileName);

   /* construct the contents of *argv[] */

   strncpy(fsHandler_args[0], fileName, 256);
   strncpy(fsHandler_args[1], a_hostName, HOST_NAME_LEN);
   if (a_hostType == FS)
      strcpy(fsHandler_args[2], "fs");
   else
      strcpy(fsHandler_args[2], "cm");
   strncpy(fsHandler_args[3], a_threshName, THRESH_VAR_NAME_LEN);
   strncpy(fsHandler_args[4], a_threshValue, THRESH_VAR_LEN);
   strncpy(fsHandler_args[5], a_actValue, THRESH_VAR_LEN);


   argNum = 6;
   anotherArg = 1;
   ch = a_handler;

   /* we have already extracted the file name so skip to the 1st arg */
   while (isspace(*ch)) /* leading blanks */
      ch++;

src/Monitor.xs  view on Meta::CPAN

         anotherArg = 1;
      }
      else if (anotherArg) {
         anotherArg = 0;
         sscanf(ch, "%s", fsHandler_args[argNum]);
         argNum++;
      }
      ch++;
      if (argNum >= 20) {
         sprintf(buffer,
                 "Threshold handlers cannot have more than 20 arguments (55)");
         return (55);
      }

   }

   strcpy(args, fsHandler_args[0]);

   for (i = 1; i < argNum; i++) {
      strcat(args, " ");
      strcat(args, fsHandler_args[i]);
   }

   hv_store(ENTRY, "overflow", 8, newSVpv(args, 0), 0);

   return (0);
}   /* my_execute_thresh_handler() */


/*
 * from src/afsmonitor/afsmonitor.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_insert_FS(a_hostName, nameList, last_hostEntry)
   char *a_hostName;            /* name of file server to be inserted in list */

src/Monitor.xs  view on Meta::CPAN

      return (-1);
   curr_item = (struct afsmon_hostEntry *)
      malloc(sizeof(struct afsmon_hostEntry));
   if (curr_item == (struct afsmon_hostEntry *) NULL) {
      warn("Failed to allocate space for nameList\n");
      return (-1);
   }

   strncpy(curr_item->hostName, a_hostName, CFG_STR_LEN);
   curr_item->next = (struct afsmon_hostEntry *) NULL;
   curr_item->numThresh = 0;
   curr_item->thresh = (struct Threshold *) NULL;

   if ((*nameList) == (struct afsmon_hostEntry *) NULL)
      (*nameList) = curr_item;
   else
      prev_item->next = curr_item;

   prev_item = curr_item;
   /*  record the address of this entry so that its threshold */
   /* count can be incremented during  the first pass of the config file */
   (*last_hostEntry) = curr_item;

   return (0);
}   /* my_insert_FS() */



/* my_insert_CM() */

src/Monitor.xs  view on Meta::CPAN


   curr_item = (struct afsmon_hostEntry *)
      malloc(sizeof(struct afsmon_hostEntry));
   if (curr_item == (struct afsmon_hostEntry *) NULL) {
      warn("Failed to allocate space for nameList\n");
      return (-1);
   }

   strncpy(curr_item->hostName, a_hostName, CFG_STR_LEN);
   curr_item->next = (struct afsmon_hostEntry *) NULL;
   curr_item->numThresh = 0;
   curr_item->thresh = NULL;

   if ((*nameList) == (struct afsmon_hostEntry *) NULL) {
      (*nameList) = curr_item;
   }
   else {
      prev_item->next = curr_item;
   }

   prev_item = curr_item;
   /*  record the address of this entry so that its threshold */
   /* count can be incremented during  the first pass of the config file */
   (*last_hostEntry) = curr_item;

   return (0);
}   /* my_insert_CM() */



/*
 * parses a threshold entry line in the config file.
 *
 * from src/afsmonitor/afsmonitor.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_parse_threshEntry(a_line, global_fsThreshCount, global_cmThreshCount,
                     last_hostEntry, lastHostType, buffer)
   char *a_line;                /* line that is being parsed */
   int *global_fsThreshCount;   /* count of global file server thresholds */
   int *global_cmThreshCount;   /* count of global cache manager thresholds */
   struct afsmon_hostEntry *last_hostEntry; /* a pointer to the last host entry */
   int lastHostType;            /* points to an integer specifying whether the last host was fs or cm */
   char *buffer;                /* to return error messages in */
{
   char opcode[CFG_STR_LEN];    /* junk characters */
   char arg1[CFG_STR_LEN];      /* hostname or qualifier (fs/cm?)  */
   char arg2[CFG_STR_LEN];      /* threshold variable */
   char arg3[CFG_STR_LEN];      /* threshold value */
   char arg4[CFG_STR_LEN];      /* user's handler  */
   char arg5[CFG_STR_LEN];      /* junk characters */


   /* break it up */
   opcode[0] = 0;
   arg1[0] = 0;
   arg2[0] = 0;
   arg3[0] = 0;
   arg4[0] = 0;
   arg5[0] = 0;
   sscanf(a_line, "%s %s %s %s %s %s", opcode, arg1, arg2, arg3, arg4, arg5);

   /* syntax is "thresh fs/cm variable_name threshold_value [handler] " */
   if (((strlen(arg1)) == 0) || ((strlen(arg2)) == 0)
       || ((strlen(arg3)) == 0)) {
      sprintf(buffer, "Incomplete line");
      return (-1);
   }
   if (strlen(arg3) > THRESH_VAR_LEN - 2) {
      sprintf(buffer, "threshold value too long");
      return (-1);
   }

   if ((strcasecmp(arg1, "fs")) == 0) {
      switch (lastHostType) {
        case 0:    /* its a global threshold */
           (*global_fsThreshCount)++;
           break;
        case 1:    /* inc thresh count of last file server */
           last_hostEntry->numThresh++;
           break;
        case 2:
           sprintf(buffer,
                   "A threshold for a File Server cannot be placed after a Cache Manager host entry in the config file");
           return (-1);
        default:
           sprintf(buffer, "Programming error 1");
           return (-1);
      }
   }
   else if ((strcasecmp(arg1, "cm")) == 0) {
      switch (lastHostType) {
        case 0:    /* its a global threshold */
           (*global_cmThreshCount)++;
           break;
        case 2:    /* inc thresh count of last cache manager */
           last_hostEntry->numThresh++;
           break;
        case 1:
           sprintf(buffer,
                   "A threshold for a Cache Manager cannot be placed after a File Server host entry in the config file");
           return (-1);
        default:
           sprintf(buffer, "Programming error 2");
           return (-1);
      }
   }
   else {
      sprintf(buffer,
              "Syntax error. Second argument should be \"fs\" or \"cm\"");
      return (-1);
   }

   return (0);
}   /* my_parse_threshEntry() */



/*
 * from src/afsmonitor/afsmonitor.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_parse_showEntry(a_line, fs_showDefault, cm_showDefault, fs_showFlags,

src/Monitor.xs  view on Meta::CPAN

   arg2[0] = 0;

   sscanf(a_line, "%s %s %s", opcode, arg1, arg2);
   if ((strlen(arg2)) != 0) {
      sprintf(buffer, "Extraneous characters at end of line");
      return (-1);
   }

   he = GetHostByName(arg1);
   if (he == NULL) {
      sprintf(buffer, "Unable to resolve hostname %s", arg1);
      return (-1);
   }

   if ((strcasecmp(opcode, "fs")) == 0) {
      /* use the complete host name to insert in the file server names list */
      code = my_insert_FS(he->h_name, FSnameList, last_hostEntry);
      if (code) {
         return (-1);
      }
      /* note that last host entry in the config file was fs */

src/Monitor.xs  view on Meta::CPAN

}   /* my_parse_hostEntry() */



/*
 * from src/afsmonitor/afsmonitor.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_store_threshold(a_type, a_varName, a_value, a_handler, global_TC,
                   Header, hostname, srvCount, buffer)
   int a_type;                  /* 1 = fs , 2 = cm */
   char *a_varName;             /* threshold name */
   char *a_value;               /* threshold value */
   char *a_handler;             /* threshold overflow handler */
   int *global_TC;              /* ptr to global_xxThreshCount */
   struct afsmon_hostEntry *Header; /* tmp ptr to hostEntry list header */
   char *hostname;
   int srvCount;                /* tmp count of host names */
   char *buffer;
{

   struct afsmon_hostEntry *tmp_host = 0;   /* tmp ptr to hostEntry */
   struct Threshold *threshP = 0;   /* tmp ptr to threshold list */
   int index = 0;               /* index to fs_varNames or cm_varNames */
   int found = 0;
   int done = 0;
   int i = 0, j = 0;

   /* resolve the threshold variable name */
   found = 0;
   if (a_type == FS) {  /* fs threshold */
      for (index = 0; index < NUM_FS_STAT_ENTRIES; index++) {
         if (strcasecmp(a_varName, fs_varNames[index]) == 0) {
            found = 1;
            break;
         }
      }
      if (!found) {
         sprintf(buffer, "Unknown FS threshold variable name %s", a_varName);
         return (-1);
      }
   }
   else if (a_type == CM) { /* cm threshold */
      for (index = 0; index < NUM_CM_STAT_ENTRIES; index++) {
         if (strcasecmp(a_varName, cm_varNames[index]) == 0) {
            found = 1;
            break;
         }
      }
      if (!found) {
         sprintf(buffer, "Unknown CM threshold variable name %s", a_varName);
         return (-1);
      }
   }
   else
      return (-1);

   /* if the global thresh count is not zero, place this threshold on
    * all the host entries  */

   if (*global_TC) {
      tmp_host = Header;
      for (i = 0; i < srvCount; i++) {
         threshP = tmp_host->thresh;
         done = 0;
         for (j = 0; j < tmp_host->numThresh; j++) {
            if ((threshP->itemName[0] == '\0') ||
                (strcasecmp(threshP->itemName, a_varName) == 0)) {
               strncpy(threshP->itemName, a_varName, THRESH_VAR_NAME_LEN);
               strncpy(threshP->threshVal, a_value, THRESH_VAR_LEN);
               strcpy(threshP->handler, a_handler);
               threshP->index = index;
               done = 1;
               break;
            }
            threshP++;
         }
         if (!done) {
            sprintf(buffer,
                    "Could not insert threshold entry for %s in thresh list of host %s",
                    a_varName, tmp_host->hostName);
            return (-1);
         }
         tmp_host = tmp_host->next;
      }
      (*global_TC)--;
      return (0);
   }

   /* it is not a global threshold, insert it in the thresh list of this
    * host only. We overwrite the global threshold if it was already set */

   if (*hostname == '\0') {
      sprintf(buffer, "Programming error 3");
      return (-1);
   }

   /* get the hostEntry that this threshold belongs to */
   tmp_host = Header;
   found = 0;
   for (i = 0; i < srvCount; i++) {
      if (strcasecmp(tmp_host->hostName, hostname) == 0) {
         found = 1;
         break;
      }
      tmp_host = tmp_host->next;
   }
   if (!found) {
      sprintf(buffer, "Unable to find host %s in %s hostEntry list", hostname,
              (a_type - 1) ? "CM" : "FS");
      return (-1);
   }

   /* put this entry on the thresh list of this host, overwrite global value
    * if needed */

   threshP = tmp_host->thresh;
   done = 0;
   for (i = 0; i < tmp_host->numThresh; i++) {
      if ((threshP->itemName[0] == '\0') ||
          (strcasecmp(threshP->itemName, a_varName) == 0)) {
         strncpy(threshP->itemName, a_varName, THRESH_VAR_NAME_LEN);
         strncpy(threshP->threshVal, a_value, THRESH_VAR_LEN);
         strcpy(threshP->handler, a_handler);
         threshP->index = index;
         done = 1;
         break;
      }
      threshP++;
   }

   if (!done) {
      sprintf(buffer, "Unable to insert threshold %s for %s host %s",
              a_varName, (a_type - 1) ? "CM" : "FS", tmp_host->hostName);
      return (-1);
   }

   return (0);

}   /* my_store_threshold() */



/*
 * from /src/afsmonitor/afsmonitor.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
 * check_fs_thresholds(a_hostEntry, a_Data)
 * struct afsmon_hostEntry *a_hostEntry;
 * struct fs_Display_Data *a_Data;
 *
 * and
 *
 * int
 * check_cm_thresholds(a_hostEntry, a_Data)
 * struct afsmon_hostEntry *a_hostEntry;
 * struct cm_Display_Data *a_Data;
 */

int
my_check_thresholds(a_hostEntry, HOSTINFO, type, buffer)
   struct afsmon_hostEntry *a_hostEntry;    /* ptr to hostEntry */
   HV *HOSTINFO;                /* ptr to data to be displayed */
   int type;
   char *buffer;
{

   struct Threshold *threshP;
   double tValue = 0;           /* threshold value */
   double pValue = 0;           /* probe value */
   int i;
   int idx;
   int count;                   /* number of thresholds exceeded */
   HV *SECTION;
   HV *GROUP;
   HV *VALUE;
   int found;
   char *key;
   I32 keylen;
   char strval[256];
   int code = 0;
   char *varName;

   if (a_hostEntry->numThresh == 0) {
      /* store in ovf count ?? */
      return (0);
   }

   count = 0;
   threshP = a_hostEntry->thresh;
   for (i = 0; i < a_hostEntry->numThresh; i++) {
      found = 0;

      if (threshP->itemName[0] == '\0') {
         threshP++;
         continue;
      }

      idx = threshP->index; /* positional index to the data array */
      tValue = atof(threshP->threshVal);    /* threshold value */
      hv_iterinit(HOSTINFO);


      while ((SECTION = (HV *) hv_iternextsv(HOSTINFO, &key, &keylen))) {

         if (!SvROK(SECTION)
             || SvTYPE(SECTION = (HV *) SvRV(SECTION)) != SVt_PVHV) {
            continue;
         }
         hv_iterinit(SECTION);

src/Monitor.xs  view on Meta::CPAN

               pValue = SvIV(*hv_fetch(VALUE, "value", 5, FALSE));
               found = 1;
               break;
            }
         }
         if (found)
            break;
      }

      if (!found) {
         threshP++;
         continue;
      }

      if (pValue > tValue) {
         hv_store(VALUE, "overflow", 8, newSViv(1), 0);
         hv_store(VALUE, "threshold", 9, newSVnv(tValue), 0);

         if (threshP->handler[0] != '\0') {
            sprintf(strval, "%g", pValue);
            code = my_execute_thresh_handler(threshP->handler,
                                             a_hostEntry->hostName, type,
                                             threshP->itemName,
                                             threshP->threshVal, strval,
                                             VALUE, buffer);
            if (code) {
               return (code);
            }
         }

         count++;
      }
      threshP++;
   }

   return (0);
}   /* my_check_thresholds() */




/*
 * from src/afsmonitor/afsmonitor.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

src/Monitor.xs  view on Meta::CPAN

   short *cm_showFlags;
   struct afsmon_hostEntry **FSnameList;
   struct afsmon_hostEntry **CMnameList;
{
   char buff1[256] = "";        /* for error messages */
   char buff2[256] = "";        /* for error messages returned from subroutines */
   FILE *configFD = 0;          /* config file descriptor */
   char line[4 * CFG_STR_LEN];  /* a line of config file */
   char opcode[CFG_STR_LEN];    /* specifies type of config entry */
   char arg1[CFG_STR_LEN];      /* hostname or qualifier (fs/cm?)  */
   char arg2[CFG_STR_LEN];      /* threshold variable */
   char arg3[CFG_STR_LEN];      /* threshold value */
   char arg4[CFG_STR_LEN];      /* user's handler  */
   struct afsmon_hostEntry *curr_host = 0;
   struct hostent *he = 0;      /* hostentry to resolve host name */
   char *handlerPtr = 0;        /* ptr to pass theresh handler string */
   int code = 0;                /* error code */
   int linenum = 0;             /* config file line number */
   int threshCount = 0;         /* count of thresholds for each server */
   int error_in_config = 0;     /* syntax errors in config file  ?? */
   int i = 0;
   int numBytes = 0;
   /* int global_ThreshFlag = 1; */
   int global_fsThreshCount = 0;
   int global_cmThreshCount = 0;
   static char last_fsHost[HOST_NAME_LEN];
   static char last_cmHost[HOST_NAME_LEN];

   /* open config file */
   configFD = fopen(a_config_filename, "r");
   if (configFD == (FILE *) NULL) {
      sprintf(buff1, "Failed to open config file %s", a_config_filename);
      BSETCODE(5, buff1);
      return (-1);
   }

   /* parse config file */

   /* First Pass - check syntax and count number of servers and thresholds to monitor */

   *numFS = 0;
   *numCM = 0;
   threshCount = 0;
   error_in_config = 0; /* flag to note if config file has syntax errors */

   while ((fgets(line, CFG_STR_LEN, configFD)) != NULL) {
      opcode[0] = 0;
      arg1[0] = 0;
      arg2[0] = 0;
      arg3[0] = 0;
      arg4[0] = 0;
      sscanf(line, "%s %s %s %s %s", opcode, arg1, arg2, arg3, arg4);
      linenum++;

src/Monitor.xs  view on Meta::CPAN

      /* skip blank lines and comment lines */
      if ((strlen(opcode) == 0) || line[0] == '#') {
         /* fprintf(STDERR, " - skipping line %d\n", linenum); */
         continue;
      }
      if ((strcasecmp(opcode, "fs") == 0) || (strcasecmp(opcode, "cm")) == 0) {
         /* fprintf(STDERR, " - parsing host entry\n"); */
         code =
            my_parse_hostEntry(line, numFS, numCM, lastHostType,
                               last_hostEntry, FSnameList, CMnameList, buff2);
         /* thresholds are not global anymore */
         /* if (global_ThreshFlag) global_ThreshFlag = 0; */
      }
      else if ((strcasecmp(opcode, "thresh")) == 0) {
         /* fprintf(STDERR, " - parsing thresh entry\n"); */
         code =
            my_parse_threshEntry(line, &global_fsThreshCount,
                                 &global_cmThreshCount, *last_hostEntry,
                                 *lastHostType, buff2);
      }
      else if ((strcasecmp(opcode, "show")) == 0) {
         /* fprintf(STDERR, " - parsing show entry\n"); */
         code =
            my_parse_showEntry(line, fs_showDefault, cm_showDefault,
                               fs_showFlags, cm_showFlags, buff2);
      }
      else {
         /* fprintf(STDERR, " - unknown entry\n"); */

src/Monitor.xs  view on Meta::CPAN

      }
   }
   /* fprintf(STDERR, "got to end of file.\n"); */

   if (error_in_config) {
      sprintf(buff1, "Error in config file. %s", buff2);
      BSETCODE(10, buff1);
      return (-1);
   }

   /* the threshold count of all hosts in increased by 1 for each global
    * threshold. If one of the hosts has a local threshold for the same
    * variable it would end up being counted twice. whats a few bytes of memory
    * wasted anyway ? */

   if (global_fsThreshCount) {
      curr_host = *FSnameList;
      for (i = 0; i < *numFS; i++) {
         curr_host->numThresh += global_fsThreshCount;
         curr_host = curr_host->next;
      }
   }
   if (global_cmThreshCount) {
      curr_host = *CMnameList;
      for (i = 0; i < *numCM; i++) {
         curr_host->numThresh += global_cmThreshCount;
         curr_host = curr_host->next;
      }
   }

   /* make sure we have something to monitor */
   if (*numFS == 0 && *numCM == 0) {
      sprintf(buff1,
              "Config file must specify atleast one File Server or Cache Manager host to monitor.");
      fclose(configFD);
      BSETCODE(15, buff1);
      return (-1);
   }

   /* Second Pass */

   fseek(configFD, 0, 0);   /* seek to the beginning */

   /* allocate memory for threshold lists */

   curr_host = *FSnameList;
   for (i = 0; i < *numFS; i++) {
      if (curr_host->hostName[0] == '\0') {
         sprintf(buff1, "Programming error 4");
         BSETCODE(20, buff1);
         return (-1);
      }
      if (curr_host->numThresh) {
         numBytes = curr_host->numThresh * sizeof(struct Threshold);
         curr_host->thresh = (struct Threshold *)malloc(numBytes);
         if (curr_host->thresh == (struct Threshold *) NULL) {
            sprintf(buff1, "Memory Allocation error 1");
            BSETCODE(25, buff1);
            return (-1);
         }
         memset(curr_host->thresh, 0, numBytes);
      }
      curr_host = curr_host->next;
   }

   curr_host = *CMnameList;
   for (i = 0; i < *numCM; i++) {
      if (curr_host->hostName[0] == '\0') {
         sprintf(buff1, "Programming error 5");
         BSETCODE(30, buff1);
         return (-1);
      }
      if (curr_host->numThresh) {
         numBytes = curr_host->numThresh * sizeof(struct Threshold);
         curr_host->thresh = (struct Threshold *)malloc(numBytes);
         if (curr_host->thresh == (struct Threshold *) NULL) {
            sprintf(buff1, "Memory Allocation error 2");
            BSETCODE(35, buff1);
            return (-1);
         }
         memset(curr_host->thresh, 0, numBytes);
      }
      curr_host = curr_host->next;
   }

   opcode[0] = 0;
   arg1[0] = 0;
   arg2[0] = 0;
   arg3[0] = 0;
   arg4[0] = 0;
   last_fsHost[0] = '\0';

src/Monitor.xs  view on Meta::CPAN


      /* if we have a host entry, remember the host name */
      if (strcasecmp(opcode, "fs") == 0) {
         he = GetHostByName(arg1);
         strncpy(last_fsHost, he->h_name, HOST_NAME_LEN);
      }
      else if (strcasecmp(opcode, "cm") == 0) {
         he = GetHostByName(arg1);
         strncpy(last_cmHost, he->h_name, HOST_NAME_LEN);
      }
      else if (strcasecmp(opcode, "thresh") == 0) {
         /* if we have a threshold handler it may have arguments
          * and the sscanf() above would not get them, so do the
          * following */
         if (strlen(arg4)) {
            handlerPtr = line;
            /* now skip over 4 words - this is done by first
             * skipping leading blanks then skipping a word */
            for (i = 0; i < 4; i++) {
               while (isspace(*handlerPtr))
                  handlerPtr++;
               while (!isspace(*handlerPtr))

src/Monitor.xs  view on Meta::CPAN

            }
            while (isspace(*handlerPtr))
               handlerPtr++;
            /* we how have a pointer to the start of the handler
             * name & args */
         }
         else
            handlerPtr = arg4;  /* empty string */

         if (strcasecmp(arg1, "fs") == 0)
            code = my_store_threshold(1,    /* 1 = fs */
                                      arg2, arg3, handlerPtr,
                                      &global_fsThreshCount, *FSnameList,
                                      last_fsHost, *numFS, buff2);

         else if (strcasecmp(arg1, "cm") == 0)
            code = my_store_threshold(2,    /* 2 = cm */
                                      arg2, arg3, handlerPtr,
                                      &global_cmThreshCount, *CMnameList,
                                      last_cmHost, *numCM, buff2);

         else {
            sprintf(buff1, "Programming error 6");
            BSETCODE(40, buff1);
            return (-1);
         }
         if (code) {
            sprintf(buff1,
                    "Error processing config file line %d (\"%s %s %s %s %s\"): Failed to store threshold. %s",
                    linenum, opcode, arg1, arg2, arg3, arg4, buff2);
            BSETCODE(45, buff1);
            return (-1);
         }
      }
   }

   fclose(configFD);
   return (0);
}   /* my_process_config_file() */

src/Monitor.xs  view on Meta::CPAN


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 */

src/Monitor.xs  view on Meta::CPAN

   if (curr_fsDataP == (struct fs_Display_Data *) NULL) {
      sprintf(buffer, "Memory allocation failure");
      return (-1);
   }
   memset(curr_fsDataP, 0, sizeof(struct fs_Display_Data));

   hv_store(HOSTINFO, "hostName", 8, newSVpv(a_fsResults->connP->hostName, 0),
            0);

   /*  Check the status of the probe. If it succeeded, we store its
    * results in the display data structure. If it failed we only mark
    * the failed status in the display data structure. */

   if (a_fsResults->probeOK) {  /* 1 => notOK the xstat results */
      hv_store(HOSTINFO, "probeOK", 7, newSViv(0), 0);
   }
   else {   /* probe succeeded, update display data structures */
      hv_store(HOSTINFO, "probeOK", 7, newSViv(1), 0);

      my_fs_Results_ltoa(curr_fsDataP, a_fsResults);

      fs_Results_to_Hash(curr_fsDataP, HOSTINFO, fs_showFlags,
                         fs_showDefault);

      /* compare with thresholds and set the overflow flags.
       * note that the threshold information is in the hostEntry structure and
       * each threshold item has a positional index associated with it */

      /* locate the hostEntry for this host */
      done = 0;
      curr_host = FSnameList;
      for (i = 0; i < numFS; i++) {
         if (strcasecmp(curr_host->hostName, a_fsResults->connP->hostName)
             == 0) {
            done = 1;
            break;
         }
         curr_host = curr_host->next;;
      }
      if (!done) {
         sprintf(buffer, "Error storing results for FS host %s (70)",
                 a_fsResults->connP->hostName);
         return (70);
      }

      code = my_check_thresholds(curr_host, HOSTINFO, FS, buff2);
      if (code) {
         sprintf(buffer, "Error in checking thresholds (75) %s", buff2);
         return (75);
      }

   }    /* the probe succeeded, so we store the data in the display structure */
   return (0);

}   /* my_save_FS_data_forDisplay() */



src/Monitor.xs  view on Meta::CPAN

      my_xstat_fs_Cleanup(1, xstat_fs_numServers, xstat_fs_ConnInfo, buff2);
      sprintf(buffer, "Can't create probe LWP client security object. %s",
              buff2);
      return (-1);
   }

   curr_conn = xstat_fs_ConnInfo;
   conn_err = 0;
   for (curr_srv = 0; curr_srv < xstat_fs_numServers; curr_srv++) {
      /*
       * Copy in the socket info for the current server, resolve its
       * printable name if possible.
       */

      memcpy(&(curr_conn->skt), a_socketArray + curr_srv,
             sizeof(struct sockaddr_in));

      hostNameFound = hostutil_GetNameByINet(curr_conn->skt.sin_addr.s_addr);
      if (hostNameFound == NULL) {
         warn("Can't map Internet address %lu to a string name",
              curr_conn->skt.sin_addr.s_addr);
         curr_conn->hostName[0] = '\0';
      }
      else {
         strcpy(curr_conn->hostName, hostNameFound);
      }

      /*
       * Make an Rx connection to the current server.
       */

src/Monitor.xs  view on Meta::CPAN


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 */

src/Monitor.xs  view on Meta::CPAN

   if (curr_cmDataP == (struct cm_Display_Data *) NULL) {
      sprintf(buffer, "Memory allocation failure");
      return (-10);
   }
   memset(curr_cmDataP, 0, sizeof(struct cm_Display_Data));

   hv_store(HOSTINFO, "hostName", 8, newSVpv(a_cmResults->connP->hostName, 0),
            0);

   /*  Check the status of the probe. If it succeeded, we store its
    * results in the display data structure. If it failed we only mark
    * the failed status in the display data structure. */

   if (a_cmResults->probeOK) {  /* 1 => notOK the xstat results */
      hv_store(HOSTINFO, "probeOK", 7, newSViv(0), 0);
   }
   else {   /* probe succeeded, update display data structures */
      hv_store(HOSTINFO, "probeOK", 7, newSViv(1), 0);

      my_cm_Results_ltoa(curr_cmDataP, a_cmResults);

      cm_Results_to_Hash(curr_cmDataP, HOSTINFO, cm_showFlags,
                         cm_showDefault);

      done = 0;
      curr_host = CMnameList;
      for (i = 0; i < numCM; i++) {
         if (strcasecmp(curr_host->hostName, a_cmResults->connP->hostName)
             == 0) {
            done = 1;
            break;
         }
         curr_host = curr_host->next;;
      }
      if (!done) {
         sprintf(buffer, "Error storing results for CM host %s (100)",
                 a_cmResults->connP->hostName);
         return (100);
      }

      code = my_check_thresholds(curr_host, HOSTINFO, CM, buff2);
      if (code) {
         sprintf(buffer, "Error in checking thresholds (105) %s", buff2);
         return (105);
      }

   }

   return (0);
}   /* my_save_CM_data_forDisplay() */



src/Monitor.xs  view on Meta::CPAN

      my_xstat_cm_Cleanup(1, xstat_cm_numServers, xstat_cm_ConnInfo, buff2);
      sprintf(buffer, "Can't create probe LWP client security object. %s",
              buff2);
      return (-1);
   }

   curr_conn = xstat_cm_ConnInfo;
   conn_err = 0;
   for (curr_srv = 0; curr_srv < xstat_cm_numServers; curr_srv++) {
      /*
       * Copy in the socket info for the current server, resolve its
       * printable name if possible.
       */

      memcpy(&(curr_conn->skt), a_socketArray + curr_srv,
             sizeof(struct sockaddr_in));

      hostNameFound = hostutil_GetNameByINet(curr_conn->skt.sin_addr.s_addr);
      if (hostNameFound == NULL) {
         warn("Can't map Internet address %lu to a string name",
              curr_conn->skt.sin_addr.s_addr);
         curr_conn->hostName[0] = '\0';
      }
      else {
         strcpy(curr_conn->hostName, hostNameFound);
      }

      /*
       * Make an Rx connection to the current server.
       */

src/Monitor.xs  view on Meta::CPAN

      if (IsLocked(&centry.lock)) {
         LOCK = newHV();
         my_PrintLock(&centry.lock, LOCK);
         hv_store(CENTRY, "lock", 4, newRV_inc((SV *) LOCK), 0);
      }

      hv_store(CENTRY, "Length", 6, newSViv(centry.Length), 0);
      hv_store(CENTRY, "DataVersion", 11, newSViv(centry.DataVersion), 0);
      hv_store(CENTRY, "refCount", 8, newSViv(centry.refCount), 0);
      hv_store(CENTRY, "callback", 8, newSViv(centry.callback), 0);
      hv_store(CENTRY, "cbExpires", 9, newSViv(centry.cbExpires), 0);
      hv_store(CENTRY, "opens", 5, newSViv(centry.opens), 0);
      hv_store(CENTRY, "writers", 7, newSViv(centry.writers), 0);

      /* now display states */
      hv_store(CENTRY, "mvstat", 6, newSViv(centry.mvstat), 0);

      hv_store(CENTRY, "states", 6, newSViv(centry.states), 0);
      av_store(CACHE_ENTRIES, i, newRV_inc((SV *) CENTRY));
   }
   return 0;

src/Monitor.xs  view on Meta::CPAN


        if (IsLocked(&centry.lock)) {
            LOCK = newHV();
            my_PrintLock(&centry.lock, LOCK);
            hv_store(CENTRY, "lock", 4, newRV_inc((SV *) LOCK), 0);
        }
        hv_store(CENTRY, "Length",       6, newSViv(centry.Length), 0);
        hv_store(CENTRY, "DataVersion", 11, newSViv(centry.DataVersion), 0);
        hv_store(CENTRY, "refCount",     8, newSViv(centry.refCount), 0);
        hv_store(CENTRY, "callback",     8, newSViv(centry.callback), 0);
        hv_store(CENTRY, "cbExpires",    9, newSViv(centry.cbExpires), 0);
        hv_store(CENTRY, "opens",        5, newSViv(centry.opens), 0);
        hv_store(CENTRY, "writers",      7, newSViv(centry.writers), 0);


        /* now display states */
        hv_store(CENTRY, "mvstat", 6, newSViv(centry.mvstat), 0);

        hv_store(CENTRY, "states", 6, newSViv(centry.states), 0);
        av_store(CACHE_ENTRIES, i, newRV_inc((SV *) CENTRY));
    }

src/Monitor.xs  view on Meta::CPAN

        if (IsLocked(&centry.lock)) {
            LOCK = newHV();
            my_PrintLock(&centry.lock, LOCK);
            hv_store(CENTRY, "lock", 4, newRV_inc((SV *) LOCK), 0);
        }

        hv_store(CENTRY, "Length",       6, newSViv(centry.Length), 0);
        hv_store(CENTRY, "DataVersion", 11, newSViv(centry.DataVersion), 0);
        hv_store(CENTRY, "refCount",     8, newSViv(centry.refCount), 0);
        hv_store(CENTRY, "callback",     8, newSViv(centry.callback), 0);
        hv_store(CENTRY, "cbExpires",    9, newSViv(centry.cbExpires), 0);
        hv_store(CENTRY, "opens",        5, newSViv(centry.opens), 0);
        hv_store(CENTRY, "writers",      7, newSViv(centry.writers), 0);

        /* now display states */
        if (centry.mvstat == 0)
            data_name = "normal file";
        else if (centry.mvstat == 1)
            data_name = "mount point";
        else if (centry.mvstat == 2)
            data_name = "volume root";

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

      fprintf(scout_debugfd,
              "[%s] Probe LWP client security object created\n", rn);
      fflush(scout_debugfd);
   }


   curr_conn = *fsprobe_ConnInfo;
   conn_err = 0;
   for (curr_srv = 0; curr_srv < a_numServers; curr_srv++) {
      /*
       * Copy in the socket info for the current server, resolve its
       * printable name if possible.
       */
      if (scout_debugfd) {
         fprintf(scout_debugfd,
                 "[%s] Copying in the following socket info:\n", rn);
         fprintf(scout_debugfd, "[%s] IP addr 0x%lx, port %d\n", rn,
                 (a_socketArray + curr_srv)->sin_addr.s_addr,
                 (a_socketArray + curr_srv)->sin_port);
         fflush(scout_debugfd);
      }
      memcpy(&(curr_conn->skt), a_socketArray + curr_srv,
             sizeof(struct sockaddr_in));

      hostNameFound = hostutil_GetNameByINet(curr_conn->skt.sin_addr.s_addr);
      if (hostNameFound == (char *) NULL) {
         warn("Can't map Internet address %lu to a string name\n",
              curr_conn->skt.sin_addr.s_addr);
         curr_conn->hostName[0] = '\0';
      }
      else {
         strcpy(curr_conn->hostName, hostNameFound);
         if (scout_debugfd) {
            fprintf(scout_debugfd,
                    "[%s] Host name for server index %d is %s\n", rn,
                    curr_srv, curr_conn->hostName);
            fflush(scout_debugfd);

src/Monitor.xs  view on Meta::CPAN

      hv_store(RESULTS, "probeTime", 9, newSViv(fsprobe_Results.probeTime),
               0);
      hv_store(RESULTS, "hostName", 8, newSVpv(curr_conn->hostName, 0), 0);

      if (*curr_probeOK == 0) {
         STATS = newHV();
         hv_store(STATS, "CurrentConnections", 18,
                  newSViv(curr_stats->CurrentConnections), 0);
         hv_store(STATS, "TotalFetchs", 11, newSViv(curr_stats->TotalFetchs),
                  0);
         hv_store(STATS, "TotalStores", 11, newSViv(curr_stats->TotalStores),
                  0);
         hv_store(STATS, "WorkStations", 12,
                  newSViv(curr_stats->WorkStations), 0);

         hv_store(STATS, "CurrentMsgNumber", strlen("CurrentMsgNumber"),
                  newSViv(curr_stats->CurrentMsgNumber), 0);
         hv_store(STATS, "OldestMsgNumber", strlen("OldestMsgNumber"),
                  newSViv(curr_stats->OldestMsgNumber), 0);
         hv_store(STATS, "CurrentTime", strlen("CurrentTime"),
                  newSViv(curr_stats->CurrentTime), 0);

src/Monitor.xs  view on Meta::CPAN

    else hostAddr = htonl(0x7f000001);  /* IP localhost */


    if (!portName)
       port = htons(3000);             /* default */
    else {
       port = udebug_PortNumber(portName);
       if (port < 0)
          port = udebug_PortName(portName);
       if (port < 0) {
          sprintf(buffer, "udebug: can't resolve port name %s", portName);
          BSETCODE(1, buffer);
          XSRETURN_UNDEF;
       }
       port = htons(port);
    }

    rx_Init(0);
    sc = rxnull_NewClientSecurityObject();
    tconn = rx_NewConnection(hostAddr, port, VOTE_SERVICE_ID, sc, 0);

src/Monitor.xs  view on Meta::CPAN

          XSRETURN_UNDEF;
        break;
      } /* end switch */
    } /* end while */
    /* done parsing arguments */

    rx_Init(0);

    thp = hostutil_GetHostByName(hostName);
    if (!thp) {
        sprintf(buffer, "can't resolve address for host %s", hostName);
        BSETCODE(1, buffer);
        XSRETURN_UNDEF;
    }
    memcpy(&addr, thp->h_addr, sizeof(afs_int32));
    secobj = rxnull_NewServerSecurityObject();
    conn = rx_NewConnection(addr, htons(port), 1, secobj, 0);
    if (!conn) {
        sprintf(buffer, "failed to create connection for host %s", hostName);
        BSETCODE(1, buffer);
        XSRETURN_UNDEF;

src/Monitor.xs  view on Meta::CPAN

    HV* args = (HV*) SvRV($arg);
  PREINIT:
  PPCODE:
  {
    I32 keylen = 0;
    char* key = 0;
    SV* value = 0;
    char* host = 0;
    AV* host_array = 0;
    AV* show_array = 0;
    AV* fsthresh_array = 0;
    AV* cmthresh_array = 0;
    HV* thresh_entry = 0;
    int global_fsThreshCount = 0;
    int global_cmThreshCount = 0;
    int found = 0;
    int numBytes = 0;
    char* thresh_name = "";
    char* thresh_value = 0;
    char* thresh_host = "";
    char* thresh_handler = "";
    int num_args = 0;
    int detailed = 0;
    char* config_filename = 0;
    char* output_filename = 0;
    FILE *outputFD = 0;
    struct afsmon_hostEntry *temp_host = 0;
    int numFS = 0;
    int numCM = 0;
    struct afsmon_hostEntry *last_hostEntry = 0;
    int lastHostType = 0;

src/Monitor.xs  view on Meta::CPAN

                                               fs_showFlags, cm_showFlags, buff2);
                     if(code) {
                       sprintf(buffer, "Error parsing cmshow flag. %s", buff2);
                       BSETCODE(-1, buffer);
                       XSRETURN_UNDEF;
                     }
                   }
                 } else goto unrecognized;
                 break;
                case 't':
                 if(strncmp(key, "cmthresh", keylen) == 0 && keylen <= 8) {
                   /* fprintf(STDERR, "flag %s recognized as cmthresh\n", key); */
                   cmthresh_array = (AV*) SvRV(value);
                 } else goto unrecognized;
                 break;
                default:
                 goto unrecognized;
              }
            break;

            default:
              goto unrecognized;
          }

src/Monitor.xs  view on Meta::CPAN

                                            fs_showFlags, cm_showFlags, buff2);
                  if(code) {
                    sprintf(buffer, "Error parsing fsshow flag. %s", buff2);
                    BSETCODE(-1, buffer);
                    XSRETURN_UNDEF;
                  }
                }
              } else goto unrecognized;
              break;
            case 't':
              if(strncmp(key, "fsthresh", keylen) == 0 && keylen <= 8) {
                /* fprintf(STDERR, "flag %s recognized as fsthresh\n", key); */
                fsthresh_array = (AV*) SvRV(value);
              } else goto unrecognized;
              break;
            default:
              goto unrecognized;
          }
        break;

        case 'o':
          if(strncmp(key, "output", keylen) == 0 && keylen <= 6) {
            /* fprintf(STDERR, "flag %s recognized as output; value is %s\n",

src/Monitor.xs  view on Meta::CPAN

    }
    else {
      if (!numFS && !numCM) {
        sprintf(buffer,"Must specify either config or (fshosts and/or cmhosts) options");
        BSETCODE(175, buffer);
        /* 175 is the exit code for this error in the original afsmonitor.c */
        XSRETURN_UNDEF;
      }
    }

    if (fsthresh_array) {
      if(!numFS) {
        sprintf(buffer, "Cannot use fsthresh option without specifying fshosts");
        BSETCODE(-1, buffer);
        XSRETURN_UNDEF;
      }
      num = av_len(fsthresh_array);
      for (i=0; i<=num; i++) {
        thresh_host = 0;
        thresh_handler = "";
        thresh_entry = (HV*) SvRV(*av_fetch(fsthresh_array, i, 0));
        hv_iterinit(thresh_entry);
        while((value = hv_iternextsv(thresh_entry, &key, &keylen))) {
          if(strcmp(key, "host")==0) {
            thresh_host = (char *)SvPV(value, PL_na);
            he = GetHostByName(thresh_host);
            if(he == (struct hostent *) NULL) {
              sprintf(buffer,
                      "Couldn't parse fsthresh flag; unable to resolve hostname %s\n",
                      thresh_host);
              BSETCODE(-1, buffer);
              XSRETURN_UNDEF;
            }
            thresh_host = he->h_name;
          }
          else if(strcmp(key, "handler")==0) {
            thresh_handler = (char *) SvPV(value, PL_na);
          }
          else {
            thresh_name = key;
            thresh_value = (char *) SvPV(value, PL_na);
          }
        }
        sprintf(buffer, "thresh fs %s %s %s",
                thresh_name, thresh_value, thresh_handler);
        if(!thresh_host) {
          code = my_parse_threshEntry(buffer, &global_fsThreshCount,
                      &global_cmThreshCount, (struct afsmon_hostEntry *) NULL, 0, buff2);
          if (code) {
            sprintf(buffer, "Couldn't parse fsthresh entry. %s", buff2);
            BSETCODE(code, buffer);
            XSRETURN_UNDEF;
          }
        }
        else {
          temp_host = FSnameList;
          found = 0;
          for (j = 0; j < numFS; j++) {
            if(strcmp(thresh_host, temp_host->hostName) == 0) {
              found = 1;
              break;
            }
            temp_host = temp_host->next;
          }
          if(found) {
            code = my_parse_threshEntry(buffer, &global_fsThreshCount,
                                        &global_cmThreshCount, temp_host,
                                        1, buff2);
            if(code) {
              sprintf(buffer, "Couldn't parse fsthresh entry. %s", buff2);
              BSETCODE(code, buffer);
              XSRETURN_UNDEF;
            }
          }
          else {
            sprintf(buffer,
                    "Couldn't parse fsthresh entry for host %s; host not found",
                    thresh_host);
            BSETCODE(-1, buffer);
            XSRETURN_UNDEF;
          }
        }
      }
      if (global_fsThreshCount) {
        temp_host = FSnameList;
        for (i = 0; i < numFS; i++) {
          temp_host->numThresh += global_fsThreshCount;
          temp_host = temp_host->next;
        }
      }
      temp_host = FSnameList;
      for (i = 0; i < numFS; i++) {
        if (temp_host->numThresh) {
          numBytes = temp_host->numThresh * sizeof(struct Threshold);
          temp_host->thresh = (struct Threshold *)malloc(numBytes);
          if (temp_host->thresh == (struct Threshold *) NULL) {
            sprintf(buffer, "Memory Allocation error 1.5");
            BSETCODE(25, buffer);
            XSRETURN_UNDEF;
          }
          memset(temp_host->thresh, 0, numBytes);
        }
        temp_host = temp_host->next;
      }
      num = av_len(fsthresh_array);
      for (i=0; i<=num; i++) {
        thresh_host = 0;
        thresh_handler = "";
        thresh_entry = (HV*) SvRV(*av_fetch(fsthresh_array, i, 0));
        hv_iterinit(thresh_entry);
        while((value = hv_iternextsv(thresh_entry, &key, &keylen))) {
          if(strcmp(key, "host") == 0) {
            thresh_host = (char *)SvPV(value, PL_na);
            he = GetHostByName(thresh_host);
            if(he == (struct hostent *) NULL) {
              sprintf(buffer,
                      "Couldn't parse fsthresh flag; unable to resolve hostname %s\n",
                      thresh_host);
              BSETCODE(-1, buffer);
              XSRETURN_UNDEF;
            }
            thresh_host = he->h_name;
          }
          else if(strcmp(key, "handler")==0) {
            thresh_handler = (char *) SvPV(value, PL_na);
          }
          else {
            thresh_name = key;
            thresh_value = (char *) SvPV(value, PL_na);
          }
        }
        if(thresh_host) global_fsThreshCount = 0;
        else global_fsThreshCount = 1;
        code = my_store_threshold(1, thresh_name, thresh_value, thresh_handler,
                           &global_fsThreshCount, FSnameList, thresh_host,
                           numFS, buff2);
        if(code) {
          sprintf(buffer, "Unable to store threshold %s. %s", thresh_name, buff2);
          BSETCODE(code, buffer);
          XSRETURN_UNDEF;
        }
      }
    }

    if (cmthresh_array) {
      if(!numCM) {
        sprintf(buffer, "Cannot use cmthresh option without specifying cmhosts");
        BSETCODE(-1, buffer);
        XSRETURN_UNDEF;
      }
      num = av_len(cmthresh_array);
      for (i=0; i<=num; i++) {
        thresh_host = 0;
        thresh_handler = "";
        thresh_entry = (HV*) SvRV(*av_fetch(cmthresh_array, i, 0));
        hv_iterinit(thresh_entry);
        while((value = hv_iternextsv(thresh_entry, &key, &keylen))) {
          if(strcmp(key, "host")==0) {
            thresh_host = (char *)SvPV(value, PL_na);
            he = GetHostByName(thresh_host);
            if(he == (struct hostent *) NULL) {
              sprintf(buffer,
                      "Couldn't parse cmthresh flag; unable to resolve hostname %s\n",
                      thresh_host);
              BSETCODE(-1, buffer);
              XSRETURN_UNDEF;
            }
            thresh_host = he->h_name;
          }
          else if(strcmp(key, "handler")==0) {
            thresh_handler = (char *) SvPV(value, PL_na);
          }
          else {
            thresh_name = key;
            thresh_value = (char *) SvPV(value, PL_na);
          }
        }
        sprintf(buffer, "thresh cm %s %s %s", thresh_name, thresh_value, thresh_handler);
        if(!thresh_host) {
          code = my_parse_threshEntry(buffer, &global_fsThreshCount,
                      &global_cmThreshCount, (struct afsmon_hostEntry *) NULL, 0, buff2);
          if (code) {
            sprintf(buffer, "Couldn't parse cmthresh entry. %s", buff2);
            BSETCODE(code, buffer);
            XSRETURN_UNDEF;
          }
        }
        else {
          temp_host = CMnameList;
          found = 0;
          for (j = 0; j < numCM; j++) {
            if(strcmp(thresh_host, temp_host->hostName) == 0) {
              found = 1;
              break;
            }
            temp_host = temp_host->next;
          }
          if(found) {
            code = my_parse_threshEntry(buffer, &global_fsThreshCount,
                                        &global_cmThreshCount, temp_host,
                                        2, buff2);
            if(code) {
              sprintf(buffer, "Couldn't parse cmthresh entry. %s", buff2);
              BSETCODE(code, buffer);
              XSRETURN_UNDEF;
            }
          }
          else {
            sprintf(buffer,
                    "Couldn't parse cmthresh entry for host %s; host not found",
                    thresh_host);
            BSETCODE(-1, buffer);
            XSRETURN_UNDEF;
          }
        }
      }
      if (global_cmThreshCount) {
        temp_host = CMnameList;
        for (i = 0; i < numCM; i++) {
          temp_host->numThresh += global_cmThreshCount;
          temp_host = temp_host->next;
        }
      }
      temp_host = CMnameList;
      for (i = 0; i < numCM; i++) {
        if (temp_host->numThresh) {
          numBytes = temp_host->numThresh * sizeof(struct Threshold);
          temp_host->thresh = (struct Threshold *)malloc(numBytes);
          if (temp_host->thresh == (struct Threshold *) NULL) {
            sprintf(buffer, "Memory Allocation error 2.5");
            BSETCODE(25, buffer);
            XSRETURN_UNDEF;
          }
          memset(temp_host->thresh, 0, numBytes);
        }
        temp_host = temp_host->next;
      }
      num = av_len(cmthresh_array);
      for (i=0; i<=num; i++) {
        thresh_host = 0;
        thresh_handler = "";
        thresh_entry = (HV*) SvRV(*av_fetch(cmthresh_array, i, 0));
        hv_iterinit(thresh_entry);
        while((value = hv_iternextsv(thresh_entry, &key, &keylen))) {
          if(strcmp(key, "host") == 0) {
            thresh_host = (char *)SvPV(value, PL_na);
            he = GetHostByName(thresh_host);
            if(he == (struct hostent *) NULL) {
              sprintf(buffer,
                      "Couldn't parse cmthresh flag; unable to resolve hostname %s\n",
                      thresh_host);
              BSETCODE(-1, buffer);
              XSRETURN_UNDEF;
            }
            thresh_host = he->h_name;
          }
          else if(strcmp(key, "handler")==0) {
            thresh_handler = (char *) SvPV(value, PL_na);
          }
          else {
            thresh_name = key;
            thresh_value = (char *) SvPV(value, PL_na);
          }
        }
        if(thresh_host) global_cmThreshCount = 0;
        else global_cmThreshCount = 1;
        code = my_store_threshold(2, thresh_name, thresh_value, thresh_handler,
                           &global_cmThreshCount, CMnameList, thresh_host,
                           numCM, buff2);
        if(code) {
          sprintf(buffer, "Unable to store threshold %s. %s", thresh_name, buff2);
          BSETCODE(code, buffer);
          XSRETURN_UNDEF;
        }
      }
    }

    /* process configuration file */
    if(config_filename) {
      code = my_process_config_file(config_filename, &numFS, &numCM, &lastHostType,
                                 &last_hostEntry, &fs_showDefault, &cm_showDefault,

src/Monitor.xs  view on Meta::CPAN

              sprintf (buffer, "Unknown authentication level: %s", name);
              BSETCODE(-1, buffer);
              XSRETURN_UNDEF;
            }

        } else if (memcmp( flag, "onlyport", 8) == 0 ) {
            char *name = (char *) SvPV(value, PL_na);
            if ((onlyPort = rxdebug_PortNumber(name)) == -1)
              onlyPort = rxdebug_PortName(name);
            if (onlyPort == -1) {
              sprintf(buffer, "rxdebug: can't resolve port name %s", name);
              VSETCODE(-1, buffer);
              XSRETURN_UNDEF;
            }
        }

        break;

    case 'p':
        if (memcmp( flag, "port", 4) == 0 ) {
            portName = (char *) SvPV(value, PL_na);

src/Monitor.xs  view on Meta::CPAN

      memcpy(&host, th->h_addr, sizeof(afs_int32));
    }
    else host = htonl(0x7f000001);    /* IP localhost */

    if (!portName)
      port = htons(7000);        /* default is fileserver */
    else {
      if ((port = rxdebug_PortNumber(portName)) == -1)
        port = rxdebug_PortName(portName);
      if (port == -1) {
        sprintf(buffer, "rxdebug: can't resolve port name %s", portName);
        VSETCODE(-1, buffer);
        XSRETURN_UNDEF;
      }
    }

    dallyCounter = 0;
    hostAddr.s_addr = host;
    /* add address and port to RETVAL hash */
    hv_store(RETVAL, "address", 7, newSVpv(inet_ntoa(hostAddr), 0), 0);
    hv_store(RETVAL, "port", 4, newSViv(ntohs(port)), 0);
    s = socket(AF_INET, SOCK_DGRAM, 0);
    taddr.sin_family = AF_INET;
    taddr.sin_port = 0;
    taddr.sin_addr.s_addr = 0;
#ifdef STRUCT_SOCKADDR_HAS_SA_LEN
    taddr.sin_len = sizeof(struct sockaddr_in);
#endif
    code = bind(s, (struct sockaddr *) &taddr, sizeof(struct sockaddr_in));
    FSSETCODE(code);

src/Monitor.xs  view on Meta::CPAN


      }
    }

    /* get connections unless -noconns flag was set */
    /* array of connections added at key 'connections' in RETVAL hash */
    if (!noConns) {
      if (allconns) {
        if (!withAllConn) {
          warn("WARNING: Server doesn't support retrieval of all connections,\n");
          warn("         getting only interesting instead.\n");
          }
      }

      CONNECTIONS = newAV();
      index = 0;
      for ( i = 0; ; i++) {
        code = rx_GetServerConnections(s, host, port, &nextconn, allconns,
                      supportedDebugValues, &tconn,
                      &supportedConnValues);
        if (code < 0) {

src/Monitor.xs  view on Meta::CPAN

        hv_store(TCONN, "type", 4, newSViv(tconn.type), 0);

        if (withSecStats) {
          HV* SECSTATS = newHV();
          hv_store(SECSTATS, "type", 4,
                   newSViv(tconn.secStats.type), 0);
          hv_store(SECSTATS, "level", 5,
                   newSViv(tconn.secStats.level), 0);
          hv_store(SECSTATS, "flags", 5,
                   newSViv(tconn.secStats.flags), 0);
          hv_store(SECSTATS, "expires", 7,
                   newSViv(tconn.secStats.expires), 0);
          hv_store(SECSTATS, "packetsReceived", 15,
                   newSViv(tconn.secStats.packetsReceived), 0);
          hv_store(SECSTATS, "packetsSent", 11,
                   newSViv(tconn.secStats.packetsSent), 0);
          hv_store(SECSTATS, "bytesReceived", 13,
                   newSViv(tconn.secStats.bytesReceived), 0);
          hv_store(SECSTATS, "bytesSent", 9,
                   newSViv(tconn.secStats.bytesSent), 0);
          hv_store(TCONN, "secStats", 8, newRV_inc((SV*)(SECSTATS)), 0);
        }

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

"VL_upDown_SC_group 90 114",
"VL_upDown_DC_group 115 139",
"RPCop_section 4",
"FS_RPCopTimes_group 140 307",
"FS_RPCopErrors_group 308 475",
"FS_RPCopBytes_group 476 511",
"CM_RPCopTimes_group 512 553",
"Auth_Access_section 2",
"Auth_Stats_group 554 565",
"Access_Stats_group 566 570"
/* "Author_Stats_group x y"   -   no information collected at present */
};

src/ppport.h  view on Meta::CPAN


/*
   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.
   Including this header is the first major one, then using dTHR is all the
   appropriate places and using a PL_ prefix to refer to global Perl
   variables is the second.
*/


/* If you use one of a few functions that were not present in earlier
   versions of Perl, please add a define before the inclusion of ppport.h
   for a static include, or use the GLOBAL request in a single module to
   produce a global definition that can be referenced from the other
   modules.

   Function:            Static define:           Extern define:
   newCONSTSUB()        NEED_newCONSTSUB         NEED_newCONSTSUB_GLOBAL

*/


/* To verify whether ppport.h is needed for your module, and whether any
   special defines should be used, ppport.h can be run through Perl to check
   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.

*/



( run in 0.871 second using v1.01-cache-2.11-cpan-49f99fa48dc )