-
Notifications
You must be signed in to change notification settings - Fork 11
/
nfsrwstat
56 lines (49 loc) · 1.37 KB
/
nfsrwstat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/bash
#
# Program: NFS throughput statistics <nfsrwstat.sh>
#
# Author: Matty < matty91 at gmail dot com >
#
# Current Version: 1.0
#
# Revision History:
#
# Version 1.0
# Initial Release
#
# Last Updated: 10-28-2011
#
# Purpose:
# nfsrwstat.sh will display the number of bytes read and written
# by the in-kernel nfsd threads.
#
# License:
# 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.
PROC_NFSD="/proc/net/rpc/nfsd"
SLEEP_INTERVAL=5
byteswritten=0
bytesread=0
totalwritten=0
totalread=0
printf "%-10s %-10s %-10s\n" Date "Bytes_Read" "Bytes_Written"
while :
do
input=$(grep io ${PROC_NFSD})
set -- $input
bytesread=$2
byteswritten=$3
totalwritten=$((${byteswritten} - $totalwritten))
totalread=$((${bytesread} - ${totalread}))
printf "%-10s %-10d %-10d\n" `date "+%H:%M:%S"` $totalread $totalwritten
totalwritten=${byteswritten}
totalread=${bytesread}
sleep ${SLEEP_INTERVAL}
done