{"action":"created","issue":{"url":"https://api.github.com/repos/OCA/server-tools/issues/312","repository_url":"https://api.github.com/repos/OCA/server-tools","labels_url":"https://api.github.com/repos/OCA/server-tools/issues/312/labels{/name}","comments_url":"https://api.github.com/repos/OCA/server-tools/issues/312/comments","events_url":"https://api.github.com/repos/OCA/server-tools/issues/312/events","html_url":"https://github.com/OCA/server-tools/pull/312","id":122292695,"number":312,"title":"[8.0][ADD] Module 'nsca_client' - Send passive alerts to a NSCA daemon","user":{"login":"sebalix","id":5315285,"avatar_url":"https://avatars.githubusercontent.com/u/5315285?v=3","gravatar_id":"","url":"https://api.github.com/users/sebalix","html_url":"https://github.com/sebalix","followers_url":"https://api.github.com/users/sebalix/followers","following_url":"https://api.github.com/users/sebalix/following{/other_user}","gists_url":"https://api.github.com/users/sebalix/gists{/gist_id}","starred_url":"https://api.github.com/users/sebalix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sebalix/subscriptions","organizations_url":"https://api.github.com/users/sebalix/orgs","repos_url":"https://api.github.com/users/sebalix/repos","events_url":"https://api.github.com/users/sebalix/events{/privacy}","received_events_url":"https://api.github.com/users/sebalix/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/OCA/server-tools/labels/needs%20review","name":"needs review","color":"fbca04"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":14,"created_at":"2015-12-15T15:09:37Z","updated_at":"2016-04-07T13:29:51Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/OCA/server-tools/pulls/312","html_url":"https://github.com/OCA/server-tools/pull/312","diff_url":"https://github.com/OCA/server-tools/pull/312.diff","patch_url":"https://github.com/OCA/server-tools/pull/312.patch"},"body":"===========\r\nNSCA Client\r\n===========\r\n\r\nSend passive alert to your favorite NSCA daemon (Nagios, Shinken...).\r\nThis module is based on the Odoo cron system and requires a NSCA client\r\ninstalled on the system to satisfy the ``/usr/sbin/send_nsca`` command.\r\n\r\nInstallation\r\n============\r\n\r\nTo install this module, you need to install a NSCA client.\r\n\r\nOn Debian/Ubuntu:\r\n\r\n    $ sudo apt-get install nsca-client\r\n\r\nThen configure the NSCA client in ``/etc/send_nsca.cfg`` (password\r\nand encryption method).\r\n\r\nConfiguration\r\n=============\r\n\r\nTo configure this module, you need to:\r\n\r\n* Configure your server and a passive service in your moniroting tool\r\n  (e.g service ``ODOO MAIL QUEUE`` on host ``MY-SERVER``).\r\n* On Odoo, set the previous hostname in the system parameters:\r\n\r\n    nsca_client.hostname = MY-SERVER\r\n\r\n* Declare your NSCA server in the menu Configuration / Technical / NSCA Client / Servers\r\n* Create NSCA checks in the menu Configuration / Technical / NSCA Client / Checks\r\n* Code the methods which will be called by the NSCA checks.\r\n\r\nSuch methods must return a tuple (RC, MESSAGE) where RC is an integer,\r\nand MESSAGE a unicode string. ``RC`` values and the corresponding status are:\r\n\r\n- 0: OK\r\n- 1: WARNING\r\n- 2: CRITICAL\r\n- 3: UNKNOWN\r\n\r\nE.g:\r\n\r\n    class MailMail(models.Model):\r\n        _inherit = 'mail.mail'\r\n\r\n        @api.model\r\n        def nsca_check_mails(self):\r\n            mails = self.search([('state', '=', 'exception')])\r\n            if mails:\r\n                return (1, u\"%s mails not sent\" % len(mails))\r\n            return (0, u\"OK\")\r\n"},"comment":{"url":"https://api.github.com/repos/OCA/server-tools/issues/comments/206903044","html_url":"https://github.com/OCA/server-tools/pull/312#issuecomment-206903044","issue_url":"https://api.github.com/repos/OCA/server-tools/issues/312","id":206903044,"user":{"login":"sebalix","id":5315285,"avatar_url":"https://avatars.githubusercontent.com/u/5315285?v=3","gravatar_id":"","url":"https://api.github.com/users/sebalix","html_url":"https://github.com/sebalix","followers_url":"https://api.github.com/users/sebalix/followers","following_url":"https://api.github.com/users/sebalix/following{/other_user}","gists_url":"https://api.github.com/users/sebalix/gists{/gist_id}","starred_url":"https://api.github.com/users/sebalix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sebalix/subscriptions","organizations_url":"https://api.github.com/users/sebalix/orgs","repos_url":"https://api.github.com/users/sebalix/repos","events_url":"https://api.github.com/users/sebalix/events{/privacy}","received_events_url":"https://api.github.com/users/sebalix/received_events","type":"User","site_admin":false},"created_at":"2016-04-07T13:29:51Z","updated_at":"2016-04-07T13:29:51Z","body":"I updated this module to:\r\n- avoid to send a message to the NSCA server if the method called does not return (option \"Allow void result\"),\r\n- configure the hostname of the node at the NSCA server level (and not in a system parameter anymore, as the hostname could be different from one monitoring server to another if several of them are configured - which is our case),\r\n- auto-generate the configuration files used by the `send_nsca` command (stored in `{DATA_DIR}/nsca_client/send_nsca_{nsca_server.id}.cfg`), and configure the password and encryption method to use directly in the NSCA server form."}}