/usr/sbin
NameSizeModeActions
accessdb157920755editdlrm
addgnupghome30790755editdlrm
addpart155200755editdlrm
adduser1411440755editdlrm
agetty580720755editdlrm
alternatives405440755editdlrm
anacron404640755editdlrm
apachectl48080755editdlrm
applygnupgdefaults22210755editdlrm
arp647280755editdlrm
arping279040755editdlrm
arptables2369600755editdlrm
arptables-nft2369600755editdlrm
arptables-nft-restore2369600755editdlrm
arptables-nft-save2369600755editdlrm
arptables-restore2369600755editdlrm
arptables-save2369600755editdlrm
atd320080755editdlrm
atrun700755editdlrm
auditctl528240755editdlrm
auditd1403360755editdlrm
augenrules41460755editdlrm
aureport1231920755editdlrm
ausearch1231600755editdlrm
autrace196320750editdlrm
avcstat157200755editdlrm
badblocks362000755editdlrm
blkdeactivate163550555editdlrm
blkdiscard237600755editdlrm
blkid528480755editdlrm
blkmapd403600755editdlrm
blkzone363040755editdlrm
blockdev321680755editdlrm
bridge1340880755editdlrm
cache_check30462960755editdlrm
cache_dump30462960755editdlrm
cache_metadata_size30462960755editdlrm
cache_repair30462960755editdlrm
cache_restore30462960755editdlrm
cache_writeback30462960755editdlrm
capsh319600755editdlrm
cfdisk986560755editdlrm
chcpu321760755editdlrm
chgpasswd612000755editdlrm
chkconfig448320755editdlrm
chpasswd569680755editdlrm
chronyd3825440755editdlrm
chroot405040755editdlrm
clock612000755editdlrm
consoletype156480755editdlrm
convertquota706640755editdlrm
cracklib-check154720755editdlrm
cracklib-format2550755editdlrm
cracklib-packer154720755editdlrm
cracklib-unpacker154640755editdlrm
create-cracklib-dict9940755editdlrm
crond779920755editdlrm
ctrlaltdel155520755editdlrm
ctstat241600755editdlrm
dcb969600755editdlrm
ddns-confgen279120755editdlrm
debugfs2386240755editdlrm
delpart154800755editdlrm
depmod1695440755editdlrm
devlink1698160755editdlrm
dmeventd530320555editdlrm
dmfilemapd238560555editdlrm
dmsetup1605360555editdlrm
dmstats1605360555editdlrm
dnssec-cds488160755editdlrm
dnssec-checkds9240755editdlrm
dnssec-coverage9260755editdlrm
dnssec-dsfromkey403840755editdlrm
dnssec-importkey362880755editdlrm
dnssec-keyfromlabel403680755editdlrm
dnssec-keygen485840755editdlrm
dnssec-keymgr9220755editdlrm
dnssec-revoke321680755editdlrm
dnssec-settime485760755editdlrm
dnssec-signzone981840755editdlrm
dnssec-verify322000755editdlrm
dosfsck865920755editdlrm
dosfslabel409760755editdlrm
dovecot1474800755editdlrm
dovecot_cpshutdown33440755editdlrm
dpll493120755editdlrm
dumpe2fs320400755editdlrm
e2freefrag155520755editdlrm
e2fsck3646320755editdlrm
e2image444560755editdlrm
e2label1069680755editdlrm
e2mmpstatus320400755editdlrm
e2undo237120755editdlrm
e4crypt320480755editdlrm
e4defrag320080755editdlrm
ebtables2369600755editdlrm
ebtables-nft2369600755editdlrm
ebtables-nft-restore2369600755editdlrm
ebtables-nft-save2369600755editdlrm
ebtables-restore2369600755editdlrm
ebtables-save2369600755editdlrm
ebtables-translate2369600755editdlrm
edquota916480755editdlrm
efibootdump244400755editdlrm
efibootmgr462640755editdlrm
era_check30462960755editdlrm
era_dump30462960755editdlrm
era_invalidate30462960755editdlrm
era_restore30462960755editdlrm
ether-wake514480755editdlrm
ethtool10126960755editdlrm
exicyclog113650755editdlrm
exigrep117100755editdlrm
exim17288484755editdlrm
eximstats1525460755editdlrm
exim_checkaccess49430755editdlrm
exim_dbmbuild230400755editdlrm
exim_dumpdb418720755editdlrm
exim_fixdb463600755editdlrm
exim_lock233280755editdlrm
exim_tidydb334720755editdlrm
exinext82170755editdlrm
exiqgrep67390755editdlrm
exiqsumm64430755editdlrm
exiwhat45240755editdlrm
exportfs701120755editdlrm
faillock237360755editdlrm
fatlabel409760755editdlrm
fcgistarter253040755editdlrm
fdformat237440755editdlrm
fdisk1147600755editdlrm
filefrag196800755editdlrm
findfs155200755editdlrm
firewalld99890755editdlrm
fix-info-dir80370755editdlrm
fixfiles123870755editdlrm
fsadm246020555editdlrm
fsck445920755editdlrm
fsck.cramfs321280755editdlrm
fsck.ext23646320755editdlrm
fsck.ext33646320755editdlrm
fsck.ext43646320755editdlrm
fsck.fat865920755editdlrm
fsck.minix570480755editdlrm
fsck.msdos865920755editdlrm
fsck.vfat865920755editdlrm
fsck.xfs25980755editdlrm
fsfreeze155120755editdlrm
fstrim445440755editdlrm
fuser420720755editdlrm
g13-syshelp907280755editdlrm
genhomedircon328080755editdlrm
genhostid156480755editdlrm
genl1332720755editdlrm
getcap154960755editdlrm
getenforce156400755editdlrm
getpcaps154880755editdlrm
getpidprevcon156560755editdlrm
getpolicyload156480755editdlrm
getsebool156640755editdlrm
groupadd704240755editdlrm
groupdel660800755editdlrm
groupmems571120755editdlrm
groupmod745040755editdlrm
grpck611920755editdlrm
grpconv528000755editdlrm
grpunconv527680755editdlrm
grub2-bios-setup17499040755editdlrm
grub2-get-kernel-settings27460755editdlrm
grub2-install20685200755editdlrm
grub2-macbless17288720755editdlrm
grub2-mkconfig94310755editdlrm
grub2-probe17459840755editdlrm
grub2-reboot48140755editdlrm
grub2-set-bootflag154564755editdlrm
grub2-set-default35380755editdlrm
grub2-set-password28090755editdlrm
grub2-setpassword28090755editdlrm
grub2-switch-to-blscfg90240755editdlrm
grubby2600755editdlrm
gssproxy1278880755editdlrm
halt3055760755editdlrm
htcacheclean540720755editdlrm
httpd11397200755editdlrm
hwclock612000755editdlrm
iconvconfig324320755editdlrm
ifconfig808800755editdlrm
ifdown10970755editdlrm
ifenslave243040755editdlrm
ifstat405520755editdlrm
ifup10660755editdlrm
imunify-notifier103256160755editdlrm
init980400755editdlrm
insmod1695440755editdlrm
install-info1092560755editdlrm
installkernel3230755editdlrm
intel_sdsi229680755editdlrm
ip7929040755editdlrm
ip6tables2369600755editdlrm
ip6tables-nft2369600755editdlrm
ip6tables-nft-restore2369600755editdlrm
ip6tables-nft-save2369600755editdlrm
ip6tables-restore2369600755editdlrm
ip6tables-restore-translate2369600755editdlrm
ip6tables-save2369600755editdlrm
ip6tables-translate2369600755editdlrm
ipmaddr199120755editdlrm
ipset156400755editdlrm
ipset-translate156400755editdlrm
iptables2369600755editdlrm
iptables-nft2369600755editdlrm
iptables-nft-restore2369600755editdlrm
iptables-nft-save2369600755editdlrm
iptables-restore2369600755editdlrm
iptables-restore-translate2369600755editdlrm
iptables-save2369600755editdlrm
iptables-translate2369600755editdlrm
iptunnel199680755editdlrm
irqbalance659920755editdlrm
irqbalance-ui405360755editdlrm
kexec1972160755editdlrm
key.dns_resolver321040755editdlrm
kpartx486640755editdlrm
lchage237200755editdlrm
ldattach278800755editdlrm
ldconfig11764640755editdlrm
lgroupadd154800755editdlrm
lgroupdel154720755editdlrm
lgroupmod236800755editdlrm
lid195920755editdlrm
lnewusers236800755editdlrm
lnstat241600755editdlrm
load_policy154800755editdlrm
logrotate979600755editdlrm
logsave155520755editdlrm
losetup738160755editdlrm
lpasswd236800755editdlrm
lshw8740640755editdlrm
lsmod1695440755editdlrm
lspci999120755editdlrm
luseradd236800755editdlrm
luserdel154800755editdlrm
lusermod236880755editdlrm
lvchange28310720555editdlrm
lvconvert28310720555editdlrm
lvcreate28310720555editdlrm
lvdisplay28310720555editdlrm
lvextend28310720555editdlrm
lvm28310720555editdlrm
lvmconfig28310720555editdlrm
lvmdevices28310720555editdlrm
lvmdiskscan28310720555editdlrm
lvmdump103780555editdlrm
lvmpolld2153440555editdlrm
lvmsadc28310720555editdlrm
lvmsar28310720555editdlrm
lvm_import_vdo237080555editdlrm
lvreduce28310720555editdlrm
lvremove28310720555editdlrm
lvrename28310720555editdlrm
lvresize28310720555editdlrm
lvs28310720555editdlrm
lvscan28310720555editdlrm
makedumpfile4422080755editdlrm
matchpathcon156800755editdlrm
mii-diag247760755editdlrm
mii-tool284480755editdlrm
mkdict2550755editdlrm
mkdosfs537680755editdlrm
mkdumprd124180755editdlrm
mke2fs1357120755editdlrm
mkfs155360755editdlrm
mkfs.cramfs362240755editdlrm
mkfs.ext21357120755editdlrm
mkfs.ext31357120755editdlrm
mkfs.ext41357120755editdlrm
mkfs.fat537680755editdlrm
mkfs.minix446000755editdlrm
mkfs.msdos537680755editdlrm
mkfs.vfat537680755editdlrm
mkfs.xfs4615920755editdlrm
mkhomedir_helper237680755editdlrm
mklost+found154800755editdlrm
mksquashfs2023600755editdlrm
mkswap486400755editdlrm
modinfo1695440755editdlrm
modprobe1695440755editdlrm
modsec-sdbm-util343680750editdlrm
mount.fuse157040755editdlrm
mount.fuse3198320755editdlrm
mount.nfs1029364755editdlrm
mount.nfs41029364755editdlrm
mountstats435190755editdlrm
mysqld566875760755editdlrm
named5581040755editdlrm
named-checkconf403440755editdlrm
named-checkzone402880755editdlrm
named-compilezone402880755editdlrm
named-journalprint154960755editdlrm
named-nzd2nzf154800755editdlrm
nameif159520755editdlrm
NetworkManager38939280755editdlrm
newusers908320755editdlrm
nfsconf408160755editdlrm
nfsdcld572080755editdlrm
nfsdclddb102300755editdlrm
nfsdclnts92710755editdlrm
nfsdcltrack408720755editdlrm
nfsidmap238560755editdlrm
nfsiostat239100755editdlrm
nfsref445600755editdlrm
nfsstat391920755editdlrm
nft278240755editdlrm
nologin155200755editdlrm
nscd1668560755editdlrm
nsec3hash155600755editdlrm
nstat320880755editdlrm
packer154720755editdlrm
pam_console_apply445520755editdlrm
pam_namespace_helper4710755editdlrm
pam_timestamp_check154964755editdlrm
paperconfig41730755editdlrm
parted987040755editdlrm
partprobe157040755editdlrm
partx612000755editdlrm
pdata_tools30462960755editdlrm
pdns_server61628000755editdlrm
pidof238880755editdlrm
ping914720755editdlrm
ping6914720755editdlrm
pivot_root155200755editdlrm
plipconfig157200755editdlrm
poweroff3055760755editdlrm
pure-authd235680755editdlrm
pure-certd234720755editdlrm
pure-config.pl47550755editdlrm
pure-ftpd1813760755editdlrm
pure-ftpwho272160755editdlrm
pure-mrtginfo148960755editdlrm
pure-quotacheck231040755editdlrm
pure-uploadscript233760755editdlrm
pvchange28310720555editdlrm
pvck28310720555editdlrm
pvcreate28310720555editdlrm
pvdisplay28310720555editdlrm
pvmove28310720555editdlrm
pvremove28310720555editdlrm
pvresize28310720555editdlrm
pvs28310720555editdlrm
pvscan28310720555editdlrm
pwck569360755editdlrm
pwconv485840755editdlrm
pwhistory_helper196560755editdlrm
pwunconv485440755editdlrm
quotacheck958640755editdlrm
quotaoff580320755editdlrm
quotaon580320755editdlrm
quotastats157040755editdlrm
rdisc321120755editdlrm
rdma1198720755editdlrm
readprofile238240755editdlrm
reboot3055760755editdlrm
repquota794160755editdlrm
request-key279440755editdlrm
resize2fs692640755editdlrm
resizepart239600755editdlrm
restorecon237440755editdlrm
restorecon_xattr154880755editdlrm
rfkill320960755editdlrm
rmmod1695440755editdlrm
rndc442880755editdlrm
rndc-confgen238160755editdlrm
rotatelogs390480755editdlrm
route673520755editdlrm
rpc.gssd902240755editdlrm
rpc.idmapd488800755editdlrm
rpc.mountd1357360755editdlrm
rpc.nfsd409600755editdlrm
rpc.statd827280755editdlrm
rpcbind613280755editdlrm
rpcctl96450755editdlrm
rpcdebug191040755editdlrm
rpcinfo364320755editdlrm
rsyslogd8262400755editdlrm
rtacct300480755editdlrm
rtcwake361040755editdlrm
rtkitctl156080755editdlrm
rtmon1290800755editdlrm
rtstat241600755editdlrm
runlevel3055760755editdlrm
runq17288484755editdlrm
runuser569440755editdlrm
sasldblistusers2156400755editdlrm
saslpasswd2156080755editdlrm
sefcontext_compile741200755editdlrm
selabel_digest156800755editdlrm
selabel_get_digests_all_partial_matches156960755editdlrm
selabel_lookup156720755editdlrm
selabel_lookup_best_match156800755editdlrm
selabel_partial_match156720755editdlrm
selinuxconlist156720755editdlrm
selinuxdefcon156720755editdlrm
selinuxenabled156400755editdlrm
selinuxexeccon156560755editdlrm
selinux_check_access156800755editdlrm
semanage416140755editdlrm
semodule328080755editdlrm
sendmail185122755editdlrm
service46230755editdlrm
sestatus236800755editdlrm
setcap154880755editdlrm
setenforce156640755editdlrm
setfiles237440755editdlrm
setpci321040755editdlrm
setquota835360755editdlrm
setsebool196080755editdlrm
sfdisk1064800755editdlrm
showmount158480755editdlrm
shutdown3055760755editdlrm
slattach384720755editdlrm
sm-notify530160755editdlrm
smartctl8743280755editdlrm
smartd6302400755editdlrm
ss1344720755editdlrm
sshd4166640755editdlrm
sssd733280755editdlrm
sss_cache360960755editdlrm
start-statd10270755editdlrm
start-stop-daemon498160755editdlrm
suexec385044755editdlrm
sulogin444400755editdlrm
sw-engine-fpm253146800755editdlrm
swaplabel196480755editdlrm
swapoff238240755editdlrm
swapon443520755editdlrm
switch_root237600755editdlrm
sysctl322480755editdlrm
tc6554560755editdlrm
tcpdump13402560755editdlrm
tcpslice280480755editdlrm
telinit3055760755editdlrm
thin_check30462960755editdlrm
thin_delta30462960755editdlrm
thin_dump30462960755editdlrm
thin_ls30462960755editdlrm
thin_metadata_pack30462960755editdlrm
thin_metadata_size30462960755editdlrm
thin_metadata_unpack30462960755editdlrm
thin_migrate30462960755editdlrm
thin_repair30462960755editdlrm
thin_restore30462960755editdlrm
thin_rmap30462960755editdlrm
thin_trim30462960755editdlrm
tipc950240755editdlrm
tmpwatch368960755editdlrm
tracepath196800755editdlrm
tracepath6196800755editdlrm
tsig-keygen279120755editdlrm
tune2fs1069680755editdlrm
udevadm6019600755editdlrm
umount.nfs1029364755editdlrm
umount.nfs41029364755editdlrm
unix_chkpwd238484755editdlrm
unix_update320800700editdlrm
unsquashfs1165360755editdlrm
update-alternatives405440755editdlrm
update-pciids17570755editdlrm
update-smart-drivedb238850755editdlrm
useradd1411440755editdlrm
userdel909680755editdlrm
usermod1327760755editdlrm
validatetrans156560755editdlrm
vdpa367360755editdlrm
vgcfgbackup28310720555editdlrm
vgcfgrestore28310720555editdlrm
vgchange28310720555editdlrm
vgck28310720555editdlrm
vgconvert28310720555editdlrm
vgcreate28310720555editdlrm
vgdisplay28310720555editdlrm
vgexport28310720555editdlrm
vgextend28310720555editdlrm
vgimport28310720555editdlrm
vgimportclone28310720555editdlrm
vgimportdevices28310720555editdlrm
vgmerge28310720555editdlrm
vgmknodes28310720555editdlrm
vgreduce28310720555editdlrm
vgremove28310720555editdlrm
vgrename28310720555editdlrm
vgs28310720555editdlrm
vgscan28310720555editdlrm
vgsplit28310720555editdlrm
vigr595520755editdlrm
vipw595520755editdlrm
visudo2736800755editdlrm
vmcore-dmesg279520755editdlrm
weak-modules343840755editdlrm
whmapi034781120755editdlrm
whmapi134781120755editdlrm
whmlogin23900755editdlrm
wipefs402240755editdlrm
xfs_admin21780755editdlrm
xfs_bmap6990755editdlrm
xfs_copy948400755editdlrm
xfs_db7250720755editdlrm
xfs_estimate155280755editdlrm
xfs_freeze8040755editdlrm
xfs_fsr445520755editdlrm
xfs_growfs446800755editdlrm
xfs_info12980755editdlrm
xfs_io2074560755editdlrm
xfs_logprint903760755editdlrm
xfs_mdrestore279360755editdlrm
xfs_metadump7860755editdlrm
xfs_mkfile10440755editdlrm
xfs_ncheck6890755editdlrm
xfs_quota943120755editdlrm
xfs_repair7027040755editdlrm
xfs_rtcp196000755editdlrm
xfs_spaceman448320755editdlrm
xqmstats156960755editdlrm
xtables-monitor2369600755editdlrm
xtables-nft-multi2369600755editdlrm
zic610560755editdlrm
zramctl572080755editdlrm
Edit: /usr/sbin/nfsiostat (23910B)
#!/usr/bin/python3 # -*- python-mode -*- """Emulate iostat for NFS mount points using /proc/self/mountstats """ from __future__ import print_function __copyright__ = """ Copyright (C) 2005, Chuck Lever This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA """ import sys, os, time from optparse import OptionParser, OptionGroup Iostats_version = '0.2' def difference(x, y): """Used for a map() function """ return x - y NfsEventCounters = [ 'inoderevalidates', 'dentryrevalidates', 'datainvalidates', 'attrinvalidates', 'vfsopen', 'vfslookup', 'vfspermission', 'vfsupdatepage', 'vfsreadpage', 'vfsreadpages', 'vfswritepage', 'vfswritepages', 'vfsreaddir', 'vfssetattr', 'vfsflush', 'vfsfsync', 'vfslock', 'vfsrelease', 'congestionwait', 'setattrtrunc', 'extendwrite', 'sillyrenames', 'shortreads', 'shortwrites', 'delay' ] NfsByteCounters = [ 'normalreadbytes', 'normalwritebytes', 'directreadbytes', 'directwritebytes', 'serverreadbytes', 'serverwritebytes', 'readpages', 'writepages' ] class DeviceData: """DeviceData objects provide methods for parsing and displaying data for a single mount grabbed from /proc/self/mountstats """ def __init__(self): self.__nfs_data = dict() self.__rpc_data = dict() self.__rpc_data['ops'] = [] def __parse_nfs_line(self, words): if words[0] == 'device': self.__nfs_data['export'] = words[1] self.__nfs_data['mountpoint'] = words[4] self.__nfs_data['fstype'] = words[7] if words[7] == 'nfs': self.__nfs_data['statvers'] = words[8] elif 'nfs' in words or 'nfs4' in words: self.__nfs_data['export'] = words[0] self.__nfs_data['mountpoint'] = words[3] self.__nfs_data['fstype'] = words[6] if words[6] == 'nfs': self.__nfs_data['statvers'] = words[7] elif words[0] == 'age:': self.__nfs_data['age'] = int(words[1]) elif words[0] == 'opts:': self.__nfs_data['mountoptions'] = ''.join(words[1:]).split(',') elif words[0] == 'caps:': self.__nfs_data['servercapabilities'] = ''.join(words[1:]).split(',') elif words[0] == 'nfsv4:': self.__nfs_data['nfsv4flags'] = ''.join(words[1:]).split(',') elif words[0] == 'sec:': keys = ''.join(words[1:]).split(',') self.__nfs_data['flavor'] = int(keys[0].split('=')[1]) self.__nfs_data['pseudoflavor'] = 0 if self.__nfs_data['flavor'] == 6: self.__nfs_data['pseudoflavor'] = int(keys[1].split('=')[1]) elif words[0] == 'events:': i = 1 for key in NfsEventCounters: self.__nfs_data[key] = int(words[i]) i += 1 elif words[0] == 'bytes:': i = 1 for key in NfsByteCounters: self.__nfs_data[key] = int(words[i]) i += 1 def __parse_rpc_line(self, words): if words[0] == 'RPC': self.__rpc_data['statsvers'] = float(words[3]) self.__rpc_data['programversion'] = words[5] elif words[0] == 'xprt:': self.__rpc_data['protocol'] = words[1] if words[1] == 'udp': self.__rpc_data['port'] = int(words[2]) self.__rpc_data['bind_count'] = int(words[3]) self.__rpc_data['rpcsends'] = int(words[4]) self.__rpc_data['rpcreceives'] = int(words[5]) self.__rpc_data['badxids'] = int(words[6]) self.__rpc_data['inflightsends'] = int(words[7]) self.__rpc_data['backlogutil'] = int(words[8]) elif words[1] == 'tcp': self.__rpc_data['port'] = words[2] self.__rpc_data['bind_count'] = int(words[3]) self.__rpc_data['connect_count'] = int(words[4]) self.__rpc_data['connect_time'] = int(words[5]) self.__rpc_data['idle_time'] = int(words[6]) self.__rpc_data['rpcsends'] = int(words[7]) self.__rpc_data['rpcreceives'] = int(words[8]) self.__rpc_data['badxids'] = int(words[9]) self.__rpc_data['inflightsends'] = int(words[10]) self.__rpc_data['backlogutil'] = int(words[11]) elif words[1] == 'rdma': self.__rpc_data['port'] = words[2] self.__rpc_data['bind_count'] = int(words[3]) self.__rpc_data['connect_count'] = int(words[4]) self.__rpc_data['connect_time'] = int(words[5]) self.__rpc_data['idle_time'] = int(words[6]) self.__rpc_data['rpcsends'] = int(words[7]) self.__rpc_data['rpcreceives'] = int(words[8]) self.__rpc_data['badxids'] = int(words[9]) self.__rpc_data['backlogutil'] = int(words[10]) self.__rpc_data['read_chunks'] = int(words[11]) self.__rpc_data['write_chunks'] = int(words[12]) self.__rpc_data['reply_chunks'] = int(words[13]) self.__rpc_data['total_rdma_req'] = int(words[14]) self.__rpc_data['total_rdma_rep'] = int(words[15]) self.__rpc_data['pullup'] = int(words[16]) self.__rpc_data['fixup'] = int(words[17]) self.__rpc_data['hardway'] = int(words[18]) self.__rpc_data['failed_marshal'] = int(words[19]) self.__rpc_data['bad_reply'] = int(words[20]) elif words[0] == 'per-op': self.__rpc_data['per-op'] = words else: op = words[0][:-1] self.__rpc_data['ops'] += [op] self.__rpc_data[op] = [int(word) for word in words[1:]] def parse_stats(self, lines): """Turn a list of lines from a mount stat file into a dictionary full of stats, keyed by name """ found = False for line in lines: words = line.split() if len(words) == 0: continue if (not found and words[0] != 'RPC'): self.__parse_nfs_line(words) continue found = True self.__parse_rpc_line(words) def fstype(self): """Return the fstype for the mountpoint """ return self.__nfs_data['fstype'] def is_nfs_mountpoint(self): """Return True if this is an NFS or NFSv4 mountpoint, otherwise return False """ if self.__nfs_data['fstype'] == 'nfs': return True elif self.__nfs_data['fstype'] == 'nfs4': return True return False def compare_iostats(self, old_stats): """Return the difference between two sets of stats """ result = DeviceData() # copy self into result for key, value in self.__nfs_data.items(): result.__nfs_data[key] = value for key, value in self.__rpc_data.items(): result.__rpc_data[key] = value # compute the difference of each item in the list # note the copy loop above does not copy the lists, just # the reference to them. so we build new lists here # for the result object. for op in result.__rpc_data['ops']: try: result.__rpc_data[op] = list(map( difference, self.__rpc_data[op], old_stats.__rpc_data[op])) except KeyError: continue # update the remaining keys we care about result.__rpc_data['rpcsends'] -= old_stats.__rpc_data['rpcsends'] result.__rpc_data['backlogutil'] -= old_stats.__rpc_data['backlogutil'] for key in NfsEventCounters: result.__nfs_data[key] -= old_stats.__nfs_data[key] for key in NfsByteCounters: result.__nfs_data[key] -= old_stats.__nfs_data[key] return result def __print_data_cache_stats(self): """Print the data cache hit rate """ nfs_stats = self.__nfs_data app_bytes_read = float(nfs_stats['normalreadbytes']) if app_bytes_read != 0: client_bytes_read = float(nfs_stats['serverreadbytes'] - nfs_stats['directreadbytes']) ratio = ((app_bytes_read - client_bytes_read) * 100) / app_bytes_read print() print('app bytes: %f client bytes %f' % (app_bytes_read, client_bytes_read)) print('Data cache hit ratio: %4.2f%%' % ratio) def __print_attr_cache_stats(self, sample_time): """Print attribute cache efficiency stats """ nfs_stats = self.__nfs_data print() print('%d VFS opens' % (nfs_stats['vfsopen'])) print('%d inoderevalidates (forced GETATTRs)' % \ (nfs_stats['inoderevalidates'])) print('%d page cache invalidations' % \ (nfs_stats['datainvalidates'])) print('%d attribute cache invalidations' % \ (nfs_stats['attrinvalidates'])) def __print_dir_cache_stats(self, sample_time): """Print directory stats """ nfs_stats = self.__nfs_data lookup_ops = self.__rpc_data['LOOKUP'][0] readdir_ops = self.__rpc_data['READDIR'][0] if 'READDIRPLUS' in self.__rpc_data: readdir_ops += self.__rpc_data['READDIRPLUS'][0] dentry_revals = nfs_stats['dentryrevalidates'] opens = nfs_stats['vfsopen'] lookups = nfs_stats['vfslookup'] getdents = nfs_stats['vfsreaddir'] print() print('%d open operations (pathname lookups)' % opens) print('%d dentry revalidates and %d vfs lookup requests' % \ (dentry_revals, lookups)) print('resulted in %d LOOKUPs on the wire' % lookup_ops) print('%d vfs getdents calls resulted in %d READDIRs on the wire' % \ (getdents, readdir_ops)) def __print_page_stats(self, sample_time): """Print page cache stats """ nfs_stats = self.__nfs_data vfsreadpage = nfs_stats['vfsreadpage'] vfsreadpages = nfs_stats['vfsreadpages'] pages_read = nfs_stats['readpages'] vfswritepage = nfs_stats['vfswritepage'] vfswritepages = nfs_stats['vfswritepages'] pages_written = nfs_stats['writepages'] print() print('%d nfs_readpage() calls read %d pages' % \ (vfsreadpage, vfsreadpage)) print('%d nfs_readpages() calls read %d pages' % \ (vfsreadpages, pages_read - vfsreadpage)) if vfsreadpages != 0: print('(%.1f pages per call)' % \ (float(pages_read - vfsreadpage) / vfsreadpages)) else: print() print() print('%d nfs_updatepage() calls' % nfs_stats['vfsupdatepage']) print('%d nfs_writepage() calls wrote %d pages' % \ (vfswritepage, vfswritepage)) print('%d nfs_writepages() calls wrote %d pages' % \ (vfswritepages, pages_written - vfswritepage)) if (vfswritepages) != 0: print('(%.1f pages per call)' % \ (float(pages_written - vfswritepage) / vfswritepages)) else: print() congestionwaits = nfs_stats['congestionwait'] if congestionwaits != 0: print() print('%d congestion waits' % congestionwaits) def __print_rpc_op_stats(self, op, sample_time): """Print generic stats for one RPC op """ if op not in self.__rpc_data: return rpc_stats = self.__rpc_data[op] ops = float(rpc_stats[0]) retrans = float(rpc_stats[1] - rpc_stats[0]) kilobytes = float(rpc_stats[3] + rpc_stats[4]) / 1024 queued_for = float(rpc_stats[5]) rtt = float(rpc_stats[6]) exe = float(rpc_stats[7]) if len(rpc_stats) >= 9: errs = float(rpc_stats[8]) # prevent floating point exceptions if ops != 0: kb_per_op = kilobytes / ops retrans_percent = (retrans * 100) / ops rtt_per_op = rtt / ops exe_per_op = exe / ops queued_for_per_op = queued_for / ops if len(rpc_stats) >= 9: errs_percent = (errs * 100) / ops else: kb_per_op = 0.0 retrans_percent = 0.0 rtt_per_op = 0.0 exe_per_op = 0.0 queued_for_per_op = 0.0 if len(rpc_stats) >= 9: errs_percent = 0.0 op += ':' print(format(op.lower(), '<16s'), end='') print(format('ops/s', '>8s'), end='') print(format('kB/s', '>16s'), end='') print(format('kB/op', '>16s'), end='') print(format('retrans', '>16s'), end='') print(format('avg RTT (ms)', '>16s'), end='') print(format('avg exe (ms)', '>16s'), end='') print(format('avg queue (ms)', '>16s'), end='') if len(rpc_stats) >= 9: print(format('errors', '>16s'), end='') print() print(format((ops / sample_time), '>24.3f'), end='') print(format((kilobytes / sample_time), '>16.3f'), end='') print(format(kb_per_op, '>16.3f'), end='') retransmits = '{0:>10.0f} ({1:>3.1f}%)'.format(retrans, retrans_percent).strip() print(format(retransmits, '>16'), end='') print(format(rtt_per_op, '>16.3f'), end='') print(format(exe_per_op, '>16.3f'), end='') print(format(queued_for_per_op, '>16.3f'), end='') if len(rpc_stats) >= 9: errors = '{0:>10.0f} ({1:>3.1f}%)'.format(errs, errs_percent).strip() print(format(errors, '>16'), end='') print() def ops(self, sample_time): sends = float(self.__rpc_data['rpcsends']) if sample_time == 0: sample_time = float(self.__nfs_data['age']) if sample_time == 0: sample_time = 1; return (sends / sample_time) def display_iostats(self, sample_time, which): """Display NFS and RPC stats in an iostat-like way """ sends = float(self.__rpc_data['rpcsends']) if sample_time == 0: sample_time = float(self.__nfs_data['age']) # sample_time could still be zero if the export was just mounted. # Set it to 1 to avoid divide by zero errors in this case since we'll # likely still have relevant mount statistics to show. # if sample_time == 0: sample_time = 1; if sends != 0: backlog = (float(self.__rpc_data['backlogutil']) / sends) / sample_time else: backlog = 0.0 print() print('%s mounted on %s:' % \ (self.__nfs_data['export'], self.__nfs_data['mountpoint'])) print() print(format('ops/s', '>16') + format('rpc bklog', '>16')) print(format((sends / sample_time), '>16.3f'), end='') print(format(backlog, '>16.3f')) print() if which == 0: self.__print_rpc_op_stats('READ', sample_time) self.__print_rpc_op_stats('WRITE', sample_time) elif which == 1: self.__print_rpc_op_stats('GETATTR', sample_time) self.__print_rpc_op_stats('ACCESS', sample_time) self.__print_attr_cache_stats(sample_time) elif which == 2: self.__print_rpc_op_stats('LOOKUP', sample_time) self.__print_rpc_op_stats('READDIR', sample_time) if 'READDIRPLUS' in self.__rpc_data: self.__print_rpc_op_stats('READDIRPLUS', sample_time) self.__print_dir_cache_stats(sample_time) elif which == 3: self.__print_rpc_op_stats('READ', sample_time) self.__print_rpc_op_stats('WRITE', sample_time) self.__print_page_stats(sample_time) sys.stdout.flush() # # Functions # def parse_stats_file(filename): """pop the contents of a mountstats file into a dictionary, keyed by mount point. each value object is a list of the lines in the mountstats file corresponding to the mount point named in the key. """ ms_dict = dict() key = '' f = open(filename) for line in f.readlines(): words = line.split() if len(words) == 0: continue if line.startswith("no device mounted"): continue if words[0] == 'device': key = words[4] new = [ line.strip() ] elif 'nfs' in words or 'nfs4' in words: key = words[3] new = [ line.strip() ] else: new += [ line.strip() ] ms_dict[key] = new f.close return ms_dict def print_iostat_summary(old, new, devices, time, options): display_stats = {} if len(devices) == 0: print('No NFS mount points were found') return for device in devices: stats = DeviceData() stats.parse_stats(new[device]) if old and device in old: old_stats = DeviceData() old_stats.parse_stats(old[device]) if stats.fstype() == old_stats.fstype(): display_stats[device] = stats.compare_iostats(old_stats) else: # device is in old, but fstypes are different display_stats[device] = stats else: # device is only in new display_stats[device] = stats if options.sort: devices.sort(key=lambda x: display_stats[x].ops(time), reverse=True) count = 1 for device in devices: display_stats[device].display_iostats(time, options.which) count += 1 if (count > options.list): return def list_nfs_mounts(givenlist, mountstats): """return a list of NFS mounts given a list to validate or return a full list if the given list is empty - may return an empty list if none found """ devicelist = [] if len(givenlist) > 0: for device in givenlist: if device in mountstats: stats = DeviceData() stats.parse_stats(mountstats[device]) if stats.is_nfs_mountpoint(): devicelist += [device] else: for device, descr in mountstats.items(): stats = DeviceData() stats.parse_stats(descr) if stats.is_nfs_mountpoint(): devicelist += [device] return devicelist def iostat_command(name): """iostat-like command for NFS mount points """ mountstats = parse_stats_file('/proc/self/mountstats') devices = [] origdevices = [] interval_seen = False count_seen = False mydescription= """ Sample iostat-like program to display NFS client per-mount' statistics. The parameter specifies the amount of time in seconds between each report. The first report contains statistics for the time since each file system was mounted. Each subsequent report contains statistics collected during the interval since the previous report. If the parameter is specified, the value of determines the number of reports generated at seconds apart. If the interval parameter is specified without the parameter, the command generates reports continuously. If one or more names are specified, statistics for only these mount points will be displayed. Otherwise, all NFS mount points on the client are listed. """ parser = OptionParser( usage="usage: %prog [ [ ] ] [ ] [ ]", description=mydescription, version='version %s' % Iostats_version) parser.set_defaults(which=0, sort=False, list=sys.maxsize) statgroup = OptionGroup(parser, "Statistics Options", 'File I/O is displayed unless one of the following is specified:') statgroup.add_option('-a', '--attr', action="store_const", dest="which", const=1, help='displays statistics related to the attribute cache') statgroup.add_option('-d', '--dir', action="store_const", dest="which", const=2, help='displays statistics related to directory operations') statgroup.add_option('-p', '--page', action="store_const", dest="which", const=3, help='displays statistics related to the page cache') parser.add_option_group(statgroup) displaygroup = OptionGroup(parser, "Display Options", 'Options affecting display format:') displaygroup.add_option('-s', '--sort', action="store_true", dest="sort", help="Sort NFS mount points by ops/second") displaygroup.add_option('-l','--list', action="store", type="int", dest="list", help="only print stats for first LIST mount points") parser.add_option_group(displaygroup) (options, args) = parser.parse_args(sys.argv) for arg in args[1:]: if arg in mountstats: origdevices += [arg] elif not interval_seen: try: interval = int(arg) except: print('Illegal value %s' % arg) return if interval > 0: interval_seen = True else: print('Illegal value %s' % arg) return elif not count_seen: try: count = int(arg) except: print('Ilegal value %s' % arg) return if count > 0: count_seen = True else: print('Illegal value %s' % arg) return old_mountstats = None sample_time = 0.0 # make certain devices contains only NFS mount points devices = list_nfs_mounts(origdevices, mountstats) print_iostat_summary(old_mountstats, mountstats, devices, sample_time, options) if not interval_seen: return while True: if count_seen: count -= 1 if count == 0: break time.sleep(interval) old_mountstats = mountstats sample_time = interval mountstats = parse_stats_file('/proc/self/mountstats') # nfs mountpoints may appear or disappear, so we need to # recheck the devices list each time we parse mountstats devices = list_nfs_mounts(origdevices, mountstats) print_iostat_summary(old_mountstats, mountstats, devices, sample_time, options) # # Main # prog = os.path.basename(sys.argv[0]) try: iostat_command(prog) except KeyboardInterrupt: print('Caught ^C... exiting') sys.exit(1) sys.exit(0)