view release on metacpan or search on metacpan
* changed permissions from 755 to 0755 in Makefile.PL
* ExtUtils::MakeMaker's PERL_MM_USE_DEFAULT environment variable is now obeyed
* fixed a problem to make it compile on 32 bit RHEL4
All fixes were submitted by Wolfgang Friebel <Wolfgang.Friebel at desy.de> - Thanks!
Version 0.3.0 (released April 27, 2006)
* made everything work with OpenAFS-1.4.1
* cmdebug: PrintCacheEntries() now contains the strings and not the number of the file types
* added new CallBack statistics from OpenAFS-1.4.1 file servers to xstat_fs_test()
* added example for CallBack statistics to examples/xstat_fs_test
* added new statistics "rx_nBusies", "fs_nBusies", "fs_GetCapabilities" to xstat_fs_test()
* changed call by value to call by reference in a number of functions which reduces the
memory usage
* some general code cleanup
Version 0.2.2 (released January 17, 2005)
LICENSES/COPYING view on Meta::CPAN
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) 19yy name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
pod/xstat_cm_test.pod
pod/xstat_fs_test.pod
pod/afsmon_stats.pod
pod/Monitor.pod
src/Monitor.xs
src/Makefile.PL
src/ppport.h
src/t/Monitor.t
src/afsmon-labels.h
src/Monitor.pm
src/typemap
Unpack the archive to create an AFS-Monitor installation directory:
tar zxvf AFS-Monitor-0.3.3.tar.gz
'cd' into that directory, make, test and install the modules. You
have to specify the location of the AFS system libraries. While
running the 'perl Makefile.PL' step you will be prompted for the
location of the AFS system libraries. If you want to avoid that
query, you should specify the environment variable 'AFSPATH'
before you start[1]. If your AFS system type is not yet known by
the make file, please follow the printed message.
This is the sequence of commands to build the modules:
cd AFS-Monitor-0.3.2
[1] this step is optional
setenv AFSPATH 'path_to_the_AFS_system_libraries' # tcsh-shell
export AFSPATH='path_to_the_AFS_system_libraries' # sh-shell
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";
examples/scripts/HandlerScript view on Meta::CPAN
#!/usr/bin/perl -w
#
# Copyright © 2004 Alf Wachsmann <alfw@slac.stanford.edu> and
# Elizabeth Cassell <e_a_c@mailsnare.net>
#
# $Revision: 1.1 $ $Date: 2004/08/05 20:52:03 $ $Author: alfw $
#
print "*** Handler Script called for an overflow! ***\n";
print "*** Host name: ", shift, " type: ", shift, " ***\n";
print "*** Overflow in field ", shift,
" (threshold ", shift, ",
actual ", shift, ") ***\n";
my $otherargs = shift;
if ($otherargs) {
print "*** Other arguments: ", $otherargs;
while ($otherargs = shift) {
print " ", $otherargs;
pod/rxdebug.pod view on Meta::CPAN
a state in which the connection is idle or waiting.
=item B<allconnections>
Produces output for all connections, even inactive ones. By default, the output
includes information only for connections that are active or in dally mode.
=item B<rxstats>
Produces detailed statistics about Rx history and performance (for example,
counts of the number of packets of various types the process has read and sent,
calculations of average and minimum roundtrip time, and so on).
=item B<onlyserver>
Produces output only for connections in which the process designated by the
B<port> argument is acting as the server.
=item B<onlyclient>
Produces output only for connections in which the process designated by the
pod/scout.pod view on Meta::CPAN
=item B<CurrentConnections>
The number of RPC connections open between the File Server process and client
machines. This number equals or exceeds the number in the B<WorkStations>
entry (see below), because each user on the machine can have several separate
connections open at once, and one client machine can handle several users.
=item B<TotalFetchs>
The number of fetch-type RPCs (fetch data, fetch access list, and fetch
status) that client machines have made to the File Server process since the
latter started. This number is reset to zero each time the File Server process
restarts.
=item B<TotalStores>
The number of store-type RPCs (store data, store access list, and store
status) that client machines have made to the File Server process since the
latter started. This number is reset to zero each time the File Server process
restarts.
=item B<WorkStations>
The number of client machines (workstations) that have communicated with the
File Server process within the last 15 minutes. Such machines are termed
I<active>. This number is likely to be smaller than the number in the
B<CurrentConnections> entry because a single client machine can have several
pod/xstat_cm_test.pod view on Meta::CPAN
=over
=item B<cmname>
String with one name or reference to an array with names of one or
more machines from which to monitor the Cache Manager.
=item B<collID>
Integer or reference to an array where each entry specifies a data collection
to return, which defines the type and amount of data the command interpreter
gathers about the Cache Manager. Data is returned in a predefined data
structure.
There are three acceptable values:
=over
=item B<0>
Provides profiling information about the numbers of times different internal
pod/xstat_fs_test.pod view on Meta::CPAN
=over
=item B<fsname>
String with one name or reference to an array with names of one or
more machines from which to monitor the File Server process.
=item B<collID>
Integer or reference to an array where each entry specifies each data collection
to return, which defines the type and amount of data the command interpreter
gathers about the File Server. Data is returned in a predefined data structure.
There are three acceptable values:
=over
=item B<0>
Provides profiling information about the numbers of times different internal
File Server routines were called since the File Server started. This value is
src/Makefile.PL view on Meta::CPAN
# determine the alpha_sys value
my $alpha_sys = `$AFSPath/bin/fs sysname 2>&1` || 'unknown';
if ($alpha_sys =~ s/Current sysname (list|) is? //) {
$alpha_sys =~ /(\w+)/;
$alpha_sys = $1;
}
# print out a summary of determined data
print "Your AFS system library is located at: $AFSPath \n";
print " and it is major version: $version \n";
print "Your AFS system type seems to be: $alpha_sys \n\n";
# set the Makefile values
my %MakefileArgs = (
'NAME' => 'AFS::Monitor',
'VERSION' => "$VERSION",
'DEFINE' => "$d_flag $a_flag",
'INC' => "-I$AFSPath/include",
'LIBS' => [
"-L$AFSPath/lib -L$AFSPath/lib/afs "
. join (
src/Makefile.PL view on Meta::CPAN
} elsif ($Config{osname} =~ /linux/) {
$MakefileArgs{LIBS}->[0] .= ' -lresolv';
### $MakefileArgs{LDFLAGS} = "-Wl,-rpath -Wl,$AFSPath/lib";
} elsif ($Config{osname} =~ /darwin/) {
$MakefileArgs{LDDLFLAGS} = $Config{lddlflags} . ' -lresolv -multiply_defined suppress -read_only_relocs suppress';
}
# elsif ($Config{osname} =~ /dec_osf/) {
# # hier fehlt noch was !!!!!
# }
else {
warn("System type '$Config{osname}' not yet tested with this Makefile.PL...\n\n"
. "Using the default values, which may or may not work\n"
. "If it is working, please inform the maintainer of this package.\n"
. "Thank you.\n\n");
}
WriteMakefile(%MakefileArgs);
# change the library name of the AFS system library "util.a"
my $command = "\'s#-lutil#$AFSPath/lib/afs/util.a#\'";
system("perl -p -i.bak -e $command Makefile") unless -f "$AFSPath/lib/afs/libutil.a";
src/Makefile.PL view on Meta::CPAN
system("perl -p -i.bak -e $command Makefile");
# change the library name of the AFS system library "libsys"
$command = "\'s#-lsys#$AFSPath/lib/afs/libsys.a#\'";
system("perl -p -i.bak -e $command Makefile");
# change the library name of the AFS system library "libcmd"
$command = "\'s#-lcmd#$AFSPath/lib/afs/libcmd.a#\'";
system("perl -p -i.bak -e $command Makefile");
# make changes to the typemap file if Perl < 5.6.0
$command = "\'s#T_UV#T_IV#\'";
system("perl -p -i.bak -e $command typemap") unless $] >= 5.006;
sub version {
my ($testver, $compver) = @_;
$compver = $ENV{VERSION} unless defined $compver;
# Remove possible package name from both strings.
$testver =~ s/^([a-zA-Z][^-]*-)*//;
src/Monitor.xs view on Meta::CPAN
#include <afs/afsint.h>
#include <afs/kautils.h>
#include <afs/xstat_fs.h>
#include <afs/xstat_cm.h>
#include "afsmon-labels.h" /* labels for afsmonitor variables */
#include <afs/fsprobe.h>
/* from volser/volser_prototypes.h */
extern void MapPartIdIntoName(afs_int32 partId, char *partName);
#if defined(AFS_3_4) || defined(AFS_3_5)
#else
#define int32 afs_int32
#define uint32 afs_uint32
#endif
const char *const xs_version = "Monitor.xs (Major Version 0.2 $Rev: 609 $)";
src/Monitor.xs view on Meta::CPAN
hv_store(RXSTATS, "noPacketBuffersOnRead", 21,
newSViv(rxstats->noPacketBuffersOnRead), 0);
hv_store(RXSTATS, "selects", 7, newSViv(rxstats->selects), 0);
hv_store(RXSTATS, "sendSelects", 11, newSViv(rxstats->sendSelects), 0);
PACKETS = newHV();
num_unused = 0;
for (i = 0; i < RX_N_PACKET_TYPES; i++) {
char *packet_type = rx_packetTypes[i];
TYPE = newHV();
hv_store(TYPE, "packetsRead", 11, newSViv(rxstats->packetsRead[i]), 0);
hv_store(TYPE, "packetsSent", 11, newSViv(rxstats->packetsSent[i]), 0);
if (packet_type == "unused") {
/* rename "unused" types */
/* can't have several entries in a hash with same name */
char packet_type_unused[7];
sprintf(packet_type_unused, "unused%d", num_unused);
packet_type = packet_type_unused;
num_unused++;
}
hv_store(PACKETS, packet_type, strlen(packet_type),
newRV_inc((SV *) (TYPE)), 0);
}
hv_store(RXSTATS, "packets", 7, newRV_inc((SV *) (PACKETS)), 0);
hv_store(RXSTATS, "dataPacketsRead", 15, newSViv(rxstats->dataPacketsRead),
0);
hv_store(RXSTATS, "ackPacketsRead", 14, newSViv(rxstats->ackPacketsRead),
0);
hv_store(RXSTATS, "dupPacketsRead", 14, newSViv(rxstats->dupPacketsRead),
0);
src/Monitor.xs view on Meta::CPAN
struct hostent *he;
#ifdef AFS_SUN5_ENV
char ip_addr[32];
#endif
he = gethostbyname(name);
#ifdef AFS_SUN5_ENV
/* On solaris the above does not resolve hostnames to full names */
if (he != NULL) {
memcpy(ip_addr, he->h_addr, he->h_length);
he = gethostbyaddr(ip_addr, he->h_length, he->h_addrtype);
}
#endif
return (he);
}
/*
* from src/afsmonitor/afsmonitor.c
* ("$Header: /afs/slac/g/scs/slur/Repository/AFSDebug/Debug/src/Monitor.xs,v 1.2 2006/07/05 22:25:10 alfw Exp $");
*/
src/Monitor.xs view on Meta::CPAN
my_parse_showEntry(a_line, fs_showDefault, cm_showDefault, fs_showFlags,
cm_showFlags, buffer)
char *a_line;
int *fs_showDefault;
int *cm_showDefault;
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;
src/Monitor.xs view on Meta::CPAN
} /* my_parse_hostEntry() */
/*
* from src/afsmonitor/afsmonitor.c
* ("$Header: /afs/slac/g/scs/slur/Repository/AFSDebug/Debug/src/Monitor.xs,v 1.2 2006/07/05 22:25:10 alfw Exp $");
*/
int
my_store_threshold(a_type, a_varName, a_value, a_handler, global_TC,
Header, hostname, srvCount, buffer)
int a_type; /* 1 = fs , 2 = cm */
char *a_varName; /* threshold name */
char *a_value; /* threshold value */
char *a_handler; /* threshold overflow handler */
int *global_TC; /* ptr to global_xxThreshCount */
struct afsmon_hostEntry *Header; /* tmp ptr to hostEntry list header */
char *hostname;
int srvCount; /* tmp count of host names */
char *buffer;
{
struct afsmon_hostEntry *tmp_host = 0; /* tmp ptr to hostEntry */
struct Threshold *threshP = 0; /* tmp ptr to threshold list */
int index = 0; /* index to fs_varNames or cm_varNames */
int found = 0;
int done = 0;
int i = 0, j = 0;
/* resolve the threshold variable name */
found = 0;
if (a_type == FS) { /* fs threshold */
for (index = 0; index < NUM_FS_STAT_ENTRIES; index++) {
if (strcasecmp(a_varName, fs_varNames[index]) == 0) {
found = 1;
break;
}
}
if (!found) {
sprintf(buffer, "Unknown FS threshold variable name %s", a_varName);
return (-1);
}
}
else if (a_type == CM) { /* cm threshold */
for (index = 0; index < NUM_CM_STAT_ENTRIES; index++) {
if (strcasecmp(a_varName, cm_varNames[index]) == 0) {
found = 1;
break;
}
}
if (!found) {
sprintf(buffer, "Unknown CM threshold variable name %s", a_varName);
return (-1);
}
src/Monitor.xs view on Meta::CPAN
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') ||
src/Monitor.xs view on Meta::CPAN
strcpy(threshP->handler, a_handler);
threshP->index = index;
done = 1;
break;
}
threshP++;
}
if (!done) {
sprintf(buffer, "Unable to insert threshold %s for %s host %s",
a_varName, (a_type - 1) ? "CM" : "FS", tmp_host->hostName);
return (-1);
}
return (0);
} /* my_store_threshold() */
/*
src/Monitor.xs view on Meta::CPAN
*
* and
*
* int
* check_cm_thresholds(a_hostEntry, a_Data)
* struct afsmon_hostEntry *a_hostEntry;
* struct cm_Display_Data *a_Data;
*/
int
my_check_thresholds(a_hostEntry, HOSTINFO, type, buffer)
struct afsmon_hostEntry *a_hostEntry; /* ptr to hostEntry */
HV *HOSTINFO; /* ptr to data to be displayed */
int type;
char *buffer;
{
struct Threshold *threshP;
double tValue = 0; /* threshold value */
double pValue = 0; /* probe value */
int i;
int idx;
int count; /* number of thresholds exceeded */
HV *SECTION;
src/Monitor.xs view on Meta::CPAN
|| SvTYPE(SECTION = (HV *) SvRV(SECTION)) != SVt_PVHV) {
continue;
}
hv_iterinit(SECTION);
while ((GROUP = (HV *) hv_iternextsv(SECTION, &key, &keylen))) {
if (!SvROK(GROUP)
|| SvTYPE(GROUP = (HV *) SvRV(GROUP)) != SVt_PVHV) {
continue;
}
if (type == FS)
varName = fs_varNames[idx];
else if (type == CM)
varName = cm_varNames[idx];
else
return (-1);
if (hv_exists(GROUP, varName, strlen(varName))) {
VALUE = (HV *)
SvRV(*hv_fetch(GROUP, varName, strlen(varName), FALSE));
pValue = SvIV(*hv_fetch(VALUE, "value", 5, FALSE));
found = 1;
break;
src/Monitor.xs view on Meta::CPAN
continue;
}
if (pValue > tValue) {
hv_store(VALUE, "overflow", 8, newSViv(1), 0);
hv_store(VALUE, "threshold", 9, newSVnv(tValue), 0);
if (threshP->handler[0] != '\0') {
sprintf(strval, "%g", pValue);
code = my_execute_thresh_handler(threshP->handler,
a_hostEntry->hostName, type,
threshP->itemName,
threshP->threshVal, strval,
VALUE, buffer);
if (code) {
return (code);
}
}
count++;
}
src/Monitor.xs view on Meta::CPAN
int *cm_showDefault;
short *fs_showFlags;
short *cm_showFlags;
struct afsmon_hostEntry **FSnameList;
struct afsmon_hostEntry **CMnameList;
{
char buff1[256] = ""; /* for error messages */
char buff2[256] = ""; /* for error messages returned from subroutines */
FILE *configFD = 0; /* config file descriptor */
char line[4 * CFG_STR_LEN]; /* a line of config file */
char opcode[CFG_STR_LEN]; /* specifies type of config entry */
char arg1[CFG_STR_LEN]; /* hostname or qualifier (fs/cm?) */
char arg2[CFG_STR_LEN]; /* threshold variable */
char arg3[CFG_STR_LEN]; /* threshold value */
char arg4[CFG_STR_LEN]; /* user's handler */
struct afsmon_hostEntry *curr_host = 0;
struct hostent *he = 0; /* hostentry to resolve host name */
char *handlerPtr = 0; /* ptr to pass theresh handler string */
int code = 0; /* error code */
int linenum = 0; /* config file line number */
int threshCount = 0; /* count of thresholds for each server */
src/Monitor.xs view on Meta::CPAN
struct rx_statistics rxstats;
/* should gracefully handle the case where rx_statistics grows */
code = rx_GetServerStats(s, host, port, &rxstats, &supportedStatValues);
if (code < 0) {
sprintf(buffer, "rxstats call failed with code %d", code);
VSETCODE(code, buffer);
XSRETURN_UNDEF;
}
if (code != sizeof(rxstats)) {
if ((((struct rx_debugIn *)(&rxstats))->type == RX_DEBUGI_BADTYPE))
goto noRxStats;
warn("WARNING: returned Rx statistics of unexpected size (got %d)\n", code);
/* handle other versions?... */
}
RXSTATS = newHV();
myPrintTheseStats(RXSTATS, &rxstats);
hv_store(RETVAL, "rxstats", 7, newRV_inc((SV*)(RXSTATS)), 0);
src/Monitor.xs view on Meta::CPAN
}
if (flag == 0) {
/* this call looks too ordinary, bump skipped count and go
* around again */
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);
src/Monitor.xs view on Meta::CPAN
PPCODE:
{
ST(0) = sv_newmortal();
sv_setpv(ST(0), (char *) error_message(code));
XSRETURN(1);
}
/* this function is generated automatically by constant_gen */
/* You didn't think I would type in this crap did you? */
/* thats what perl is for :-) */
void
constant(name, arg=0)
char * name
int arg
PPCODE:
{
ST(0) = sv_newmortal();
src/ppport.h view on Meta::CPAN
/* To verify whether ppport.h is needed for your module, and whether any
special defines should be used, ppport.h can be run through Perl to check
your source code. Simply say:
perl -x ppport.h *.c *.h *.xs foo/*.c [etc]
The result will be a list of patches suggesting changes that should at
least be acceptable, if not necessarily the most efficient solution, or a
fix for all possible problems. It won't catch where dTHR is needed, and
doesn't attempt to account for global macro or function definitions,
nested includes, typemaps, etc.
In order to test for the need of dTHR, please try your module under a
recent version of Perl that has threading compiled-in.
*/
/*
#!/usr/bin/perl
@ARGV = ("*.xs") if !@ARGV;