]> arthur.barton.de Git - netdata.git/blob - python.d/exim.chart.py
ab-debian 0.20170327.01-0ab1, upstream v1.6.0-42-gaa6b96fc
[netdata.git] / python.d / exim.chart.py
1 # -*- coding: utf-8 -*-
2 # Description: exim netdata python.d module
3 # Author: Pawel Krupa (paulfantom)
4
5 from base import ExecutableService
6
7 # default module values (can be overridden per job in `config`)
8 # update_every = 2
9 priority = 60000
10 retries = 60
11
12 # charts order (can be overridden if you want less charts, or different order)
13 ORDER = ['qemails']
14
15 CHARTS = {
16     'qemails': {
17         'options': [None, "Exim Queue Emails", "emails", 'queue', 'exim.qemails', 'line'],
18         'lines': [
19             ['emails', None, 'absolute']
20         ]}
21 }
22
23
24 class Service(ExecutableService):
25     def __init__(self, configuration=None, name=None):
26         ExecutableService.__init__(self, configuration=configuration, name=name)
27         self.command = "exim -bpc"
28         self.order = ORDER
29         self.definitions = CHARTS
30
31     def _get_data(self):
32         """
33         Format data received from shell command
34         :return: dict
35         """
36         try:
37             return {'emails': int(self._get_raw_data()[0])}
38         except (ValueError, AttributeError):
39             return None