You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

126 lines
3.6 KiB

  1. .. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
  2. :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
  3. :alt: License: AGPL-3
  4. ===========
  5. NSCA Client
  6. ===========
  7. This is a technical module to send passive alerts to your favorite NSCA daemon
  8. (Nagios, Shinken...).
  9. This module is based on the Odoo cron system and requires a NSCA client
  10. installed on the system to satisfy the ``/usr/sbin/send_nsca`` command.
  11. Installation
  12. ============
  13. To use this module, you need to install a NSCA client.
  14. On Debian/Ubuntu::
  15. $ sudo apt-get install nsca-client
  16. Configuration
  17. =============
  18. To configure this module, you need to:
  19. * Configure your server and a passive service in your monitoring tool
  20. (e.g service ``Odoo Mail Queue`` on host ``MY-SERVER``).
  21. * Declare your NSCA server in the menu Configuration / Technical / NSCA Client / Servers
  22. .. image:: nsca_client/static/description/server.png
  23. :width: 400 px
  24. * Create NSCA checks in the menu Configuration / Technical / NSCA Client / Checks
  25. .. image:: nsca_client/static/description/check.png
  26. :width: 400 px
  27. * Code the methods which will be called by the NSCA checks.
  28. Such methods must return a tuple ``(RC, MESSAGE, PERFORMANCE_DATA)`` where ``RC`` is an integer,
  29. ``MESSAGE`` a unicode string AND ``PERFOMANCE_DATA`` is a dictionary.
  30. ``RC`` values and the corresponding status are:
  31. - 0: OK
  32. - 1: WARNING
  33. - 2: CRITICAL
  34. - 3: UNKNOWN
  35. ``PERFORMANCE_DATA`` is not mandatory, so it could be possible to send
  36. ``(RC, MESSAGE)``.
  37. Each element of ``PERFORMANCE_DATA`` will be a dictionary that could contain:
  38. - value: value of the data (required)
  39. - max: Max value on the chart
  40. - min: Minimum value on the chart
  41. - warn: Warning value on the chart
  42. - crit: Critical value on the chart
  43. - uom: Unit of Measure on the chart (s - Seconds, % - Percentage, B - Bytes, c - Continuous)
  44. The key of the dictionary will be used as the performance_data label.
  45. E.g:
  46. .. code-block:: python
  47. class MailMail(models.Model):
  48. _inherit = 'mail.mail'
  49. @api.model
  50. def nsca_check_mails(self):
  51. mails = self.search([('state', '=', 'exception')])
  52. if mails:
  53. return (1, u"%s mails not sent" % len(mails), {
  54. 'exceptions': {'value': len(mails)}})
  55. return (0, u"OK", {'exceptions': {'value': len(mails)}})
  56. On the example, the performance data will use the label ``exceptions`` and the
  57. value will be the number of exception of mails.
  58. Usage
  59. =====
  60. .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
  61. :alt: Try me on Runbot
  62. :target: https://runbot.odoo-community.org/runbot/149/11.0
  63. Bug Tracker
  64. ===========
  65. Bugs are tracked on `GitHub Issues
  66. <https://github.com/OCA/server-tools/issues>`_. In case of trouble, please
  67. check there if your issue has already been reported. If you spotted it first,
  68. help us smashing it by providing a detailed and welcomed feedback.
  69. Credits
  70. =======
  71. Images
  72. ------
  73. * Daniel Foré: `Icon <http://www.iconarchive.com/show/elementary-icons-by-danrabbit/Apps-system-monitor-icon.html>`_ (Elementary theme, GPL).
  74. Contributors
  75. ------------
  76. * Sébastien Alix <sebastien.alix@osiell.com>
  77. * Enric Tobella <etobella@creublanca.es>
  78. Maintainer
  79. ----------
  80. .. image:: https://odoo-community.org/logo.png
  81. :alt: Odoo Community Association
  82. :target: https://odoo-community.org
  83. This module is maintained by the OCA.
  84. OCA, or the Odoo Community Association, is a nonprofit organization whose
  85. mission is to support the collaborative development of Odoo features and
  86. promote its widespread use.
  87. To contribute to this module, please visit https://odoo-community.org.