AFS-Monitor
view release on metacpan or search on metacpan
examples/Meltdown.pl view on Meta::CPAN
print STDERR " -C \n";
print STDERR " -h (help: show this help message).\n\n";
print STDERR "Example: $progName -s point -p 7000\n";
print STDERR "Collect statistics on server point for port 7000\n";
print STDERR "Refresh interval will default to 20 minutes (1200 seconds)\n\n";
exit 0;
} # Usage
sub Check_data {
#
# If a value is going to overflow the field length,
# then bump the field length to match the value.
# It won't be pretty but we'll have valid data.
#
(length $wproc > $Ln[0]) ? ($Ln[0] = length $wproc) : "";
(length $nobuf > $Ln[1]) ? ($Ln[1] = length $nobuf) : "";
(length $wpack > $Ln[2]) ? ($Ln[2] = length $wpack) : "";
(length $fpack > $Ln[3]) ? ($Ln[3] = length $fpack) : "";
(length $calls > $Ln[4]) ? ($Ln[4] = length $calls) : "";
(length $delta > $Ln[5]) ? ($Ln[5] = length $delta) : "";
(length $data > $Ln[6]) ? ($Ln[6] = length $data) : "";
(length $resend > $Ln[7]) ? ($Ln[7] = length $resend) : "";
(length $idle > $Ln[8]) ? ($Ln[8] = length $idle) : "";
} # Check_data
sub Header {
if ($csvmode != 1) {
print "\nhh:mm:ss wproc nobufs wpack fpack calls delta data resends idle\n";
} else { # assume CSV mode...
print "\nhh:mm:ss,wproc,nobufs,wpack,fpack,calls,delta,data,resends,idle\n";
}
} # Header
examples/Meltdown.pl view on Meta::CPAN
$wpack = 0;
$fpack = 0;
$calls = 0;
$data = 0;
$resend = 0;
$nobuf = 0;
$idle = 0;
$oldcall = 0;
#
# set the default field format lengths for
# wproc,nobuf,wpack,fpack,calls,delta,data,resend,idle
#
@Ln = (5,8,6,8,9,6,9,8,4);
#
# force header display on first call
#
$firstrun = 1;
#
examples/Meltdown.pl view on Meta::CPAN
$delta = 0;
}
$oldcall = $calls;
$rxstats = $rx->{rxstats};
$data = $rxstats->{dataPacketsSent};
$resend = $rxstats->{dataPacketsReSent};
$nobuf = $rxstats->{noPacketBuffersOnRead};
$idle = $tstats->{idleThreads};
#
# verify and fix field format lengths
#
Check_data;
if ($csvmode != 1) {
#
# output the timestamp and current results
#
printf "%2.2d:%2.2d:%2.2d ", $hour,$min,$sec;
printf "%-$Ln[0].0f %-$Ln[1].0f %-$Ln[2].0f %-$Ln[3].0f ",
$wproc,$nobuf,$wpack,$fpack;
examples/afsmonitor view on Meta::CPAN
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});
}
examples/afsmonitor view on Meta::CPAN
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});
}
pod/afsmon_stats.pod view on Meta::CPAN
=item *
srvRecordsHWM: Server record high water mark.
=item *
srvNumBuckets: Number of server hash chain buckets.
=item *
srvMaxChainLength: Maximum server hash chain length.
=item *
srvMaxChainLengthHWM: Server hash chain high water mark.
=item *
sysName_ID: Sysname ID for host hardware.
=back
src/Monitor.xs view on Meta::CPAN
/* start of afsmonitor helper functions */
/*
* 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 $");
*/
#define FS 1 /* for misc. use */
#define CM 2 /* for misc. use */
#define CFG_STR_LEN 80 /* max length of config file fields */
#define NUM_XSTAT_FS_AFS_PERFSTATS_LONGS 66 /* number of fields (longs)
* in struct afs_PerfStats */
#define NUM_AFS_STATS_CMPERF_LONGS 40 /* number of longs in struct afs_stats_CMPerf
* excluding up/down stats and fields we dont display */
/*
* from src/afsmonitor/afsmonitor.h
*
*/
#define HOST_NAME_LEN 80 /* length of server/cm names */
#define THRESH_VAR_NAME_LEN 80 /* THRESHOLD STRUCTURE DEFINITIONS */
#define THRESH_VAR_LEN 16
#define NUM_FS_STAT_ENTRIES 271 /* number of file server statistics
* entries to display */
#define FS_STAT_STRING_LEN 14 /* max length of each string above */
#define NUM_CM_STAT_ENTRIES 571 /* number of cache manager statistics
* entries to display */
#define CM_STAT_STRING_LEN 14 /* max length of each string above */
#define FS_NUM_DATA_CATEGORIES 9 /* # of fs categories */
#define CM_NUM_DATA_CATEGORIES 16 /* # of cm categories */
/*
* from src/xstat/xstat_fs.c
* ("$Header: /afs/slac/g/scs/slur/Repository/AFSDebug/Debug/src/Monitor.xs,v 1.2 2006/07/05 22:25:10 alfw Exp $");
*
src/Monitor.xs view on Meta::CPAN
{
struct hostent *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
int withIdleThreads;
int withPeers;
struct rx_debugStats tstats;
char *portName = (char *) NULL;
char *hostName = (char *) NULL;
struct rx_debugConn tconn;
short noConns=0;
short showPeers=0;
short showLong=0;
int version_flag=0;
afs_int32 length=64;
char version[64];
char buffer[240]; /* for error messages */
afs_uint32 supportedDebugValues = 0;
afs_uint32 supportedStatValues = 0;
afs_uint32 supportedConnValues = 0;
afs_uint32 supportedPeerValues = 0;
afs_int32 nextconn = 0;
afs_int32 nextpeer = 0;
src/Monitor.xs view on Meta::CPAN
#endif
code = bind(s, (struct sockaddr *) &taddr, sizeof(struct sockaddr_in));
FSSETCODE(code);
if (code) {
perror("bind");
XSRETURN_UNDEF;
}
if (version_flag) /* add version to RETVAL and finish */
{
code = rx_GetServerVersion(s, host, port, length, version);
if (code < 0)
{
sprintf(buffer, "get version call failed with code %d, errno %d",code,errno);
BSETCODE(code, buffer);
XSRETURN_UNDEF;
}
hv_store(RETVAL, "version", 7, newSVpv(version, 0), 0);
goto done;
}
( run in 0.340 second using v1.01-cache-2.11-cpan-65fba6d93b7 )