From cee13a9be8656ad1737f50bcd7903ac1897b6e3e Mon Sep 17 00:00:00 2001 From: Florent Date: Fri, 1 Mar 2013 23:50:59 +0100 Subject: [PATCH] Introduce env.exclude --- contrib/munin/generic/README | 5 +++++ contrib/munin/generic/generic-munin | 10 ++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/contrib/munin/generic/README b/contrib/munin/generic/README index da0f3dab..0017cc1a 100644 --- a/contrib/munin/generic/README +++ b/contrib/munin/generic/README @@ -36,6 +36,10 @@ If the attribut is itself one object, it is possible the use a hierarchical call Example: env.id_monitored account1@backend1 account2@backend2 A list of object (space as separator). Only there objects are diplayed. +==== env.exclude ==== +Example: env.exclude 550810@sachsen +Same as env.id_monitored, but to exclude an object of results + ==== env.cache_expire ==== Example: env.cache_expire 7200 (default 3600) @@ -129,6 +133,7 @@ env.attribvalue sensors/lastvalue/level env.title Niveau de l'elbe en Saxe env.label name env.vlabel Hauteur du fleuve (cm) +env.exclude 550810@sachsen # Temperature in Rennes [temprennes] diff --git a/contrib/munin/generic/generic-munin b/contrib/munin/generic/generic-munin index b730ea61..39825c4b 100755 --- a/contrib/munin/generic/generic-munin +++ b/contrib/munin/generic/generic-munin @@ -51,6 +51,9 @@ class GenericMuninPlugin(object): self.tomonitore = None if 'id_monitored' in os.environ: self.tomonitore = os.environ['id_monitored'].split(' ') + self.exclude = None + if 'exclude' in os.environ: + self.exclude = os.environ['exclude'].split(' ') # Attribut of object to use as ID (default: id) self.attribid = "id" if 'attribid' in os.environ: @@ -160,7 +163,10 @@ class GenericMuninPlugin(object): return result def monitored(self, result): - return not self.tomonitore or ('%s@%s' % (getattr(result, self.attribid), result.backend)) in self.tomonitore + id = '%s@%s' % (getattr(result, self.attribid), result.backend) + if self.exclude and id in self.exclude: + return False + return not self.tomonitore or id in self.tomonitore def result2id(self, result): attribs = self.attribid.split('/') @@ -182,7 +188,7 @@ class GenericMuninPlugin(object): self.write_output('graph_args -l 0') try: objects = [] - if self.tomonitore is not None: + if self.tomonitore is not None or self.exclude is not None: d = {} for backend, result in self.build_do(): if self.monitored(result):