Arturo Borrero Gonzalez has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/387243 )
Change subject: diamond: nfsiostat: update collector to read from arbitrary NFS mount points ...................................................................... diamond: nfsiostat: update collector to read from arbitrary NFS mount points Update nfsiostat collector to be more flexible and collect data from arbitrary NFS mounts points. This is required also because mount points are now being mixed with symlinks to support previous NFS schemes. We have now 2 config directives: * devices_include: regexp containing which devices should be included * devices_exclude: regexp for the opposite The regex (?!) match nothing, so by default we read all the data from /mnt/nfs/*. Bug: T179024 Change-Id: I3f022d39f512957c18d1e3c4b169706341d5373f Signed-off-by: Arturo Borrero Gonzalez <aborr...@wikimedia.org> --- M modules/diamond/files/collector/nfsiostat.py 1 file changed, 13 insertions(+), 8 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/operations/puppet refs/changes/43/387243/1 diff --git a/modules/diamond/files/collector/nfsiostat.py b/modules/diamond/files/collector/nfsiostat.py index dcdc0b8..ad94778 100644 --- a/modules/diamond/files/collector/nfsiostat.py +++ b/modules/diamond/files/collector/nfsiostat.py @@ -27,6 +27,7 @@ from __future__ import print_function import diamond.collector +import re Iostats_version = '0.2' @@ -349,11 +350,16 @@ return iostat -def list_nfs_mounts(mountstats): +def list_nfs_mounts(mountstats, include_regex, exclude_regex): """return a list of NFS mounts """ list = [] + for device, descr in mountstats.items(): + if not include_regex.match(device): + continue + if exclude_regex.match(device): + continue stats = DeviceData() stats.parse_stats(descr) if stats.is_nfs_mountpoint(): @@ -377,10 +383,8 @@ config.update({ 'enabled': False, 'path': 'nfsiostat', - 'devices': ['/home', - '/public/dumps', - '/data/scratch', - '/data/project'], + 'devices_include': '/mnt/nfs/*', + 'devices_exclude': '(?!)', 'attributes': ['attr', 'read', 'write', @@ -422,15 +426,16 @@ mountstats = parse_stats_file('/proc/self/mountstats') # make certain devices contains only NFS mount points - devices = list_nfs_mounts(mountstats) or [] - adevices = [d for d in devices if d in self.config['devices']] + include_regex = re.compile(self.config['devices_include']) + exclude_regex = re.compile(self.config['devices_exclude']) + devices = list_nfs_mounts(mountstats, include_regex, exclude_regex) if len(devices) == 0: self.log.error('No NFS mount points were found') return metrics = {} - stats = nfs_iostat(mountstats, adevices) + stats = nfs_iostat(mountstats, devices) nfs_ops = {} # ops are reported by mount point but this is disingenuous as -- To view, visit https://gerrit.wikimedia.org/r/387243 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I3f022d39f512957c18d1e3c4b169706341d5373f Gerrit-PatchSet: 1 Gerrit-Project: operations/puppet Gerrit-Branch: production Gerrit-Owner: Arturo Borrero Gonzalez <aborr...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits