diff --git a/duct/objects.py b/duct/objects.py index b2437d4..21c48cd 100644 --- a/duct/objects.py +++ b/duct/objects.py @@ -344,7 +344,8 @@ def tick(self): self.running = False def createEvent(self, state, description, metric, prefix=None, - hostname=None, aggregation=None, evtime=None): + hostname=None, aggregation=None, evtime=None, + attributes=None): """Creates an Event object from the Source configuration""" if prefix: service_name = self.service + "." + prefix @@ -354,7 +355,7 @@ def createEvent(self, state, description, metric, prefix=None, return Event(state, service_name, description, metric, self.ttl, hostname=hostname or self.hostname, aggregation=aggregation, - evtime=evtime, tags=self.tags, attributes=self.attributes) + evtime=evtime, tags=self.tags, attributes=attributes) def createLog(self, evtype, data, evtime=None, hostname=None): """Creates an Event object from the Source configuration""" diff --git a/duct/sources/postfix.py b/duct/sources/postfix.py index 5ec6ab2..d4463b7 100644 --- a/duct/sources/postfix.py +++ b/duct/sources/postfix.py @@ -29,13 +29,13 @@ class Postfix(Source): **Metrics:** - :(service_name).active: - :(service_name).deferred: - :(service_name).maildrop: - :(service_name).incoming: - :(service_name).corrupt: - :(service_name).hold: - :(service_name).bounce: + :(service_name): + :(service_name): + :(service_name): + :(service_name): + :(service_name): + :(service_name): + :(service_name): """ ssh = True @@ -62,11 +62,10 @@ def get(self): val = int(out.strip('\n')) events.extend([ - self.createEvent('ok', '%s queue length' % queue, val, - prefix='%s.value' % queue), - self.createEvent('ok', 'Queue rate', val, - prefix='%s.rate' % queue, - aggregation=Counter) + self.createEvent('ok', 'postfix queue length', val, + attributes={ + 'queue': queue, + }) ]) else: