NFS metering/beancounting/traffic measurement/write counts - stats per client
I want to be able to check how many MB each NFS client has read and written.
Running Debian 7 Wheezy (updated)
So far the most suitable method I've found is
nfsiostat
However when I run it, my NFS server only shows a SINGLE client and it's stats. (the problem is all of the other connected clients are missing) Even though I have multiple NFS clients connected. For example my dev machine, I've been using the NFS for weeks reading and writing files all day but somehow it doesn't list my dev machine. I even wrote a 10MB test file right now from my dev machine (not shown) and confirmed it exists on the server via SSH, so my dev machine is not imagining it's there.
I've got the same IPTABLES rules governing all connected clients.
These are the relevant IPTABLES rules
:INPUT DROP [9750:1434843]
:FORWARD DROP [3684:954036]
:OUTPUT DROP [107:44964]
-A INPUT -i lo -j ACCEPT
-A INPUT -i eth0 -p tcp -m tcp --dport 111 -j ACCEPT
-A INPUT -i eth0 -p tcp -m tcp --dport 2049 -j ACCEPT
-A INPUT -i eth0 -p tcp -m tcp --dport 4002 -j ACCEPT
-A INPUT -i eth0 -p tcp -m tcp --dport 32767 -j ACCEPT
-A INPUT -i eth0 -p udp -m udp --dport 111 -j ACCEPT
-A INPUT -i eth0 -p udp -m udp --dport 2049 -j ACCEPT
-A INPUT -i eth0 -p udp -m udp --dport 4002 -j ACCEPT
-A INPUT -i eth0 -p udp -m udp --dport 32767 -j ACCEPT
-A INPUT -m state --state ESTABLISHED -j ACCEPT
nfsiostat --version shows 0.2
nfsstat -m has the exact same problem. The dev machine is connected, but not showing.
On the client that is visible, the mount looks like this:
192.168.0.1:/tmp/foo on /mnt/foo type nfs (rw,relatime,vers=3,rsize=1048576,wsize=1048576,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sy s,mountaddr=192.168.0.1,mountvers=3,mountport=32767,mountproto=udp,local_lock=none,addr=192.168.0.1)
On the dev machine the mount looks like this
192.168.0.1:/tmp/bar on /mnt/bar type nfs (rw,vers=4,addr=192.168.0.1,clientaddr=192.168.0.99)
I even dismounted the dev machine and forced it to mount as NFSv3. Now `mount` on the dev machine shows
192.168.0.1:/data on /mnt/bar type nfs (rw,nfsvers=3,addr=192.168.0.1)
It's fully functional but still not showing up with nfsiostat or nfsstat -m
Linux server is:
Linux bob 2.6.32-openvz-042stab093.5-amd64 #1 SMP Wed Sep 10 17:47:17 MSK 2014 x86_64 GNU/Linux
Any ideas?
EDIT
So ChrisH from #debian on Freenode helped me.
He informed me that nfsstat -m and nfsiostat are infact CLIENT commands.
Maybe because my server is running OpenVZ, those two commands got confused and gave me the results from one of the containers, fooling me into thinking it was a server command, that was just not showing the stats of all clients.
====================
So this problem remains unresolved. I still don't have a way to determine on the server, if any clients are abusing the NFS server (how many MB they've read/written).
Last edited by Lop3; 11-26-2014 at 10:07 AM.
|