AFS-Monitor

 view release on metacpan or  search on metacpan

LICENSES/COPYING  view on Meta::CPAN

    interactive use in the most ordinary way, to print or display an
    announcement including an appropriate copyright notice and a
    notice that there is no warranty (or else, saying that you provide
    a warranty) and that users may redistribute the program under
    these conditions, and telling the user how to view a copy of this
    License.  (Exception: if the Program itself is interactive but
    does not normally print such an announcement, your work based on
    the Program is not required to print an announcement.)

These requirements apply to the modified work as a whole.  If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works.  But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.

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

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

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

LICENSES/COPYING  view on Meta::CPAN

    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
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component

LICENSES/COPYING  view on Meta::CPAN

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
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.

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

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

This section is intended to make thoroughly clear what is believed to
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.

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

LICENSES/IBM-LICENSE  view on Meta::CPAN

   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
   or omissions of such Commercial Contributor in connection with its
   distribution of the Program in a commercial product offering. The
   obligations in this section do not apply to any claims or Losses
   relating to any actual or alleged intellectual property infringement.
   In order to qualify, an Indemnified Contributor must: a) promptly
   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

examples/Meltdown.pl  view on Meta::CPAN

#	Jul 02, 2002 - Rex Basham - Added check for wproc, left out during the
#				    original conversion from awk/csh scripts.
#	Mar 21, 2002 - Rex Basham - Merged original csh and awk scripts
#	                            and converted to perl
#	Mar 23, 2002 - Rex Basham - Fixed the display format and added
#                                   field format expansion
#       August 2004  - SLAC       - modified to use the Perl rxdebu function
#
#   Aug 30, 2006 - Jeff Blaine - Added CSV stats output mode
#
# Parameters are -s <server> -p <port> -t <sleeptime in seconds>
# and -C to enable CSV-output mode
#
# Example:
#	Meltdown.pl -s point -p 7000 -t 300
#
#	Check the server 'point' on port '7000' with 5 minutes between
#	rxdebug commands.
#

use blib;
use AFS::Monitor;

sub Usage {
	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)	: "";

examples/Meltdown.pl  view on Meta::CPAN

	}
}

#
# if they didn't give us a server name, we can't run
#
if ($server eq "") {
	&Usage();
}
else {
	print "\nServer: $server, Port: $port, Interval $delay seconds\n";
	system date;
}

#
# clear the counters for the first run
#
$wproc	= 0;
$wpack	= 0;
$fpack	= 0;
$calls	= 0;

examples/Meltdown.pl  view on Meta::CPAN

        }
		$linecnt = 1;
	}
	else {
		$linecnt++;
	}

	#
	# snag the current time
	#
	($sec,$min,$hour,$mday,$month,$year,$wday,$yday,$isDST) = localtime();


	#
	# fire the command and collect the stats
	#

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

examples/Meltdown.pl  view on Meta::CPAN


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

examples/afsmonitor  view on Meta::CPAN

}

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

examples/afsmonitor  view on Meta::CPAN

  }

  if ($readable) {
    print "\nFile Servers:\n";

    foreach my $host (@$fsinfo) {
      print "\nFS HOSTNAME: $host->{hostName}\n";
      if ($host->{probeOK}) {
        print " probe successful\n";

        foreach my $section (sort keys %$host) {
          if (ref $host->{$section}) {
            print "\n $section:\n";

            foreach my $group (sort keys %{$host->{$section}}) {
              print "\n  $group\n";

              foreach my $item (sort keys %{$host->{$section}->{$group}}) {
                print "    $item";
                for (my $i = 0; $i <= 30 - length($item); $i++) {
                  print " ";
                }
                print "$host->{$section}->{$group}->{$item}->{value}";
                if ($host->{$section}->{$group}->{$item}->{overflow}) {
                  print " (overflow)\n";
                  print "     threshold: $host->{$section}->{$group}->{$item}->{threshold}\n";
                  if ($host->{$section}->{$group}->{$item}->{overflow} ne 1) {
                    print "\n";
                    system($host->{$section}->{$group}->{$item}->{overflow});
                  }
                }
                print "\n";
              }
            }
          }
        }
      }
      else {
        print "\n probe failed";

examples/afsmonitor  view on Meta::CPAN

    }


    print "\nCache Managers:\n";

    foreach my $host (@$cminfo) {
      print "\nCM HOSTNAME: $host->{hostName}\n";
      if ($host->{probeOK}) {
        print " probe successful\n";

        foreach my $section (sort keys %$host) {
          if (ref $host->{$section}) {
            print "\n $section:\n";

            foreach my $group (sort keys %{$host->{$section}}) {
              print "\n  $group\n";

              foreach my $item (sort keys %{$host->{$section}->{$group}}) {
                print "    $item";
                for (my $i = 0; $i <= 30 - length($item); $i++) {
                  print " ";
                }
                print "$host->{$section}->{$group}->{$item}->{value}";
                if ($host->{$section}->{$group}->{$item}->{overflow}) {
                  print " (overflow)\n";
                  print "     threshold: $host->{$section}->{$group}->{$item}->{threshold}\n";
                  if ($host->{$section}->{$group}->{$item}->{overflow} ne 1) {
                    print "\n";
                    system($host->{$section}->{$group}->{$item}->{overflow});
                  }
                }
                print "\n";
              }
            }
          }
        }
      }
      else {
        print "\n probe failed";

examples/afsmonitor  view on Meta::CPAN

    }
  }

  if ($shortoutput) {
    print "\nFile Servers:\n";

    foreach my $host (@$fsinfo) {
      print "\nHOST: $host->{hostName}";
      if ($host->{probeOK}) {

        foreach my $section (sort keys %$host) {
          if (ref $host->{$section}) {
            print "\n******* $section *******";

            foreach my $group (sort keys %{$host->{$section}}) {
              print "\n   [[$group]]   ";

              foreach my $item (sort keys %{$host->{$section}->{$group}}) {
                print "$item $host->{$section}->{$group}->{$item}->{value}";
                if ($host->{$section}->{$group}->{$item}->{overflow}) {
                  print " (";
                  print "thresh: $host->{$section}->{$group}->{$item}->{threshold}";
                  if ($host->{$section}->{$group}->{$item}->{overflow} ne 1) {
                    print ", handler";
                  }
                  print ")";
                }
                print " | ";
              }
            }
          }
        }
      }

examples/afsmonitor  view on Meta::CPAN

      print "\n";
    }


    print "\nCache Managers:\n";

    foreach my $host (@$cminfo) {
      print "\nHOST: $host->{hostName}";
      if ($host->{probeOK}) {

        foreach my $section (sort keys %$host) {
          if (ref $host->{$section}) {
            print "\n******* $section *******";

            foreach my $group (sort keys %{$host->{$section}}) {
              print "\n   [[$group]]   ";

              foreach my $item (sort keys %{$host->{$section}->{$group}}) {
                print "$item $host->{$section}->{$group}->{$item}->{value}";
                if ($host->{$section}->{$group}->{$item}->{overflow}) {
                  print " (";
                  print "thresh: $host->{$section}->{$group}->{$item}->{threshold}";
                  if ($host->{$section}->{$group}->{$item}->{overflow} ne 1) {
                    print ", handler";
                  }
                  print ")";
                }
                print " | ";
              }
            }
          }
        }
      }

examples/configs/badconfig  view on Meta::CPAN

#
# Copyright © 2004 Alf Wachsmann <alfw@slac.stanford.edu> and
#                  Elizabeth Cassell <e_a_c@mailsnare.net>
#
# $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

examples/configs/configfile  view on Meta::CPAN

#
# Copyright © 2004 Alf Wachsmann <alfw@slac.stanford.edu> and
#                  Elizabeth Cassell <e_a_c@mailsnare.net>
#
# $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

examples/rxdebug  view on Meta::CPAN

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

      my $minrtt = $val->{rxstats}->{minRtt}->{usec} / 1000000.00;
         $minrtt = $minrtt + $val->{rxstats}->{minRtt}->{sec};
      my $maxrtt = $val->{rxstats}->{maxRtt}->{usec} / 1000000.00;
         $maxrtt = $maxrtt + $val->{rxstats}->{maxRtt}->{sec};
      printf("   Minimum rtt is %0.3f, maximum is %0.3f\n",
            $minrtt,
            $maxrtt);
    }

    print "   ", $val->{rxstats}->{nServerConns}, " server connections, ",
           $val->{rxstats}->{nClientConns}, " client connections, ",
           $val->{rxstats}->{nPeerStructs}, " peer structs, ",
           $val->{rxstats}->{nCallStructs}, " call structs, ",
           $val->{rxstats}->{nFreeCallStructs}, " free call structs\n";

examples/rxdebug  view on Meta::CPAN

        }
        if ($val->{connections}->[$i]->{flags} & constant("RX_CONN_DESTROY_ME")) {
          print " DESTROYED";
        }
        if ($val->{connections}->[$i]->{flags} & constant("RX_CONN_USING_PACKET_CKSUM")) {
          print " pktCksum";
        }
        print ", ";
      }

      print "security index $val->{connections}->[$i]->{securityIndex}, ";
      if ($val->{connections}->[$i]->{type} == constant("RX_CLIENT_CONNECTION")) {
        print "client conn\n";
      } else {
        print "server conn\n";
      }

      # print secStats if this connection has them
      if (exists $val->{connections}->[$i]->{secStats}) {
        my $secStatsType = $val->{connections}->[$i]->{secStats}->{type};
        if ($secStatsType == 0) {
          if ($val->{connections}->[$i]->{securityIndex} == 2) {
            print "  no GetStats procedure for security object\n";
          }
        } elsif ($secStatsType == 1) {
          print "  rxnull level=", $val->{connections}->[$i]->{secStats}->{level};
          print ", flags=", $val->{connections}->[$i]->{secStats}->{flags},"\n";
        } elsif ($secStatsType == 2) {
          print "  rxvab level=", $val->{connections}->[$i]->{secStats}->{level};
          print ", flags=", $val->{connections}->[$i]->{secStats}->{flags},"\n";
        } elsif ($secStatsType == 3) {
          my $secStatsLevel;
          my $secStatsFlags = $val->{connections}->[$i]->{secStats}->{flags};
          if ($val->{connections}->[$i]->{secStats}->{level} == 0) {
            $secStatsLevel = "clear";
          } elsif ($val->{connections}->[$i]->{secStats}->{level} == 1) {
            $secStatsLevel = "auth";
          } elsif ($val->{connections}->[$i]->{secStats}->{level} == 2) {
            $secStatsLevel = "crypt";
          } else {
            $secStatsLevel = "unknown";
          }
          print "  rxkad: level ", $secStatsLevel;
          if ($secStatsFlags) {
            print ", flags";
          }
          if ($secStatsFlags & 1) {
            print " unalloc";
          }
          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 {
          print "  unknown\n";
        }
      } # done printing secStats

      # print calls for this connection
      for (my $j = 0; $j < constant("RX_MAXCALLS"); $j++) {
        print "    call ", $j, ": # ", $val->{connections}->[$i]->{callNumber}->[$j], ", state ";

        # print call state
        if ($val->{connections}->[$i]->{callState}->[$j] == constant("RX_STATE_NOTINIT")) {
          print "not initialized\n";
          next;
        } elsif ($val->{connections}->[$i]->{callState}->[$j] == constant("RX_STATE_PRECALL")) {

examples/rxdebug  view on Meta::CPAN

              $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;
      my $tpeer_rtt_dev = $val->{peers}->[$i]->{rtt_dev} >> 2;
      printf("\trtt %d msec, rtt_dev %d msec\n",
             $tpeer_rtt, $tpeer_rtt_dev);

      my $timeoutusec = $val->{peers}->[$i]->{timeout}->{usec};
      $timeoutusec = $timeoutusec / 1000;
      printf("\ttimeout %d.%03d sec\n",
              $val->{peers}->[$i]->{timeout}->{sec}, $timeoutusec);

      # prints extra information if -long flag was set
      if (exists $val->{peers}->[$i]->{inPacketSkew}) {
        printf("\tin/out packet skew: %d/%d\n",
                $val->{peers}->[$i]->{inPacketSkew},
                $val->{peers}->[$i]->{outPacketSkew});
        printf("\tcongestion window %d, MTU %d\n",
                $val->{peers}->[$i]->{cwind},
                $val->{peers}->[$i]->{MTU});
        printf("\tcurrent/if/max jumbogram size: %d/%d/%d\n",

examples/udebug  view on Meta::CPAN


    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);
    if (abs($diff) >= constant("MAXSKEW")) {
      print "****clock may be bad\n";
    }
    if (exists $info->{lastYesHost}) {
      $diff = $info->{now} - $info->{lastYesTime};
      printf("Last yes vote for %s was %d secs ago (%ssync site); \n",
             $info->{lastYesHost}, $diff, $info->{lastYesState} ? "" : "not ");
      $diff = $info->{now} - $info->{lastYesClaim};
      printf("Last vote started %d secs ago (at %s)\n",
              $diff,
              scalar localtime(time - $diff));
    } else {
      print "Last yes vote not cast yet \n";
    }

    printf "Local db version is %d.%d\n",
            $info->{localVersion}->{epoch},
            $info->{localVersion}->{counter};
    if ($info->{amSyncSite}) {
      if ($info->{syncSiteUntil} == 0x7fffffff) {
        printf("I am sync site forever (%d server%s)\n",
		$info->{nServers},
                $info->{nServers} > 1 ? "s" : "");
      } else {
        $diff = $info->{syncSiteUntil} - $info->{now};
        printf("I am sync site until %d secs from now (at %s) (%d server%s)\n",
                $diff,
                scalar localtime(time + $diff),
                $info->{nServers},
                $info->{nServers} > 1 ? "s" : "");
      }
      printf("Recovery state %x\n", $info->{recoveryState});
      if ($info->{activeWrite}) {
        printf("I am currently managing write trans %d.%d\n",
                $info->{epochTime},
                $info->{tidCounter});
      }
    } else {
      if ($info->{isClone}) {
        print "I am a clone and never can become sync site\n";
      } else {
        print "I am not sync site\n";
      }
      $diff = $info->{now} - $info->{lowestTime};
      printf("Lowest host %s was set %d secs ago\n",
              $info->{lowestHost}, $diff);

      $diff = $info->{now} - $info->{syncTime};
      printf("Sync host %s was set %d secs ago\n",
              $info->{syncHost}, $diff);
    }

    printf("Sync site's db version is %d.%d\n",
	    $info->{syncVersion}->{epoch},
            $info->{syncVersion}->{counter});
    printf("%d locked pages, %d of them for write\n",
	    $info->{lockedPages},
            $info->{writeLockedPages});

examples/udebug  view on Meta::CPAN

        print "There is an active write transaction\n";
      } else {
        print "There is at least one active read transaction\n";
      }
      printf("Transaction tid is %d.%d\n",
              $info->{syncTid}->{epoch},
              $info->{syncTid}->{counter});
    }
    if ($info->{epochTime}) {
      $diff = $info->{now} - $info->{epochTime};
      printf("Last time a new db version was labelled was:\n\t %d secs ago (at %s)\n",
	      $diff, scalar localtime(time - $diff));
    }

    if (exists $info->{servers}) {
      foreach my $current (@{$info->{servers}}) {
        printf("\nServer (%s", $current->{addr});
        if (exists $current->{altAddr}) {
          print " ", join(" ", @{$current->{altAddr}});
        }
        printf("): (db %d.%d)",

examples/udebug  view on Meta::CPAN

                $current->{remoteVersion}->{counter});
        if ($current->{isClone}) {
          print "    is only a clone!";
        }
        print "\n";

        if ($current->{lastVoteTime} == 0) {
          print "    last vote never rcvd \n";
        } else {
          $diff = $info->{now} - $current->{lastVoteTime};
          printf("    last vote rcvd %d secs ago (at %s),\n",
                  $diff, scalar localtime(time - $diff));
        }

        if ($current->{lastBeaconSent} == 0) {
          print "    last beacon never sent \n";
        } else {
          $diff = $info->{now} - $current->{lastBeaconSent};
          printf("    last beacon sent %d secs ago (at %s), last vote was %s\n",
                 $diff,
                 scalar localtime(time - $diff),
                 $current->{lastVote} ? "yes" : "no");
        }

        printf("    dbcurrent=%d, up=%d beaconSince=%d\n",
                $current->{currentDB},
                $current->{up},
                $current->{beaconSinceDown});
      }

examples/xstat_fs_test  view on Meta::CPAN

  printf "\t%10d rx_packetsSent_SpecialClass\n", $data->{rx_packetsSent_SpecialClass};
  printf "\t%10d rx_ackPacketsSent\n",     $data->{rx_ackPacketsSent};
  printf "\t%10d rx_pingPacketsSent\n",    $data->{rx_pingPacketsSent};
  printf "\t%10d rx_abortPacketsSent\n",   $data->{rx_abortPacketsSent};
  printf "\t%10d rx_busyPacketsSent\n",    $data->{rx_busyPacketsSent};
  printf "\t%10d rx_dataPacketsSent\n",    $data->{rx_dataPacketsSent};
  printf "\t%10d rx_dataPacketsReSent\n",  $data->{rx_dataPacketsReSent};
  printf "\t%10d rx_dataPacketsPushed\n",  $data->{rx_dataPacketsPushed};
  printf "\t%10d rx_ignoreAckedPacket\n",  $data->{rx_ignoreAckedPacket};
  printf "\t%10d rx_totalRtt_Sec\n",       $data->{rx_totalRtt_Sec};
  printf "\t%10d rx_totalRtt_Usec\n",      $data->{rx_totalRtt_Usec};
  printf "\t%10d rx_minRtt_Sec\n",         $data->{rx_minRtt_Sec};
  printf "\t%10d rx_minRtt_Usec\n",        $data->{rx_minRtt_Usec};
  printf "\t%10d rx_maxRtt_Sec\n",         $data->{rx_maxRtt_Sec};
  printf "\t%10d rx_maxRtt_Usec\n",        $data->{rx_maxRtt_Usec};
  printf "\t%10d rx_nRttSamples\n",        $data->{rx_nRttSamples};
  printf "\t%10d rx_nServerConns\n",       $data->{rx_nServerConns};
  printf "\t%10d rx_nClientConns\n",       $data->{rx_nClientConns};
  printf "\t%10d rx_nPeerStructs\n",       $data->{rx_nPeerStructs};
  printf "\t%10d rx_nCallStructs\n",       $data->{rx_nCallStructs};
  printf "\t%10d rx_nFreeCallStructs\n", $data->{rx_nFreeCallStructs};
  if (defined($data->{rx_nBusies})) {  # only on OpenAFS-1.4.1
    printf "\t%10d rx_nBusies\n\n", $data->{rx_nBusies};

    printf "\t%10d fs_nBusies\n", $data->{fs_nBusies};

pod/afsmon_stats.pod  view on Meta::CPAN

# under the same terms as Perl itself.
#------------------------------------------------------------------------------

=head1 NAME

B<afsmonitor Program Statistics> - a list of the statistics you can gather with the afsmonitor program.

=head1 DESCRIPTION

A complete listing of Cache Manager and File Server statistics gathered by the
L<afsmonitor(1)> function. The statistics are grouped by category and section,
with a brief description of each field, group, and section. For more information
about the L<afsmonitor(1)> function, see the L<afsmonitor(1)> documentation.

=head1 The Cache Manager Statistics

Cache Manager statistics fields are classified into the following sections and
groups:

=over

=item *

PerfStats_section - Performance Statistics Section.

=over

=item *

PerfStats_group - Performance Statistics Group.

=item *

misc_group - Miscellaneous Group.

=back

=item *

Server_UpDown_section - Server Up/Down Statistics Section.

=over

=item *

FS_upDown_SC_group - File Server Up/Down Statistics in Same Cell Group.

=item *

FS_upDown_OC_group - File Server Up/Down Statistics in Other Cells Group.

pod/afsmon_stats.pod  view on Meta::CPAN

VL_upDown_SC_group - VL Server Up/Down Statistics in Same Cell Group.

=item *

VL_upDown_OC_group - VL Server Up/Down Statistics in Other Cells Group.

=back

=item *

RPCop_section - RPC Operation Measurements Section.

=over

=item *

FS_RPCopTimes_group - File Server RPC Operation Timings Group.

=item *

FS_RPCopErrors_group - File Server RPC Operation Errors Group.

pod/afsmon_stats.pod  view on Meta::CPAN

FS_RPCopBytes_group - File Server RPC Transfer Timings Group.

=item *

CM_RPCopTimes_group - Cache Manager RPC Operation Timings Group.

=back

=item *

Auth_Access_section - Authentication and Replicated File Access Section.

=over

=item *

Auth_Stats_group - Authentication Information for Cache Manager Group.

=item *

Access_Stats_group - Unreplicated File Access Group.

=back

=back

All Cache Manager variables categorized under these sections and groups names
are listed below.

=head2 Performance Statistics Section (PerfStats_section)

Performance Statistics Group (PerfStats_group)

=over

=item *

dlocalAccesses: Number of data accesses to files within local cell.

=item *

pod/afsmon_stats.pod  view on Meta::CPAN

=item *

numCellsVisible: Number of cells we know about.

=item *

numCellsContacted: Number of cells contacted.

=back

=head2 Server Up/Down Statistics Section (Server_UpDown_section)

File Server Up/Down Statistics in Same Cell Group (FS_upDown_SC_group)

Note: The records referred to in this section are the internal records kept by the afsmonitor program to track the processes from which data is being gathered.

=over

=item *

fs_sc_numTtlRecords: Number of fileserver records, active or inactive.

=item *

fs_sc_numUpRecords: Number of (active) fileserver records currently marked up.

pod/afsmon_stats.pod  view on Meta::CPAN

=item *

fs_sc_numRecordsNeverDown: Number of fileserver records never marked down.

=item *

fs_sc_maxDowntimesInARecord: Maximum downtimes seen by any fileserver record.

=item *

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

=item *

fs_sc_shortestDowntime: Shortest downtime, in seconds.

=item *

fs_sc_longestDowntime: Longest downtime, in seconds.

=item *

fs_sc_down_0_10_min: Down time incidents: 0-10 minutes.

=item *

fs_sc_down_10_30_min: Down time incidents: 10-30 minutes.

=item *

pod/afsmon_stats.pod  view on Meta::CPAN

=item *

fs_oc_numRecordsNeverDown: Number of fileserver records never marked down.

=item *

fs_oc_maxDowntimesInARecord: Maximum downtimes seen by any fileserver.

=item *

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

=item *

fs_oc_shortestDowntime: Shortest downtime, in seconds.

=item *

fs_oc_longestDowntime: Longest downtime, in seconds.

=item *

fs_oc_down_0_10_min: Down time incidents: 0-10 minutes.

=item *

fs_oc_down_10_30_min: Down time incidents: 10-30 minutes.

=item *

pod/afsmon_stats.pod  view on Meta::CPAN

=item *

vl_sc_numRecordsNeverDown: Number of vlserver records never marked down.

=item *

vl_sc_maxDowntimesInARecord: Maximum downtimes seen by any vlserver record.

=item *

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

=item *

vl_sc_shortestDowntime: Shortest downtime, in seconds.

=item *

vl_sc_longestDowntime: Longest downtime, in seconds.

=item *

vl_sc_down_0_10_min: Down time incidents: 0-10 minutes.

=item *

vl_sc_down_10_30_min: Down time incidents: 10-30 minutes.

=item *

pod/afsmon_stats.pod  view on Meta::CPAN

=item *

vl_oc_numRecordsNeverDown: Number of vlserver records never marked down.

=item *

vl_oc_maxDowntimesInARecord: Maximum downtimes seen by any vlserver record.

=item *

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

=item *

vl_oc_shortestDowntime: Shortest downtime, in seconds.

=item *

vl_oc_longestDowntime: Longest downtime, in seconds.

=item *

vl_oc_down_0_10_min: Down time incidents: 0-10 minutes.

=item *

vl_oc_down_10_30_min: Down time incidents: 10-30 minutes.

=item *

pod/afsmon_stats.pod  view on Meta::CPAN

=item *

vl_oc_downDst_10_50: Down time incidents: 10-50 times.

=item *

vl_oc_downDst_more_50: Down time incidents: more than 50 times.

=back

=head2 RPC Operation Measurements Section (RPCop_section)

File Server RPC Operation Timings Group (FS_RPCopTimes_group)

=over

=item *

FetchData_ops: Number of FetchData operations executed.

=item *

pod/afsmon_stats.pod  view on Meta::CPAN

=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

=head2 Authentication and Replicated File Access Section (Auth_Access_section)

Authentication Information for Cache Manager Group (Auth_Stats_group)

=over

=item *

curr_PAGs: Current number of PAGs.

=item *

pod/afsmon_stats.pod  view on Meta::CPAN


=item *

refFirstReplicaOK: Number of references satisfied by 1st replica.

=back

=head1 The File Server Statistics


File Server statistics are classified into the following sections and groups:

=over

=item *

PerfStats_section: Performance Statistics Section.

=over

=item *

VnodeCache_group: Vnode Cache Group.

=item *

Directory_group: Directory Package Group.

pod/afsmon_stats.pod  view on Meta::CPAN

HostModule_group: Host Module Fields Group.

=item *

misc_group: Miscellaneous Variables Group.

=back

=item *

RPCop_section: RPC Operations Section.

=over

=item *

RPCopTimes_group: Individual RPC Operation Timings.

=item *

RPCopBytes_group: Byte Information for Certain RPC Operations.

=back

=back

All File Server variables categorized under the above sections and groups names are listed below.

=head2 Performance Statistics Section (PerfStats_section)

Vnode Cache Group (VnodeCache_group)

=over

=item *

vcache_L_Entries: Number of entries in LARGE vnode cache.

=item *

pod/afsmon_stats.pod  view on Meta::CPAN

=item *

rx_dataPacketsPushed: Retransmissions pushed by NACK.

=item *

rx_ignoreAckedPacket: Packets with ACKed flag on rxi_Start.

=item *

rx_totalRtt_Sec and rx_totalRtt_Usec: Total round trip time (in seconds and milliseconds).

=item *

rx_minRtt_Sec and rx_minRtt_Usec: Minimum round trip time (in seconds and milliseconds).

=item *

rx_maxRtt_Sec and rx_maxRtt_Usec: Maximum round trip time (in seconds and milliseconds).

=item *

rx_nRttSamples: Round trip samples.

=item *

rx_nServerConns: Total server connections.

=item *

pod/afsmon_stats.pod  view on Meta::CPAN

Miscellaneous Variables Group (misc_group)

=over

=item *

numPerfCalls: Number of performance calls received.

=back

=head2 RPC Operations Section (RPCop_section)

Individual RPC Operation Timings Group (RPCopTimes_group)

=over

=item *

epoch: Time when data collection began.

=item *

pod/afsmonitor.pod  view on Meta::CPAN

    }
    else {
      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"
                        },

pod/afsmonitor.pod  view on Meta::CPAN

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">
section below for more information on this file.

=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

pod/afsmonitor.pod  view on Meta::CPAN

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

pod/afsmonitor.pod  view on Meta::CPAN

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

pod/afsmonitor.pod  view on Meta::CPAN


=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

pod/afsmonitor.pod  view on Meta::CPAN

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.

pod/cmdebug.pod  view on Meta::CPAN

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

pod/scout.pod  view on Meta::CPAN

  $scout = scout(server   => "serverName1");

  $scout = scout(server   => ["serverName1", "serverName2"],
                 basename => "example.com",
                 debug    => "debug_out/debug.file"
                );

=head1 DESCRIPTION

The B<scout> function gathers statistics from the File Server process running
on each machine specified with the B<server> argument. The B<Output> section
explains the meaning of the statistics.

=head1 OPTIONS

=over

=item B<server>

String with one name or reference to an array with names of one or
more machines from which to gather File Server statistics.

pod/udebug.pod  view on Meta::CPAN


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

=item B<lastYesHost>, B<lastYesTime> and B<lastYesClaim>

If the B<udebug> function was issues during the coordinator election
process and voting has not yet begun, this key will not exist.
Otherwise, this key indicates which peer this Ubik process last voted
for as coordinator (it can vote for itself). The key B<lastYesTime>
contains the time (in seconds since the Epoch), of the vote. The key
B<lastYesClaim> contains the time (in seconds since the Epoch) that the
Ubik coordinator requested confirming votes from the secondary sites.
Usually, the B<lastYesTime> and B<lastYesClaim> values are the same;
a difference between them can indicate clock skew or a slow network
connection between the two database server machines. A small difference
is not harmful.

=item B<localVersion>

A reference to a hash containing information about the current
version number of the database maintained by this Ubik process.
It has two entries:

pod/udebug.pod  view on Meta::CPAN


This field indicates the number of changes since the election.

=back

=item B<amSyncSite>, B<syncSiteUntil> and B<nServers>

Indicates whether the Ubik process is the coordinator or not.
If there are multiple database sites, and the B<server> argument
names the coordinator (synchronization site), then the B<syncSiteUntil>
entry indicates the time (in seconds since the Epoch) the site will
remain coordinator even if the next attempt to maintain quorum fails.
The entry B<nServers> indicates how many sites are participating
in the quorum.

=item B<recoveryState>

If there are multiple database sites, and the B<server> argument
names the coordinator (synchronization site), then this entry will
contain a hexadecimal number that indicates the current state of the quorum.
A value of C<1f> indicates complete database synchronization, whereas a value
of C<f> means that the coordinator has the correct database but cannot contact
all secondary sites to determine if they also have it. Lesser values are
acceptable if the B<udebug> function is issued during coordinator election, but
they denote a problem if they persist. The individual flags have the
following meanings:

=over

=item C<0x1>

This machine is the coordinator

pod/udebug.pod  view on Meta::CPAN

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>

pod/udebug.pod  view on Meta::CPAN


=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,
this reports the time (in seconds since the Epoch) the current coordinator
last updated the database.

=item B<servers>

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.

=item B<lastVoteTime>

The time, in seconds since the Epoch, the coordinator last received a vote
message from the Ubik process at the site.
If the B<udebug> function is issued during the coordinator election process
and voting has not yet begun, this will be 0.

=item B<lastBeaconSent>

The time, in seconds since the Epoch, the coordinator last requested a vote message.
If the B<udebug> function is issued during the coordinator election process
and voting has not yet begun, this will be 0.

=item B<lastVote>

True if the last vote was yes; false if the last vote was no.

=item B<currentDB>

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

pod/udebug.pod  view on Meta::CPAN


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
format, refer to the B<udebug> script in the B<examples> directory.

pod/xstat_cm_test.pod  view on Meta::CPAN

=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).

=item B<probeOK>

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

=item B<data>

If the probe was not successful, this key will not exist. Otherwise, this
entry will contain a reference to a hash containing all of the data collected.

pod/xstat_fs_test.pod  view on Meta::CPAN

=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).

=item B<probeOK>

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

=item B<data>

If the probe was not successful, this key will not exist. Otherwise, this
entry will contain a reference to a hash containing all of the data collected.

src/Monitor.xs  view on Meta::CPAN

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

   hv_store(RXSTATS, "nRttSamples", 11, newSViv(rxstats->nRttSamples), 0);

   TOTALRTT = newHV();
   hv_store(TOTALRTT, "sec", 3, newSViv(rxstats->totalRtt.sec), 0);
   hv_store(TOTALRTT, "usec", 4, newSViv(rxstats->totalRtt.usec), 0);
   hv_store(RXSTATS, "totalRtt", 8, newRV_inc((SV *) (TOTALRTT)), 0);
   MINRTT = newHV();
   hv_store(MINRTT, "sec", 3, newSViv(rxstats->minRtt.sec), 0);
   hv_store(MINRTT, "usec", 4, newSViv(rxstats->minRtt.usec), 0);
   hv_store(RXSTATS, "minRtt", 6, newRV_inc((SV *) (MINRTT)), 0);
   MAXRTT = newHV();
   hv_store(MAXRTT, "sec", 3, newSViv(rxstats->maxRtt.sec), 0);
   hv_store(MAXRTT, "usec", 4, newSViv(rxstats->maxRtt.usec), 0);
   hv_store(RXSTATS, "maxRtt", 6, newRV_inc((SV *) (MAXRTT)), 0);

#if !defined(AFS_PTHREAD_ENV) && !defined(AFS_USE_GETTIMEOFDAY)
   hv_store(RXSTATS, "clock_nUpdates", 14, newSViv(clock_nUpdates), 0);
#endif
}

/* end of rxdebug helper functions */


src/Monitor.xs  view on Meta::CPAN


   len1 = strlen(s1);
   len2 = strlen(s2);

   if (len1 < len2)
      return ((char *)NULL);

   ptr = s1;

   while (len1 >= len2 && len1 > 0) {
      if ((strncasecmp(ptr, s2, len2)) == 0)
         return (ptr);
      ptr++;
      len1--;
   }
   return ((char *)NULL);
}
#endif           /* __USE_GNU */


/*

src/Monitor.xs  view on Meta::CPAN

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

src/Monitor.xs  view on Meta::CPAN

   short *fs_showFlags;
   short *cm_showFlags;
   char *buffer;
{

   char opcode[CFG_STR_LEN];    /* specifies type of config entry */
   char arg1[CFG_STR_LEN];      /* show fs or cm entry ? */
   char arg2[CFG_STR_LEN];      /* what we gotta show  */
   char arg3[CFG_STR_LEN];      /* junk */
   char catName[CFG_STR_LEN];   /* for category names */
   int numGroups = 0;           /* number of groups in a section */
   int fromIdx = 0;
   int toIdx = 0;
   int found = 0;
   int idx = 0;                 /* index to fs_categories[] */
   int i = 0;
   int j = 0;

   extern char *fs_varNames[];
   extern char *cm_varNames[];
   extern char *fs_categories[];    /* file server data category names */

src/Monitor.xs  view on Meta::CPAN

   arg1[0] = 0;
   arg2[0] = 0;
   arg3[0] = 0;
   sscanf(a_line, "%s %s %s %s", opcode, arg1, arg2, arg3);

   if (arg3[0] != '\0') {
      sprintf(buffer, "Extraneous characters at end of line");
      return (-1);
   }

   if ((strcasecmp(arg1, "fs") != 0) && (strcasecmp(arg1, "cm") != 0)) {
      sprintf(buffer,
              "Second argument of \"show\" directive should be \"fs\" or \"cm\"");
      return (-1);
   }

   /* Each entry can either be a variable name or a section/group name. Variable
    * names are listed in xx_varNames[] and section/group names in xx_categories[].
    * The section/group names in xx_categiries[] also give the starting/ending
    * indices of the variables belonging to that section/group. These indices
    * are stored in order in xx_Display_map[] and displayed to the screen in that
    * order. */

   /* To handle duplicate "show" entries we keep track of what what we have
    * already marked to show in the xx_showFlags[] */

   if (strcasecmp(arg1, "fs") == 0) {   /* its a File Server entry */
      /* mark that we have to show only what the user wants */
      *fs_showDefault = 0;

      /* if it is a section/group name, find it in the fs_categories[] array */

      found = 0;
      if (strcasestr(arg2, "_section") != (char *)NULL
          || strcasestr(arg2, "_group") != (char *)NULL) {
         idx = 0;
         while (idx < FS_NUM_DATA_CATEGORIES) {
            sscanf(fs_categories[idx], "%s %d %d", catName, &fromIdx, &toIdx);
            idx++;
            if (strcasecmp(arg2, catName) == 0) {
               found = 1;
               break;
            }
         }

         if (!found) {  /* typo in section/group name */
            sprintf(buffer, "Could not find section/group name %s", arg2);
            return (-1);
         }
      }

        /* if it is a group name, read its start/end indices and fill in the
         * fs_Display_map[]. */

      if (strcasestr(arg2, "_group") != (char *)NULL) {

         if (fromIdx < 0 || toIdx < 0 || fromIdx > NUM_FS_STAT_ENTRIES ||
             toIdx > NUM_FS_STAT_ENTRIES)
            return (-2);
         for (j = fromIdx; j <= toIdx; j++) {
            fs_showFlags[j] = 1;
         }
      }

      /* if it is a section name */
      else if (strcasestr(arg2, "_section") != (char *)NULL) {
         /* fromIdx is actually the number of groups in this section */
         numGroups = fromIdx;
         /* for each group in section */
         while (idx < FS_NUM_DATA_CATEGORIES && numGroups) {
            sscanf(fs_categories[idx], "%s %d %d", catName, &fromIdx, &toIdx);

            if (strcasestr(catName, "_group") != (char *) NULL) {
               if (fromIdx < 0 || toIdx < 0 || fromIdx > NUM_FS_STAT_ENTRIES
                   || toIdx > NUM_FS_STAT_ENTRIES)
                  return (-4);
               for (j = fromIdx; j <= toIdx; j++) {
                  fs_showFlags[j] = 1;
               }
            }
            else {
               sprintf(buffer, "Error parsing groups for %s", arg2);
               return (-6);
            }
            idx++;
            numGroups--;
         }  /* for each group in section */

      }
      else {    /* it is a variable name */

         for (i = 0; i < NUM_FS_STAT_ENTRIES; i++) {
            if (strcasecmp(arg2, fs_varNames[i]) == 0) {
               fs_showFlags[i] = 1;
               found = 1;
               break;
            }
         }
         if (!found) {  /* typo in variable name */
            sprintf(buffer, "Could not find variable name %s", arg2);
            return (-1);
         }
      } /* its a variable name */

   }

    /* it is an fs entry */
   if (strcasecmp(arg1, "cm") == 0) {   /* its a Cache Manager entry */

      /* mark that we have to show only what the user wants */
      *cm_showDefault = 0;

      /* if it is a section/group name, find it in the cm_categories[] array */

      found = 0;
      if (strcasestr(arg2, "_section") != (char *)NULL
          || strcasestr(arg2, "_group") != (char *)NULL) {
         idx = 0;
         while (idx < CM_NUM_DATA_CATEGORIES) {
            sscanf(cm_categories[idx], "%s %d %d", catName, &fromIdx, &toIdx);
            idx++;
            if (strcasecmp(arg2, catName) == 0) {
               found = 1;
               break;
            }
         }

         if (!found) {  /* typo in section/group name */
            sprintf(buffer, "Could not find section/group name %s", arg2);
            return (-1);
         }
      }

      /* if it is a group name */

      if (strcasestr(arg2, "_group") != (char *)NULL) {

         if (fromIdx < 0 || toIdx < 0 || fromIdx > NUM_CM_STAT_ENTRIES
             || toIdx > NUM_CM_STAT_ENTRIES)
            return (-10);
         for (j = fromIdx; j <= toIdx; j++) {
            cm_showFlags[j] = 1;
         }
      }

      /* if it is a section name, get the count of number of groups in it and
       * for each group fill in the start/end indices in the cm_Display_map[] */

      else if (strcasestr(arg2, "_section") != (char *)NULL) {
         /* fromIdx is actually the number of groups in thi section */
         numGroups = fromIdx;
         /* for each group in section */
         while (idx < CM_NUM_DATA_CATEGORIES && numGroups) {
            sscanf(cm_categories[idx], "%s %d %d", catName, &fromIdx, &toIdx);

            if (strcasestr(catName, "_group") != (char *) NULL) {
               if (fromIdx < 0 || toIdx < 0 || fromIdx > NUM_CM_STAT_ENTRIES
                   || toIdx > NUM_CM_STAT_ENTRIES)
                  return (-12);
               for (j = fromIdx; j <= toIdx; j++) {
                  cm_showFlags[j] = 1;
               }
            }
            else {
               sprintf(buffer, "Error parsing groups for %s", arg2);
               return (-15);
            }
            idx++;
            numGroups--;
         }  /* for each group in section */
      }
      else {    /* it is a variable name */

         for (i = 0; i < NUM_CM_STAT_ENTRIES; i++) {
            if (strcasecmp(arg2, cm_varNames[i]) == 0) {
               cm_showFlags[i] = 1;
               found = 1;
               break;
            }
         }
         if (!found) {  /* typo in section/group name */
            sprintf(buffer, "Could not find variable name %s", arg2);
            return (-1);
         }
      } /* its a variable name */

   }    /* it is a cm entry */

   return (0);

}   /* my_parse_showEntry() */

src/Monitor.xs  view on Meta::CPAN

      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 */
      (*lastHostType) = 1;
      (*numFS)++;
   }
   else if ((strcasecmp(opcode, "cm")) == 0) {
      /* use the complete host name to insert in the CM names list */
      code = my_insert_CM(he->h_name, CMnameList, last_hostEntry);
      if (code)
         return (-1);
      /* last host entry in the config file was cm */
      (*lastHostType) = 2;
      (*numCM)++;
   }
   else {
      return (-1);

src/Monitor.xs  view on Meta::CPAN

   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

src/Monitor.xs  view on Meta::CPAN

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

src/Monitor.xs  view on Meta::CPAN


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

src/Monitor.xs  view on Meta::CPAN

      arg4[0] = 0;
      sscanf(line, "%s %s %s %s %s", opcode, arg1, arg2, arg3, arg4);
      linenum++;
      /* fprintf(STDERR, "Got line %d: \"%s %s %s %s %s\"\n",
       * linenum, opcode, arg1, arg2, arg3, arg4); */
      /* 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"); */
         sprintf(buff2, "Unknown opcode %s", opcode);
         code = 1;
      }

src/Monitor.xs  view on Meta::CPAN

   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++;

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

src/Monitor.xs  view on Meta::CPAN

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

src/Monitor.xs  view on Meta::CPAN

void
my_Print_fs_OpTiming(a_opIdx, a_opTimeP, fs_outFD)
   int a_opIdx;
   struct fs_stats_opTimingData *a_opTimeP;
   FILE *fs_outFD;
{

   fprintf(fs_outFD,
           "%15s: %d ops (%d OK); sum=%d.%06d, min=%d.%06d, max=%d.%06d\n",
           fsOpNames[a_opIdx], a_opTimeP->numOps, a_opTimeP->numSuccesses,
           a_opTimeP->sumTime.tv_sec, a_opTimeP->sumTime.tv_usec,
           a_opTimeP->minTime.tv_sec, a_opTimeP->minTime.tv_usec,
           a_opTimeP->maxTime.tv_sec, a_opTimeP->maxTime.tv_usec);
}   /* my_Print_fs_OpTiming() */


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

void
my_Print_fs_XferTiming(a_opIdx, a_xferP, fs_outFD)
   int a_opIdx;
   struct fs_stats_xferData *a_xferP;
   FILE *fs_outFD;
{

   fprintf(fs_outFD,
           "%s: %d xfers (%d OK), time sum=%d.%06d, min=%d.%06d, max=%d.%06d\n",
           xferOpNames[a_opIdx], a_xferP->numXfers, a_xferP->numSuccesses,
           a_xferP->sumTime.tv_sec, a_xferP->sumTime.tv_usec,
           a_xferP->minTime.tv_sec, a_xferP->minTime.tv_usec,
           a_xferP->maxTime.tv_sec, a_xferP->maxTime.tv_usec);
   fprintf(fs_outFD, "\t[bytes: sum=%d, min=%d, max=%d]\n",
           a_xferP->sumBytes, a_xferP->minBytes, a_xferP->maxBytes);
   fprintf(fs_outFD,
           "\t[buckets: 0: %d, 1: %d, 2: %d, 3: %d, 4: %d, 5: %d 6: %d, 7: %d, 8: %d]\n",
           a_xferP->count[0], a_xferP->count[1], a_xferP->count[2],
           a_xferP->count[3], a_xferP->count[4], a_xferP->count[5],
           a_xferP->count[6], a_xferP->count[7], a_xferP->count[8]);
}   /* my_Print_fs_XferTiming() */


src/Monitor.xs  view on Meta::CPAN


void
my_Print_fs_OverallPerfInfo(a_ovP, fs_outFD)
   struct afs_PerfStats *a_ovP;
   FILE *fs_outFD;
{

   fprintf(fs_outFD, "\t%10d numPerfCalls\n\n", a_ovP->numPerfCalls);

   /*
    * Vnode cache section.
    */
   fprintf(fs_outFD, "\t%10d vcache_L_Entries\n", a_ovP->vcache_L_Entries);
   fprintf(fs_outFD, "\t%10d vcache_L_Allocs\n", a_ovP->vcache_L_Allocs);
   fprintf(fs_outFD, "\t%10d vcache_L_Gets\n", a_ovP->vcache_L_Gets);
   fprintf(fs_outFD, "\t%10d vcache_L_Reads\n", a_ovP->vcache_L_Reads);
   fprintf(fs_outFD, "\t%10d vcache_L_Writes\n\n", a_ovP->vcache_L_Writes);

   fprintf(fs_outFD, "\t%10d vcache_S_Entries\n", a_ovP->vcache_S_Entries);
   fprintf(fs_outFD, "\t%10d vcache_S_Allocs\n", a_ovP->vcache_S_Allocs);
   fprintf(fs_outFD, "\t%10d vcache_S_Gets\n", a_ovP->vcache_S_Gets);
   fprintf(fs_outFD, "\t%10d vcache_S_Reads\n", a_ovP->vcache_S_Reads);
   fprintf(fs_outFD, "\t%10d vcache_S_Writes\n\n", a_ovP->vcache_S_Writes);

   fprintf(fs_outFD, "\t%10d vcache_H_Entries\n", a_ovP->vcache_H_Entries);
   fprintf(fs_outFD, "\t%10d vcache_H_Gets\n", a_ovP->vcache_H_Gets);
   fprintf(fs_outFD, "\t%10d vcache_H_Replacements\n\n",
           a_ovP->vcache_H_Replacements);

   /*
    * Directory package section.
    */
   fprintf(fs_outFD, "\t%10d dir_Buffers\n", a_ovP->dir_Buffers);
   fprintf(fs_outFD, "\t%10d dir_Calls\n", a_ovP->dir_Calls);
   fprintf(fs_outFD, "\t%10d dir_IOs\n\n", a_ovP->dir_IOs);

   /*
    * Rx section.
    */
   fprintf(fs_outFD, "\t%10d rx_packetRequests\n", a_ovP->rx_packetRequests);
   fprintf(fs_outFD, "\t%10d rx_noPackets_RcvClass\n",
           a_ovP->rx_noPackets_RcvClass);
   fprintf(fs_outFD, "\t%10d rx_noPackets_SendClass\n",
           a_ovP->rx_noPackets_SendClass);
   fprintf(fs_outFD, "\t%10d rx_noPackets_SpecialClass\n",
           a_ovP->rx_noPackets_SpecialClass);
   fprintf(fs_outFD, "\t%10d rx_socketGreedy\n", a_ovP->rx_socketGreedy);
   fprintf(fs_outFD, "\t%10d rx_bogusPacketOnRead\n",

src/Monitor.xs  view on Meta::CPAN

           a_ovP->rx_busyPacketsSent);
   fprintf(fs_outFD, "\t%10d rx_dataPacketsSent\n",
           a_ovP->rx_dataPacketsSent);
   fprintf(fs_outFD, "\t%10d rx_dataPacketsReSent\n",
           a_ovP->rx_dataPacketsReSent);
   fprintf(fs_outFD, "\t%10d rx_dataPacketsPushed\n",
           a_ovP->rx_dataPacketsPushed);
   fprintf(fs_outFD, "\t%10d rx_ignoreAckedPacket\n",
           a_ovP->rx_ignoreAckedPacket);
   fprintf(fs_outFD, "\t%10d rx_totalRtt_Sec\n", a_ovP->rx_totalRtt_Sec);
   fprintf(fs_outFD, "\t%10d rx_totalRtt_Usec\n", a_ovP->rx_totalRtt_Usec);
   fprintf(fs_outFD, "\t%10d rx_minRtt_Sec\n", a_ovP->rx_minRtt_Sec);
   fprintf(fs_outFD, "\t%10d rx_minRtt_Usec\n", a_ovP->rx_minRtt_Usec);
   fprintf(fs_outFD, "\t%10d rx_maxRtt_Sec\n", a_ovP->rx_maxRtt_Sec);
   fprintf(fs_outFD, "\t%10d rx_maxRtt_Usec\n", a_ovP->rx_maxRtt_Usec);
   fprintf(fs_outFD, "\t%10d rx_nRttSamples\n", a_ovP->rx_nRttSamples);
   fprintf(fs_outFD, "\t%10d rx_nServerConns\n", a_ovP->rx_nServerConns);
   fprintf(fs_outFD, "\t%10d rx_nClientConns\n", a_ovP->rx_nClientConns);
   fprintf(fs_outFD, "\t%10d rx_nPeerStructs\n", a_ovP->rx_nPeerStructs);
   fprintf(fs_outFD, "\t%10d rx_nCallStructs\n", a_ovP->rx_nCallStructs);
   fprintf(fs_outFD, "\t%10d rx_nFreeCallStructs\n\n",
           a_ovP->rx_nFreeCallStructs);

   /*
    * Host module fields.

src/Monitor.xs  view on Meta::CPAN


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



void
fs_Results_to_Hash(struct fs_Display_Data *fsData, HV *HOSTINFO,
                   short *showFlags, int showDefault)
{
   int secidx;
   int grpidx;
   int numgrp;
   int fromidx;
   int toidx;
   char section[CFG_STR_LEN] = "";
   char group[CFG_STR_LEN] = "";
   HV *ENTRY;
   HV *GROUP;
   HV *SECTION;
   int i;

   secidx = 0;
   grpidx = secidx + 1;

   while (secidx < FS_NUM_DATA_CATEGORIES) {

      sscanf(fs_categories[secidx], "%s %d", section, &numgrp);
      SECTION = newHV();

      while (grpidx <= secidx + numgrp) {
         GROUP = newHV();
         sscanf(fs_categories[grpidx], "%s %d %d", group, &fromidx, &toidx);
         for (i = fromidx; i <= toidx; i++) {
            if (showFlags[i] || showDefault) {
               ENTRY = newHV();
               hv_store(ENTRY, "value", 5, newSVnv(atof(fsData->data[i])), 0);
               hv_store(GROUP, fs_varNames[i], strlen(fs_varNames[i]),
                        newRV_inc((SV *) ENTRY), 0);
            }
         }
         if (HvKEYS(GROUP))
            hv_store(SECTION, group, strlen(group), newRV_inc((SV *) GROUP),
                     0);
         grpidx++;
      }
      if (HvKEYS(SECTION))
         hv_store(HOSTINFO, section, strlen(section),
                  newRV_inc((SV *) SECTION), 0);
      secidx += numgrp + 1;
      grpidx = secidx + 1;
   }
}   /* fs_Results_to_Hash() */



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

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

src/Monitor.xs  view on Meta::CPAN

int
my_xstat_fs_Init(int (*ProbeHandler) (), int xstat_fs_numServers,
                 struct sockaddr_in *a_socketArray,
                 int xstat_fs_numCollections, afs_int32 * xstat_fs_collIDP,
                 char *buffer, ...)
{
   int curr_srv = 0;
   int conn_err = 0;
   char *hostNameFound = "";
   struct xstat_fs_ConnectionInfo *curr_conn = 0, *xstat_fs_ConnInfo = 0;
   struct rx_securityClass *secobj = 0; /*Client security object */
   char buff2[256] = "";
   int PortToUse = 0;
   int code = 0;
   va_list argp;

   xstat_fs_ConnInfo = (struct xstat_fs_ConnectionInfo *)
      malloc(xstat_fs_numServers * sizeof(struct xstat_fs_ConnectionInfo));
   if (xstat_fs_ConnInfo == (struct xstat_fs_ConnectionInfo *) NULL) {
      sprintf(buffer,
              "Can't allocate %d connection info structs (%d bytes)",

src/Monitor.xs  view on Meta::CPAN

            PortToUse++;
         }
         else {
            sprintf(buffer, "Fatal error in rx_Init()");
            return (-1);
         }
      }
   } while (code);

    /*
     * Create a null Rx client security object, to be used by the
     * probe LWP.
     */
   secobj = rxnull_NewClientSecurityObject();
   if (secobj == (struct rx_securityClass *) NULL) {
      /*Delete already-malloc'ed areas */
      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.

src/Monitor.xs  view on Meta::CPAN

         strcpy(curr_conn->hostName, hostNameFound);
      }

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

      curr_conn->rxconn = rx_NewConnection(curr_conn->skt.sin_addr.s_addr,  /*Server addr */
                                           curr_conn->skt.sin_port, /*Server port */
                                           1,   /*AFS service # */
                                           secobj,  /*Security obj */
                                           0);  /*# of above */
      if (curr_conn->rxconn == (struct rx_connection *) NULL) {
         sprintf(buffer,
                 "Can't create Rx connection to server '%s' (%lu)",
                 curr_conn->hostName, curr_conn->skt.sin_addr.s_addr);
         my_xstat_fs_Cleanup(1, xstat_fs_numServers, xstat_fs_ConnInfo,
                             buff2);
         return (-2);
      }
      /*

src/Monitor.xs  view on Meta::CPAN

my_Print_cm_XferTiming(a_opIdx, a_opNames, a_xferP, cm_outFD)
   int a_opIdx;
   char *a_opNames[];
   struct afs_stats_xferData *a_xferP;
   FILE *cm_outFD;
{   /*Print_cm_XferTiming */

   fprintf(cm_outFD,
           "%s: %d xfers (%d OK), time sum=%d.%06d, min=%d.%06d, max=%d.%06d\n",
           a_opNames[a_opIdx], a_xferP->numXfers, a_xferP->numSuccesses,
           a_xferP->sumTime.tv_sec, a_xferP->sumTime.tv_usec,
           a_xferP->minTime.tv_sec, a_xferP->minTime.tv_usec,
           a_xferP->maxTime.tv_sec, a_xferP->maxTime.tv_usec);
   fprintf(cm_outFD, "\t[bytes: sum=%d, min=%d, max=%d]\n", a_xferP->sumBytes,
           a_xferP->minBytes, a_xferP->maxBytes);
   fprintf(cm_outFD,
           "\t[buckets: 0: %d, 1: %d, 2: %d, 3: %d, 4: %d, 5: %d 6: %d, 7: %d, 8: %d]\n",
           a_xferP->count[0], a_xferP->count[1], a_xferP->count[2],
           a_xferP->count[3], a_xferP->count[4], a_xferP->count[5],
           a_xferP->count[6], a_xferP->count[7], a_xferP->count[8]);

}   /* my_Print_cm_XferTiming() */

src/Monitor.xs  view on Meta::CPAN

my_Print_cm_OpTiming(a_opIdx, a_opNames, a_opTimeP, cm_outFD)
   int a_opIdx;
   char *a_opNames[];
   struct afs_stats_opTimingData *a_opTimeP;
   FILE *cm_outFD;
{   /*Print_cm_OpTiming */

   fprintf(cm_outFD,
           "%15s: %d ops (%d OK); sum=%d.%06d, min=%d.%06d, max=%d.%06d\n",
           a_opNames[a_opIdx], a_opTimeP->numOps, a_opTimeP->numSuccesses,
           a_opTimeP->sumTime.tv_sec, a_opTimeP->sumTime.tv_usec,
           a_opTimeP->minTime.tv_sec, a_opTimeP->minTime.tv_usec,
           a_opTimeP->maxTime.tv_sec, a_opTimeP->maxTime.tv_usec);

}   /* my_Print_cm_OpTiming() */



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

src/Monitor.xs  view on Meta::CPAN





/* cm_Results_to_Hash() */

void
cm_Results_to_Hash(struct cm_Display_Data *cmData, HV *HOSTINFO,
                   short *showFlags, int showDefault)
{
   int secidx;
   int grpidx;
   int numgrp;
   int fromidx;
   int toidx;
   char section[CFG_STR_LEN] = "";
   char group[CFG_STR_LEN] = "";
   HV *ENTRY;
   HV *GROUP;
   HV *SECTION;
   int i;

   secidx = 0;
   grpidx = secidx + 1;

   while (secidx < CM_NUM_DATA_CATEGORIES) {

      sscanf(cm_categories[secidx], "%s %d", section, &numgrp);
      SECTION = newHV();

      while (grpidx <= secidx + numgrp) {
         GROUP = newHV();
         sscanf(cm_categories[grpidx], "%s %d %d", group, &fromidx, &toidx);
         for (i = fromidx; i <= toidx; i++) {
            if (showFlags[i] || showDefault) {
               ENTRY = newHV();
               hv_store(ENTRY, "value", 5, newSVnv(atof(cmData->data[i])), 0);
               hv_store(GROUP, cm_varNames[i], strlen(cm_varNames[i]),
                        newRV_inc((SV *) ENTRY), 0);
            }
         }
         if (HvKEYS(GROUP))
            hv_store(SECTION, group, strlen(group), newRV_inc((SV *) GROUP),
                     0);
         grpidx++;
      }
      if (HvKEYS(SECTION))
         hv_store(HOSTINFO, section, strlen(section),
                  newRV_inc((SV *) SECTION), 0);
      secidx += numgrp + 1;
      grpidx = secidx + 1;
   }
}   /* cm_Results_to_Hash() */



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

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

src/Monitor.xs  view on Meta::CPAN

int
my_xstat_cm_Init(int (*ProbeHandler) (), int xstat_cm_numServers,
                 struct sockaddr_in *a_socketArray,
                 int xstat_cm_numCollections, afs_int32 * xstat_cm_collIDP,
                 char *buffer, ...)
{
   int curr_srv = 0;
   int conn_err = 0;
   char *hostNameFound = "";
   struct xstat_cm_ConnectionInfo *curr_conn = 0, *xstat_cm_ConnInfo = 0;
   struct rx_securityClass *secobj = 0; /*Client security object */
   char buff2[256] = "";
   int code = 0;
   va_list argp;

   xstat_cm_ConnInfo = (struct xstat_cm_ConnectionInfo *)
      malloc(xstat_cm_numServers * sizeof(struct xstat_cm_ConnectionInfo));
   if (xstat_cm_ConnInfo == (struct xstat_cm_ConnectionInfo *) NULL) {
      sprintf(buffer,
              "Can't allocate %d connection info structs (%d bytes)",
              xstat_cm_numServers,

src/Monitor.xs  view on Meta::CPAN

      return (-1);  /*No cleanup needs to be done yet */
   }

   code = rx_Init(htons(0));
   if (code) {
      sprintf(buffer, "Fatal error in rx_Init(), error=%d", code);
      return (-1);
   }

    /*
     * Create a null Rx client security object, to be used by the
     * probe LWP.
     */
   secobj = rxnull_NewClientSecurityObject();
   if (secobj == (struct rx_securityClass *) NULL) {
      /*Delete already-malloc'ed areas */
      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.

src/Monitor.xs  view on Meta::CPAN

         strcpy(curr_conn->hostName, hostNameFound);
      }

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

      curr_conn->rxconn = rx_NewConnection(curr_conn->skt.sin_addr.s_addr,  /*Server addr */
                                           curr_conn->skt.sin_port, /*Server port */
                                           1,   /*AFS service # */
                                           secobj,  /*Security obj */
                                           0);  /*# of above */
      if (curr_conn->rxconn == (struct rx_connection *) NULL) {
         sprintf(buffer,
                 "Can't create Rx connection to server '%s' (%lu)",
                 curr_conn->hostName, curr_conn->skt.sin_addr.s_addr);
         my_xstat_cm_Cleanup(1, xstat_cm_numServers, xstat_cm_ConnInfo,
                             buff2);
         return (-2);
      }
      /*

src/Monitor.xs  view on Meta::CPAN

   char *buffer;
{
   static char rn[] = "my_fsprobe_Init";
   struct fsprobe_ConnectionInfo *curr_conn;    /*Current connection */
   int fsprobe_statsBytes;      /*Num bytes in stats block */
   int fsprobe_probeOKBytes;    /*Num bytes in probeOK block */
   int conn_err = 0, code = 0;
   int curr_srv;
   char *hostNameFound;
   int PortToUse;
   struct rx_securityClass *secobj;
   struct rx_securityClass *CBsecobj;
   struct rx_service *rxsrv_afsserver;
   char buff2[256] = "";

   struct rx_call *rxcall;      /*Bogus param */
   AFSCBFids *Fids_Array;       /*Bogus param */
   AFSCBs *CallBack_Array;      /*Bogus param */
   struct interfaceAddr *interfaceAddr; /*Bogus param */


   if (scout_debugfd) {

src/Monitor.xs  view on Meta::CPAN

      }
   } while (code);
   if (scout_debugfd) {
      fprintf(scout_debugfd, "[%s] Rx initialized on port %d\n", rn,
              PortToUse);
      fflush(scout_debugfd);
   }


   /*
    * Create a null Rx server security object, to be used by the
    * Callback listener.
    */
   CBsecobj = (struct rx_securityClass *)rxnull_NewServerSecurityObject();
   if (CBsecobj == (struct rx_securityClass *) NULL) {
      /*Delete already-malloc'ed areas */
      my_fsprobe_Cleanup(fsprobe_Results, *fsprobe_ConnInfo, a_numServers,
                         scout_debugfd, buff2);
      sprintf(buffer,
              "[%s] Can't create null security object for the callback listener. %s",
              rn, buff2);
      return (-1);
   }
   if (scout_debugfd)
      fprintf(scout_debugfd, "[%s] Callback server security object created\n",
              rn);


   /*
    * Create a null Rx client security object, to be used by the
    * probe LWP.
    */
   secobj = (struct rx_securityClass *)rxnull_NewClientSecurityObject();
   if (secobj == (struct rx_securityClass *) NULL) {
      /*Delete already-malloc'ed areas */
      my_fsprobe_Cleanup(fsprobe_Results, *fsprobe_ConnInfo, a_numServers,
                         scout_debugfd, buff2);
      sprintf(buffer,
              "[%s] Can't create client security object for probe LWP. %s",
              rn, buff2);
      return (-1);
   }
   if (scout_debugfd) {
      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.

src/Monitor.xs  view on Meta::CPAN

         fprintf(scout_debugfd,
                 "[%s] Connecting to srv idx %d, IP addr 0x%lx, port %d, service 1\n",
                 rn, curr_srv, curr_conn->skt.sin_addr.s_addr,
                 curr_conn->skt.sin_port);
         fflush(scout_debugfd);
      }

      curr_conn->rxconn = rx_NewConnection(curr_conn->skt.sin_addr.s_addr,  /*Server addr */
                                           curr_conn->skt.sin_port, /*Server port */
                                           1,   /*AFS service num */
                                           secobj,  /*Security object */
                                           0);  /*Number of above */
      if (curr_conn->rxconn == (struct rx_connection *) NULL) {
         sprintf(buffer,
                 "[%s] Can't create Rx connection to server %s (%lu)",
                 rn, curr_conn->hostName, curr_conn->skt.sin_addr.s_addr);
         conn_err = 1;
      }
      if (scout_debugfd) {
         fprintf(scout_debugfd, "[%s] New connection at 0x%lx\n",
                 rn, curr_conn->rxconn);

src/Monitor.xs  view on Meta::CPAN

       */
      if (scout_debugfd) {
         fprintf(scout_debugfd,
                 "[%s] Connecting to srv idx %d, IP addr 0x%lx, port %d, service 1\n",
                 rn, curr_srv, curr_conn->skt.sin_addr.s_addr, htons(7005));
         fflush(scout_debugfd);
      }
      curr_conn->rxVolconn = rx_NewConnection(curr_conn->skt.sin_addr.s_addr,   /*Server addr */
                                              htons(AFSCONF_VOLUMEPORT),    /*Volume Server port */
                                              VOLSERVICE_ID,    /*AFS service num */
                                              secobj,   /*Security object */
                                              0);   /*Number of above */
      if (curr_conn->rxVolconn == (struct rx_connection *) NULL) {
         sprintf(buffer,
                 "[%s] Can't create Rx connection to volume server %s (%lu)\n",
                 rn, curr_conn->hostName, curr_conn->skt.sin_addr.s_addr);
         conn_err = 1;
      }
      else {
         int i, cnt;

src/Monitor.xs  view on Meta::CPAN

   }    /*for curr_srv */

   /*
    * Create the AFS callback service (listener).
    */
   if (scout_debugfd)
      fprintf(scout_debugfd, "[%s] Creating AFS callback listener\n", rn);
   rxsrv_afsserver = rx_NewService(0,   /*Use default port */
                                   1,   /*Service ID */
                                   "afs",   /*Service name */
                                   &CBsecobj,   /*Ptr to security object(s) */
                                   1,   /*Number of security objects */
                                   RXAFSCB_ExecuteRequest); /*Dispatcher */
   if (rxsrv_afsserver == (struct rx_service *) NULL) {
      /*Delete already-malloc'ed areas */
      my_fsprobe_Cleanup(fsprobe_Results, *fsprobe_ConnInfo, a_numServers,
                         scout_debugfd, buff2);
      sprintf(buffer, "[%s] Can't create callback Rx service/listener. %s",
              rn, buff2);
      return (-1);
   }
   if (scout_debugfd)

src/Monitor.xs  view on Meta::CPAN

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

void
my_PrintOpTiming(int a_opIdx, struct fs_stats_opTimingData *a_opTimeP, HV *DATA)
{
   HV *OPTIMING = newHV();

   hv_store(OPTIMING, "sumTime", 7,
            newSVnv(a_opTimeP->sumTime.tv_sec +
                    a_opTimeP->sumTime.tv_usec / 1000000.0), 0);
   hv_store(OPTIMING, "sqrTime", 7,
            newSVnv(a_opTimeP->sqrTime.tv_sec +
                    a_opTimeP->sqrTime.tv_usec / 1000000.0), 0);
   hv_store(OPTIMING, "minTime", 7,
            newSVnv(a_opTimeP->minTime.tv_sec +
                    a_opTimeP->minTime.tv_usec / 1000000.0), 0);
   hv_store(OPTIMING, "maxTime", 7,
            newSVnv(a_opTimeP->maxTime.tv_sec +
                    a_opTimeP->maxTime.tv_usec / 1000000.0), 0);
   hv_store(OPTIMING, "numSuccesses", 12, newSViv(a_opTimeP->numSuccesses),
            0);
   hv_store(OPTIMING, "numOps", 6, newSViv(a_opTimeP->numOps), 0);

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


/*

src/Monitor.xs  view on Meta::CPAN

 */

void
my_PrintXferTiming(int a_opIdx, struct fs_stats_xferData *a_xferP, HV *DATA)
{
   HV *XFERTIMING = newHV();
   AV *COUNT = newAV();
   int i;

   hv_store(XFERTIMING, "sumTime", 7,
            newSVnv(a_xferP->sumTime.tv_sec +
                    a_xferP->sumTime.tv_usec / 1000000.0), 0);
   hv_store(XFERTIMING, "sqrTime", 7,
            newSVnv(a_xferP->sqrTime.tv_sec +
                    a_xferP->sqrTime.tv_usec / 1000000.0), 0);
   hv_store(XFERTIMING, "minTime", 7,
            newSVnv(a_xferP->minTime.tv_sec +
                    a_xferP->minTime.tv_usec / 1000000.0), 0);
   hv_store(XFERTIMING, "maxTime", 7,
            newSVnv(a_xferP->maxTime.tv_sec +
                    a_xferP->maxTime.tv_usec / 1000000.0), 0);
   hv_store(XFERTIMING, "numSuccesses", 12, newSViv(a_xferP->numSuccesses),
            0);
   hv_store(XFERTIMING, "numXfers", 8, newSViv(a_xferP->numXfers), 0);

   hv_store(XFERTIMING, "sumBytes", 8, newSViv(a_xferP->sumBytes), 0);
   hv_store(XFERTIMING, "minBytes", 8, newSViv(a_xferP->minBytes), 0);
   hv_store(XFERTIMING, "maxBytes", 8, newSViv(a_xferP->maxBytes), 0);

   for (i = 0; i <= 8; i++)
      av_store(COUNT, i, newSViv(a_xferP->count[i]));

src/Monitor.xs  view on Meta::CPAN

 */

void
my_PrintDetailedPerfInfo(struct fs_stats_DetailedStats *a_detP, HV *DATA)
{
   int currIdx;
   HV *OPTIMES = newHV();
   HV *XFERS = newHV();

   hv_store(DATA, "epoch", 5,
            newSVnv(a_detP->epoch.tv_sec + a_detP->epoch.tv_usec / 1000000.0),
            0);

   for (currIdx = 0; currIdx < FS_STATS_NUM_RPC_OPS; currIdx++)
      my_PrintOpTiming(currIdx, &(a_detP->rpcOpTimes[currIdx]), OPTIMES);

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

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

src/Monitor.xs  view on Meta::CPAN

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

void
my_PrintOverallPerfInfo(struct afs_PerfStats *a_ovP, HV *DATA)
{
   hv_store(DATA, "numPerfCalls", strlen("numPerfCalls"),
            newSViv(a_ovP->numPerfCalls), 0);

   /*
    * Vnode cache section.
    */
   hv_store(DATA, "vcache_L_Entries", strlen("vcache_L_Entries"),
            newSViv(a_ovP->vcache_L_Entries), 0);
   hv_store(DATA, "vcache_L_Allocs", strlen("vcache_L_Allocs"),
            newSViv(a_ovP->vcache_L_Allocs), 0);
   hv_store(DATA, "vcache_L_Gets", strlen("vcache_L_Gets"),
            newSViv(a_ovP->vcache_L_Gets), 0);
   hv_store(DATA, "vcache_L_Reads", strlen("vcache_L_Reads"),
            newSViv(a_ovP->vcache_L_Reads), 0);
   hv_store(DATA, "vcache_L_Writes", strlen("vcache_L_Writes"),

src/Monitor.xs  view on Meta::CPAN

            newSViv(a_ovP->vcache_S_Writes), 0);

   hv_store(DATA, "vcache_H_Entries", strlen("vcache_H_Entries"),
            newSViv(a_ovP->vcache_H_Entries), 0);
   hv_store(DATA, "vcache_H_Gets", strlen("vcache_H_Gets"),
            newSViv(a_ovP->vcache_H_Gets), 0);
   hv_store(DATA, "vcache_H_Replacements", strlen("vcache_H_Replacements"),
            newSViv(a_ovP->vcache_H_Replacements), 0);

   /*
    * Directory package section.
    */
   hv_store(DATA, "dir_Buffers", strlen("dir_Buffers"),
            newSViv(a_ovP->dir_Buffers), 0);
   hv_store(DATA, "dir_Calls", strlen("dir_Calls"),
            newSViv(a_ovP->dir_Calls), 0);
   hv_store(DATA, "dir_IOs", strlen("dir_IOs"), newSViv(a_ovP->dir_IOs), 0);

   /*
    * Rx section.
    */
   hv_store(DATA, "rx_packetRequests", strlen("rx_packetRequests"),
            newSViv(a_ovP->rx_packetRequests), 0);
   hv_store(DATA, "rx_noPackets_RcvClass", strlen("rx_noPackets_RcvClass"),
            newSViv(a_ovP->rx_noPackets_RcvClass), 0);
   hv_store(DATA, "rx_noPackets_SendClass", strlen("rx_noPackets_SendClass"),
            newSViv(a_ovP->rx_noPackets_SendClass), 0);
   hv_store(DATA, "rx_noPackets_SpecialClass",
            strlen("rx_noPackets_SpecialClass"),
            newSViv(a_ovP->rx_noPackets_SpecialClass), 0);

src/Monitor.xs  view on Meta::CPAN

   hv_store(DATA, "rx_dataPacketsSent", strlen("rx_dataPacketsSent"),
            newSViv(a_ovP->rx_dataPacketsSent), 0);
   hv_store(DATA, "rx_dataPacketsReSent", strlen("rx_dataPacketsReSent"),
            newSViv(a_ovP->rx_dataPacketsReSent), 0);
   hv_store(DATA, "rx_dataPacketsPushed", strlen("rx_dataPacketsPushed"),
            newSViv(a_ovP->rx_dataPacketsPushed), 0);
   hv_store(DATA, "rx_ignoreAckedPacket", strlen("rx_ignoreAckedPacket"),
            newSViv(a_ovP->rx_ignoreAckedPacket), 0);
   hv_store(DATA, "rx_totalRtt_Sec", strlen("rx_totalRtt_Sec"),
            newSViv(a_ovP->rx_totalRtt_Sec), 0);
   hv_store(DATA, "rx_totalRtt_Usec", strlen("rx_totalRtt_Usec"),
            newSViv(a_ovP->rx_totalRtt_Usec), 0);
   hv_store(DATA, "rx_minRtt_Sec", strlen("rx_minRtt_Sec"),
            newSViv(a_ovP->rx_minRtt_Sec), 0);
   hv_store(DATA, "rx_minRtt_Usec", strlen("rx_minRtt_Usec"),
            newSViv(a_ovP->rx_minRtt_Usec), 0);
   hv_store(DATA, "rx_maxRtt_Sec", strlen("rx_maxRtt_Sec"),
            newSViv(a_ovP->rx_maxRtt_Sec), 0);
   hv_store(DATA, "rx_maxRtt_Usec", strlen("rx_maxRtt_Usec"),
            newSViv(a_ovP->rx_maxRtt_Usec), 0);
   hv_store(DATA, "rx_nRttSamples", strlen("rx_nRttSamples"),
            newSViv(a_ovP->rx_nRttSamples), 0);
   hv_store(DATA, "rx_nServerConns", strlen("rx_nServerConns"),
            newSViv(a_ovP->rx_nServerConns), 0);
   hv_store(DATA, "rx_nClientConns", strlen("rx_nClientConns"),
            newSViv(a_ovP->rx_nClientConns), 0);
   hv_store(DATA, "rx_nPeerStructs", strlen("rx_nPeerStructs"),
            newSViv(a_ovP->rx_nPeerStructs), 0);
   hv_store(DATA, "rx_nCallStructs", strlen("rx_nCallStructs"),
            newSViv(a_ovP->rx_nCallStructs), 0);

src/Monitor.xs  view on Meta::CPAN

my_cm_PrintOpTiming(a_opIdx, a_opNames, a_opTimeP, RPCTIMES)
   int a_opIdx;
   char *a_opNames[];
   struct afs_stats_opTimingData *a_opTimeP;
   HV *RPCTIMES;
{
   HV *TIMES = newHV();
   hv_store(TIMES, "numOps", 6, newSViv(a_opTimeP->numOps), 0);
   hv_store(TIMES, "numSuccesses", 12, newSViv(a_opTimeP->numSuccesses), 0);

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

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


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

src/Monitor.xs  view on Meta::CPAN

   char *a_opNames[];
   struct afs_stats_xferData *a_xferP;
   HV *XFERTIMES;
{
   HV *TIMES = newHV();
   AV *COUNT = newAV();
   int i;

   hv_store(TIMES, "numXfers", 8, newSViv(a_xferP->numXfers), 0);
   hv_store(TIMES, "numSuccesses", 12, newSViv(a_xferP->numSuccesses), 0);
   hv_store(TIMES, "sumTime", 7, newSVnv(a_xferP->sumTime.tv_sec
                                         +
                                         (a_xferP->sumTime.tv_usec /
                                          1000000.0)), 0);
   hv_store(TIMES, "sqrTime", 7, newSVnv(a_xferP->sqrTime.tv_sec +
                                 (a_xferP->sqrTime.tv_usec / 1000000.0)), 0);
   hv_store(TIMES, "minTime", 7, newSVnv(a_xferP->minTime.tv_sec +
                                 (a_xferP->minTime.tv_usec / 1000000.0)), 0);
   hv_store(TIMES, "maxTime", 7, newSVnv(a_xferP->maxTime.tv_sec +
                                 (a_xferP->maxTime.tv_usec / 1000000.0)), 0);
   hv_store(TIMES, "sumBytes", 8, newSViv(a_xferP->sumBytes), 0);
   hv_store(TIMES, "minBytes", 8, newSViv(a_xferP->minBytes), 0);
   hv_store(TIMES, "maxBytes", 8, newSViv(a_xferP->maxBytes), 0);


   for (i = 0; i <= 8; i++)
      av_store(COUNT, i, newSViv(a_xferP->count[i]));

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

src/Monitor.xs  view on Meta::CPAN


    char *hostName = (char *) NULL;
    char *portName = (char *) NULL;
    afs_int32 hostAddr;
    struct in_addr inhostAddr;
    register afs_int32 i, j, code;
    short port;
    int int32p = 0;
    struct hostent *th;
    struct rx_connection *tconn;
    struct rx_securityClass *sc;
    struct ubik_debug udebug;
    struct ubik_sdebug usdebug;
    int oldServer = 0;   /* are we talking to a pre 3.5 server? */
    afs_int32 isClone = 0;

    HV *RETVAL = newHV();
    AV *ADDRESSES;
    HV *LOCALVERSION;
    HV *SYNCVERSION;
    HV *SYNCTID;

src/Monitor.xs  view on Meta::CPAN

  {
    SV *value;
    I32 keylen = 0;
    char *key;
    int num_args = 0;
    int code = 0;
    int aint32 = 0;
    struct rx_connection *conn;
    register char *hostName = "";
    register struct hostent *thp;
    struct rx_securityClass *secobj;
    afs_int32 addr = 0;
    afs_int32 port = 7001;
    char buffer[256] = "";

    AV *LOCKS = newAV();           /* return */
    AV *CACHE_ENTRIES = newAV();   /* values */

    /* parse arguments */
    num_args = hv_iterinit(args);
    while (num_args--) {

src/Monitor.xs  view on Meta::CPAN


    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;
    }
    code = my_PrintLocks(conn, aint32, LOCKS, buffer);
    if(code) {
       BSETCODE(code, buffer);
       XSRETURN_UNDEF;
    }

src/Monitor.xs  view on Meta::CPAN

            dallyCounter++;
            continue;
          }
        }
        if ((onlyHost != -1) && (onlyHost != tconn.host)) continue;
        if ((onlyPort != -1) && (onlyPort != tconn.port)) continue;
        if (onlyServer && (tconn.type != RX_SERVER_CONNECTION)) continue;
        if (onlyClient && (tconn.type != RX_CLIENT_CONNECTION)) continue;
        if (onlyAuth != 999) {
          if (onlyAuth == -1) {
            if (tconn.securityIndex != 0) continue;
          }
          else {
            if (tconn.securityIndex != 2) continue;
            if (withSecStats && (tconn.secStats.type == 3) &&
             (tconn.secStats.level != onlyAuth)) continue;
          }
        }
        TCONN = newHV();
        hostAddr.s_addr = tconn.host;
        hv_store(TCONN, "host", 4, newSVpv(inet_ntoa(hostAddr), 0), 0);
        hv_store(TCONN, "port", 4, newSViv(ntohs(tconn.port)), 0);

        hv_store(TCONN, "cid", 3, newSViv(tconn.cid), 0);
        hv_store(TCONN, "epoch", 5, newSViv(tconn.epoch), 0);
        hv_store(TCONN, "error", 5, newSViv(tconn.error), 0);
        hv_store(TCONN, "serial", 6, newSViv(tconn.serial), 0);
        hv_store(TCONN, "natMTU", 6, newSViv(tconn.natMTU), 0);

        hv_store(TCONN, "flags", 5, newSViv(tconn.flags), 0);

        hv_store(TCONN, "securityIndex", 13, newSViv(tconn.securityIndex), 0);

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

        CALLSTATE = newAV();
        av_fill(CALLSTATE, RX_MAXCALLS-1);
        CALLMODE = newAV();
        av_fill(CALLMODE, RX_MAXCALLS-1);
        CALLFLAGS = newAV();
        av_fill(CALLFLAGS, RX_MAXCALLS-1);
        CALLOTHER = newAV();
        av_fill(CALLOTHER, RX_MAXCALLS-1);

src/Monitor.xs  view on Meta::CPAN


        BYTESRECEIVED = newHV();
        hv_store(BYTESRECEIVED, "high", 4, newSViv(tpeer.bytesReceived.high), 0);
        hv_store(BYTESRECEIVED, "low", 3, newSViv(tpeer.bytesReceived.low), 0);
        hv_store(TPEER, "bytesReceived", 13, newRV_inc((SV*)(BYTESRECEIVED)), 0);

        hv_store(TPEER, "rtt", 3, newSViv(tpeer.rtt), 0);
        hv_store(TPEER, "rtt_dev", 7, newSViv(tpeer.rtt_dev), 0);

        TIMEOUT = newHV();
        hv_store(TIMEOUT, "sec", 3, newSViv(tpeer.timeout.sec), 0);
        hv_store(TIMEOUT, "usec", 4, newSViv(tpeer.timeout.usec), 0);
        hv_store(TPEER, "timeout", 7, newRV_inc((SV*)(TIMEOUT)), 0);

        if (showLong) {
          hv_store(TPEER, "inPacketSkew", 12,
                   newSViv(tpeer.inPacketSkew), 0);
          hv_store(TPEER, "outPacketSkew", 13,
                   newSViv(tpeer.outPacketSkew), 0);
          hv_store(TPEER, "cwind", 5,
                   newSViv(tpeer.cwind), 0);
          hv_store(TPEER, "MTU", 3,

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

"rx_packetsSent_SpecialClass",
"rx_ackPacketsSent",
"rx_pingPacketsSent",
"rx_abortPacketsSent",
"rx_busyPacketsSent",
"rx_dataPacketsSent",
"rx_dataPacketsReSent",
"rx_dataPacketsPushed",
"rx_ignoreAckedPacket",
"rx_totalRtt_Sec",
"rx_totalRtt_Usec",
"rx_minRtt_Sec",
"rx_minRtt_Usec",
"rx_maxRtt_Sec",
"rx_maxRtt_Usec",
"rx_nRttSamples",
"rx_nServerConns",
"rx_nClientConns",
"rx_nPeerStructs",
"rx_nCallStructs",
"rx_nFreeCallStructs",
"host_NumHostEntries",
"host_HostBlocks",
"host_NonDeletedHosts",
"host_HostsInSameNetOrSubnet",

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

"StoreData_xfers_bucket2",
"StoreData_xfers_bucket3",
"StoreData_xfers_bucket4",
"StoreData_xfers_bucket5",
"StoreData_xfers_bucket6",
"StoreData_xfers_bucket7",
"StoreData_xfers_bucket8"
};

/* file server data classification */
/* Data is classified into sections and each section into one or more
groups. The integer after a section name specifies the number of groups
contained in it. The integers after a group name specify the starting and
ending positional indices to fs_varNames[]. Unimportant information
is placed at the end of the section. */

char *fs_categories[] = {
"PerfStats_section 5",
"VnodeCache_group 1 13",
"Directory_group 14 16",
"Rx_group 17 57",
"HostModule_group 58 65",
"misc_group 0 0",		/* numPerfCalls */
"RPCop_section 2",
"RPCopTimes_group 66 234",
"RPCopBytes_group 235 270"
};





/* Cache Manager variable names */

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

"HWM_LongestChain",
"unreplicatedRefs", 	/* [Un]replicated file accesses: */
"replicatedRefs",
"numReplicasAccessed",
"maxReplicasPerRef",
"refFirstReplicaOK"
};


/* Cache Manager data classification */
/* Data is classified into sections and each section into one or more
groups. The integer after a section name specifies the number of groups
contained in it. The integers after a group name specify the starting and
ending positional indices to fs_varNames[]. Unimportant information
is placed at the end of the section. */

char *cm_categories[] = {
"PerfStats_section 2",
"PerfStats_group 4 39",
"misc_group 0 3",
"Server_UpDown_section 4",
"FS_upDown_SC_group 40 64",
"FS_upDown_DC_group 65 89",
"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


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


/*
   In order for a Perl extension module to be as portable as possible
   across differing versions of Perl itself, certain steps need to be taken.
   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:



( run in 0.894 second using v1.01-cache-2.11-cpan-39bf76dae61 )