Hi all,
I'd like to give a big thanks to all who showed me the option for turning on NFS stats on a per-client basis. The NetApp 5.2 SysAdmin manual doesn't mention this at all in the trouble shooting section. They should update their docs better.
I'd also like to thank Darren for the hint on using 'prex' on solaris to get more info on processes and which are doing what.
And another big thanks to Mike Horwath drechsau@tiny.net for sending the 'netapp-top' script. I haven't used it yet, but it looks like just the thing to help us out in the future. The script is at the end of this message.
John John Stoffel - Senior Unix Systems Administrator - Lucent Technologies stoffel@lucent.com - http://www.lucent.com - 978-952-7548
--------------------------snip here---------------------------------
#!/usr/local/bin/perl
# netapp-top - display current top NFS clients for a NetApp # Copyright (C) 1998 Daniel Quinlan # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # 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., 675 Mass Ave, Cambridge, MA 02139, USA.
$default_interval = 60; $prog = $0; $prog =~ s@.*/@@;
require "getopts.pl"; &Getopts("hi:");
if (defined $ENV{"LINES"} && $ENV{"LINES"} ne "") { $lines = $ENV{"LINES"}; } else { $lines = 24; }
if ($opt_h) { &usage; exit 0; } if ($opt_i && $opt_i > 0) { $interval = $opt_i; } else { $interval = $default_interval; }
if ($ARGV[0]) { $host = $ARGV[0]; } else { &usage; exit 1; }
sub usage { print <<EOF; usage: $prog [options] filer -h print this help -i n report filer statistics every n seconds ($default_interval is default)
The NetApp must have the "nfs.per_client_stats.enable" option "on" for this to work at all.
This program must be run this from an admin host as root. EOF }
sub print_top { my $total = 0; my $diff; my %recent;
foreach $key (keys %nfs_ops_last) { $diff = $nfs_ops{$key} - $nfs_ops_last{$key}; $recent{$key} = $diff; $total += $diff; } $total = int ($total / $interval); system("clear"); printf "%6s\t%s\n", "NFS/s", "total NFS/s = $total | interval = $interval"; printf "%6s\t%s\n", "------", "----------------------------------------"; $i = 0; foreach $key (sort {$recent{$b} <=> $recent{$a} } keys %recent) { printf "%6d\t%s\n", int ($recent{$key} / $interval + 0.5), $ip_name{$key}; last if ($i++ > ($lines - 5)); } }
$first = 1; for (;;) { $time_0 = time(); open(NFSSTAT, "rsh $host nfsstat -l|"); while (<NFSSTAT>) { @tmp = split;
# ip_address = tmp[0] # ip_name = tmp[1] # nfs_ops = tmp[4] $ip_name{$tmp[0]} = $tmp[1]; $nfs_ops{$tmp[0]} = $tmp[4]; } close(NFSSTAT); if (! $first) { &print_top; } else { $first = 0; } %nfs_ops_last = %nfs_ops; $time_1 = time(); sleep ($interval - ($time_1 - $time_0)); }