1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| import sys
import subprocess
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("-a", action='store_true', help="access stats")
parser.add_argument("-c", action='store_true', help="close stats")
parser.add_argument("-r", action='store_true', help="read stats")
parser.add_argument("-w", action='store_true', help="write stats")
args = parser.parse_args()
if len(sys.argv)==1:
subprocess.Popen("nfsstat -l", shell=True)
elif args.a:
subprocess.Popen("nfsstat -l | grep 'access:' | awk '{print $5}' ", shell=True)
elif args.c:
subprocess.Popen("nfsstat -l | grep 'close:' | awk '{print $5}' ", shell=True)
elif args.r:
subprocess.Popen("nfsstat -l | grep 'read:' | awk '{print $5}' ", shell=True)
elif args.w:
subprocess.Popen("nfsstat -l | grep 'write:' | awk '{print $5}' ",shell=True) |