From fc55405a2e961a8c615727d13b60dec7dd7bc643 Mon Sep 17 00:00:00 2001 From: Tommy McNeely Date: Tue, 4 Nov 2014 17:09:52 -0800 Subject: [PATCH] Issue #6 - ReadDirPlus doesn't work on NFSv4 mounts This adds ReadDirPlus back in for NFSv3 mounts, but has an exception similar to the code used in nfsiostat. I had to expose another method in nfsiostat.py has_readdirplus() since that was internal only data before. ~tommy --- src/nfsiostat.py | 2 ++ src/plugin.py | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/nfsiostat.py b/src/nfsiostat.py index 03d78a2..df25afc 100644 --- a/src/nfsiostat.py +++ b/src/nfsiostat.py @@ -422,6 +422,8 @@ def backlog(self, sample_time): return (float(self.__rpc_data['backlogutil']) / sends) / sample_time else: return 0.0 + def has_readdirplus(self): + return self.__rpc_data.has_key('READDIRPLUS') def display_iostats(self, sample_time, which): """Display NFS and RPC stats in an iostat-like way diff --git a/src/plugin.py b/src/plugin.py index 6808bbf..ee6dd80 100644 --- a/src/plugin.py +++ b/src/plugin.py @@ -124,7 +124,7 @@ def _parse_config(self): self.logger.info("Configured to use proxy: %s:%s" % (proxy_host, proxy_port)) # Initialize NFS related values self.nfs_device_list = json.loads(config.get('nfs','device_list')) - self.nfs_ops = ['Read','Write','GetAttr','Access','Lookup','ReadDir'] + self.nfs_ops = ['Read','Write','GetAttr','Access','Lookup','ReadDir','ReadDirPlus'] except Exception, e: self.logger.exception(e) @@ -182,6 +182,9 @@ def _get_nfs_stat_for(self, volume, prefix='Component/NFS/Volume'): } for op in (self.nfs_ops): + if op.upper() is 'READDIRPLUS' and not volnfsstat.has_readdirplus(): + # NFSv4 mounts do not have READDIRPLUS + continue op_stat = volnfsstat.get_rpc_op_stats(op.upper(), self.duration) op_prefix = prefix + op op_data = {