自启动以来的 NFS 读取/写入

自启动以来的 NFS 读取/写入

我想要检索每个 NFS 挂载点读取/写入的总千字节数。

使用以下命令,我能够看到每个 NFS 挂载点的当前吞吐量(以 kB/S 为单位)。

iostat -nk

或者:

nfsiostat

有没有办法告诉 iostat 或 nfsiostat 返回自启动以来的总千字节数?

(与的最后两列非常相似iostat -k

Device:    tps    kB/read/s    kB/wrtn/s    kB_read    kB_wrtn
sda        17.69  234.75       30.82        2760421    362433

答案1

假设你使用 Linux 客户端,你可以使用安装统计命令,打印每个挂载点的统计信息:

$ mountstats /mnt
Stats for xxxx:/ mounted on /mnt:
  NFS mount options: rw,vers=4.1,rsize=32768,wsize=32768,namlen=255,acregmin=3,acregmax=60,acdirmin=30,acdirmax=60,hard,proto=tcp,timeo=600,retrans=2,sec=sys,clientaddr=a.b.c.d,local_lock=none
  NFS server capabilities: caps=0x3ffdf,wtmult=512,dtsize=32768,bsize=0,namlen=255
  NFSv4 capability flags: bm0=0xfcffbfff,bm1=0x40fdbe3e,bm2=0x800,acl=0x3,sessions,pnfs=LAYOUT_NFSV4_1_FILES
  NFS security flavor: 1  pseudoflavor: 0

NFS byte counts:
  applications read 602253119 bytes via read(2)
  applications wrote 1750 bytes via write(2)
  applications read 0 bytes via O_DIRECT read(2)
  applications wrote 0 bytes via O_DIRECT write(2)
  client read 552781120 bytes via NFS READ
  client wrote 1750 bytes via NFS WRITE

RPC statistics:
  634086 RPC requests sent, 634061 RPC replies received (0 XIDs not found)
  average backlog queue length: 0

READ:
    164908 ops (26%) 
    avg bytes sent per op: 208  avg bytes received per op: 3457
    backlog wait: 0.112984  RTT: 0.523801   total execute time: 0.651181 (milliseconds)
GETATTR:
    156471 ops (24%)    4 retrans (0%)  0 major timeouts
    avg bytes sent per op: 191  avg bytes received per op: 267
    backlog wait: 0.202849  RTT: 0.257179   total execute time: 0.496686 (milliseconds)
LAYOUTGET:
    156323 ops (24%) 
    avg bytes sent per op: 236  avg bytes received per op: 215
    backlog wait: 0.007536  RTT: 5.057336   total execute time: 5.319857 (milliseconds)
OPEN_NOATTR:
    156321 ops (24%) 
    avg bytes sent per op: 260  avg bytes received per op: 347
    backlog wait: 0.007126  RTT: 0.473941   total execute time: 0.489806 (milliseconds)

在基于 RedHat 的系统上,它是 nfs-util 包的一部分。在基于 debian 的系统上,可能是 nfs-common。

相关内容