diff --git a/collective/check_munin/check_munin.py b/collective/check_munin/check_munin.py index df7b711..c5df6ec 100644 --- a/collective/check_munin/check_munin.py +++ b/collective/check_munin/check_munin.py @@ -35,7 +35,11 @@ def __init__(self, args): self.module = args.module self.only = args.only self.ignore = args.ignore - self.rrdpath = os.path.join(args.datadir, args.domain) + domain = args.domain + if not domain: + domain = re.sub(r'^[^\.]+\.', '', args.hostname) + self.rrdpath = os.path.join(args.datadir, domain) + def probe(self): myglob = os.path.join( @@ -61,7 +65,7 @@ def probe(self): @nagiosplugin.guarded def main(): argp = argparse.ArgumentParser(description=__doc__) - argp.add_argument('-d', '--domain', required=True, default='') + argp.add_argument('-d', '--domain', default='') argp.add_argument('-H', '--hostname', required=True, default='') argp.add_argument('-M', '--module', required=True, default='') argp.add_argument('-o', '--only', default='*',