diff --git a/nsca_client/README.rst b/nsca_client/README.rst index d799b56ff..5f0715841 100644 --- a/nsca_client/README.rst +++ b/nsca_client/README.rst @@ -27,18 +27,26 @@ Configuration To configure this module, you need to: -* Configure your server and a passive service in your moniroting tool - (e.g service ``ODOO MAIL QUEUE`` on host ``MY-SERVER``). +* Configure your server and a passive service in your monitoring tool + (e.g service ``Odoo Mail Queue`` on host ``MY-SERVER``). * On Odoo, set the previous hostname in the system parameters:: nsca_client.hostname = MY-SERVER * Declare your NSCA server in the menu Configuration / Technical / NSCA Client / Servers + +.. image:: nsca_client/static/description/server.png + :width: 400 px + * Create NSCA checks in the menu Configuration / Technical / NSCA Client / Checks + +.. image:: nsca_client/static/description/check.png + :width: 400 px + * Code the methods which will be called by the NSCA checks. -Such methods must return a tuple (RC, MESSAGE) where RC is an integer, -and MESSAGE a unicode string. ``RC`` values and the corresponding status are: +Such methods must return a tuple ``(RC, MESSAGE)`` where ``RC`` is an integer, +and ``MESSAGE`` a unicode string. ``RC`` values and the corresponding status are: - 0: OK - 1: WARNING diff --git a/nsca_client/__openerp__.py b/nsca_client/__openerp__.py index bd70cb762..2c073676e 100644 --- a/nsca_client/__openerp__.py +++ b/nsca_client/__openerp__.py @@ -12,11 +12,14 @@ "application": False, "installable": True, "external_dependencies": { - "bin": ['/usr/sbin/send_nsca'], + "bin": [ + '/usr/sbin/send_nsca', + ], }, "data": [ "security/ir.model.access.csv", "data/ir_config_parameter.xml", + "data/nsca_server.xml", "views/nsca_menu.xml", "views/nsca_check.xml", "views/nsca_server.xml", diff --git a/nsca_client/data/nsca_server.xml b/nsca_client/data/nsca_server.xml new file mode 100644 index 000000000..77453502c --- /dev/null +++ b/nsca_client/data/nsca_server.xml @@ -0,0 +1,13 @@ + + + + + + + nagios.example.net + 5667 + + + + diff --git a/nsca_client/demo/demo_data.xml b/nsca_client/demo/demo_data.xml index 9904136a2..2c9f91b18 100644 --- a/nsca_client/demo/demo_data.xml +++ b/nsca_client/demo/demo_data.xml @@ -2,14 +2,9 @@ - - nagios.example.net - 5667 - - - - ODOO MAIL QUEUE + + Odoo Mail Queue minutes mail.mail diff --git a/nsca_client/models/nsca_check.py b/nsca_client/models/nsca_check.py index 21c6ae3d7..79bdcaa2f 100644 --- a/nsca_client/models/nsca_check.py +++ b/nsca_client/models/nsca_check.py @@ -6,7 +6,7 @@ import logging import shlex import subprocess -from openerp import models, fields, api, _ +from openerp import _, api, fields, models from openerp.addons.base.ir.ir_cron import str2tuple @@ -108,8 +108,10 @@ class NscaCheck(models.Model): """Prepare the shell command used to send the check result to the NSCA daemon. """ - cmd = u"/usr/sbin/send_nsca -H %s -p %s" % ( - check.server_id.name, check.server_id.port) + cmd = u"/usr/sbin/send_nsca -H %s -p %s -c %s" % ( + check.server_id.name, + check.server_id.port, + check.server_id.config_file_path) return shlex.split(cmd) @api.model diff --git a/nsca_client/models/nsca_server.py b/nsca_client/models/nsca_server.py index 596f25eed..ea66c348c 100644 --- a/nsca_client/models/nsca_server.py +++ b/nsca_client/models/nsca_server.py @@ -2,7 +2,7 @@ # © 2015 ABF OSIELL # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -from openerp import models, fields +from openerp import fields, models class NscaServer(models.Model): @@ -11,5 +11,7 @@ class NscaServer(models.Model): name = fields.Char(u"Hostname", required=True) port = fields.Integer(u"Port", default=5667, required=True) + config_file_path = fields.Char( + u"Configuration file", default="/etc/send_nsca.cfg", required=True) check_ids = fields.One2many( 'nsca.check', 'server_id', string=u"Checks") diff --git a/nsca_client/static/description/check.png b/nsca_client/static/description/check.png new file mode 100644 index 000000000..5fdd064a4 Binary files /dev/null and b/nsca_client/static/description/check.png differ diff --git a/nsca_client/static/description/server.png b/nsca_client/static/description/server.png new file mode 100644 index 000000000..7d19803ca Binary files /dev/null and b/nsca_client/static/description/server.png differ diff --git a/nsca_client/views/nsca_server.xml b/nsca_client/views/nsca_server.xml index d9b98e52f..f03263dd9 100644 --- a/nsca_client/views/nsca_server.xml +++ b/nsca_client/views/nsca_server.xml @@ -14,6 +14,7 @@ + @@ -30,6 +31,7 @@ +