exim.chart.py 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. # -*- coding: utf-8 -*-
  2. # Description: exim netdata python.d module
  3. # Author: Pawel Krupa (paulfantom)
  4. # SPDX-License-Identifier: GPL-3.0-or-later
  5. from bases.FrameworkServices.ExecutableService import ExecutableService
  6. # default module values (can be overridden per job in `config`)
  7. # update_every = 2
  8. priority = 60000
  9. # charts order (can be overridden if you want less charts, or different order)
  10. ORDER = ['qemails']
  11. CHARTS = {
  12. 'qemails': {
  13. 'options': [None, 'Exim Queue Emails', 'emails', 'queue', 'exim.qemails', 'line'],
  14. 'lines': [
  15. ['emails', None, 'absolute']
  16. ]
  17. }
  18. }
  19. class Service(ExecutableService):
  20. def __init__(self, configuration=None, name=None):
  21. ExecutableService.__init__(self, configuration=configuration, name=name)
  22. self.command = 'exim -bpc'
  23. self.order = ORDER
  24. self.definitions = CHARTS
  25. def _get_data(self):
  26. """
  27. Format data received from shell command
  28. :return: dict
  29. """
  30. try:
  31. return {'emails': int(self._get_raw_data()[0])}
  32. except (ValueError, AttributeError):
  33. return None