Browse Source
[IMP] Module 'nsca_client' - Review + Default NSCA server added + Configuration file path added on the NSCA server (each server can require a different password)
pull/1280/head
sebalix
9 years ago
committed by
Enric Tobella
No known key found for this signature in database
GPG Key ID: 1A2546A1B7BA2451
9 changed files with
41 additions and
16 deletions
nsca_client/README.rst
nsca_client/__openerp__.py
nsca_client/data/nsca_server.xml
nsca_client/demo/demo_data.xml
nsca_client/models/nsca_check.py
nsca_client/models/nsca_server.py
BIN
nsca_client/static/description/check.png
BIN
nsca_client/static/description/server.png
nsca_client/views/nsca_server.xml
@ -27,18 +27,26 @@ Configuration
To configure this module, you need to:
* Configure your server and a passive service in your moniro ting tool
(e.g service `` ODOO MAIL QUEUE `` on host `` MY-SERVER `` ).
* Configure your server and a passive service in your monitor ing 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
@ -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 " ,
@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- © 2015 ABF OSIELL <http://osiell.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -->
<openerp >
<data noupdate= "1" >
<record id= "nsca_server_default" model= "nsca.server" >
<field name= "name" > nagios.example.net</field>
<field name= "port" > 5667</field>
</record>
</data>
</openerp>
@ -2,14 +2,9 @@
<openerp >
<data >
<record id= "demo_nsca_server" model= "nsca.server" >
<field name= "name" > nagios.example.net</field>
<field name= "port" > 5667</field>
</record>
<record id= "demo_nsca_check_mails" model= "nsca.check" >
<field name= "server_id" ref= "demo_ nsca_server" />
<field name= "service" > ODOO MAIL QUEUE </field>
<field name= "server_id" ref= "nsca_server_default" />
<field name= "service" > Odoo Mail Queue</field>
<field name= "interval_number" eval= "10" />
<field name= "interval_type" > minutes</field>
<field name= "nsca_model" > mail.mail</field>
@ -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
@ -2,7 +2,7 @@
# © 2015 ABF OSIELL <http://osiell.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import models , field s
from openerp import fields , model s
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 " )
Width: 655
|
Height: 368
|
Size: 36 KiB
Width: 635
|
Height: 373
|
Size: 17 KiB
@ -14,6 +14,7 @@
<group string= "NSCA Server" >
<field name= "name" style= "width: 30%;" />
<field name= "port" />
<field name= "config_file_path" />
</group>
<group string= "Checks" >
<field name= "check_ids" nolabel= "1" />
@ -30,6 +31,7 @@
<tree string= "NSCA Servers" >
<field name= "name" />
<field name= "port" />
<field name= "config_file_path" />
</tree>
</field>
</record>