[OpenAFS] RE: Monitoring Activity
Touretsky, Gregory
gregory.touretsky@intel.com
Thu, 6 Jun 2002 07:49:24 +0300
You can send TSTP signal to your AFS server, so that it will increase debug
level of FileLog output. It will log all kinds of volume/file activities.
It works fine with IBM AFS, probably should work also with OpenAFS.
Don't forget only to reduce the debug level (send HUP signal) when you are
done.
Here is the script we use to get the list of most accessed volumes or even
files.
#!/usr/intel/bin/perl
#############################
# Finds max accessed volumes
# Gregory Touretsky, 31/12/98
# Should run on AFS FS
if($#ARGV != 1 && $#ARGV != 2) {
print "Usage: check_fs <par1> <par2> [par3]\n";
print " <par1> - yes - send signal to fileserver to get new data\n";
print " no - work with existing FileLog\n";
print " <par2> - files - show usage per inode\n";
print " volumes - show usage per volume\n";
print " <par3> - date to check\n";
exit(-2);
}
$kill=shift @ARGV || "no";
$what_to_check=shift @ARGV || "volumes"; # should be files or volumes
$filelog="/usr/afs/logs/FileLog";
$sleep_time=30;
$fs_string=`/bin/ps -ef | grep fileserver | grep -v grep`;
if(! $fs_string) {
die "No fileserver running on this machine\n";
}
($fs_pid,$fs_started_m,$fs_started_d)=(split(" ",$fs_string))[1,4,5];
if($fs_started_m=~/:/) {$fs_started_d="";}
print "Fileserver started $fs_started_m $fs_started_d\n";
if($kill eq "yes") {
print STDERR "Sending TSTP signal to fileserver ($fs_pid)\n";
`kill -TSTP $fs_pid`;
print STDERR "Kill -TSTP sent to fileserver. Sleeping $sleep_time
sec...\n";
sleep $sleep_time;
print STDERR "Sending HUP signal to fileserver\n";
`kill -HUP $fs_pid`;
print STDERR "Copying $filelog to $filelog.1\n";
`cp $filelog ${filelog}.1`;
} else {print "Signal will not be sent, working with existing log\n";}
open FLOG, "$filelog.1" || die "Can't open $filelog.1";
@flog=<FLOG>;
close FLOG;
$time=localtime;
($month,$day)=(split(" ",$time))[1,2];
if($day<10) {$day=" ".$day;}
$date=shift @ARGV || $month." ".$day;
while(@flog) {
$str=shift @flog;
chomp $str;
if($str =~ /$date .* Fid/) {
$vol=(split(" ",$str))[8];
if($volumes{$vol}) {$volumes{$vol}+=1;}
else {$volumes{$vol}=1;}
}
}
if($what_to_check eq "files") {
foreach $vol (sort keys %volumes) {
print "$vol $volumes{$vol}\n";
}
}
elsif($what_to_check eq "volumes") {
foreach $vol (sort keys %volumes) {
$volid=$vol;$volid=~s/\..*//;
if($volids{$volid}) {$volids{$volid}+=$volumes{$vol};} else
{$volids{$volid}=$volumes{$vol};}
}
foreach $volid (sort keys %volids) {
print "$volid $volids{$volid}\n";
}
} else {print "Illegal usage. Please, specify only files or volumes\n";
exit(-1);}
Regards,
Gregory
Date: Wed, 05 Jun 2002 12:42:48 -0500
From: Michael Robokoff <mrobo@ahpcrc.org>
To: openafs <openafs-info@openafs.org>
Subject: [OpenAFS] Monitoring Activity
Does anyone have a way to monitor activity on an AFS File server?
I am seeing a lot of network activity and we have traced it to one
afs server. If I could tell what they are hitting on the server it would
be very helpful.
--Mike
Gregory Touretsky
Israel Engineering Computing
Unix Server Platforms
gregory.touretsky@intel.com
> (+) 972-4-865-6377, Fax: 04-865-5999
iNET: 465-6377, M/S: IDC-1B