Browse Source

[IMP] nsca_client - Configure the node hostname at the NSCA server level

pull/1280/head
sebalix 9 years ago
committed by Enric Tobella
parent
commit
871172444b
No known key found for this signature in database GPG Key ID: 1A2546A1B7BA2451
  1. 1
      nsca_client/__openerp__.py
  2. 13
      nsca_client/data/ir_config_parameter.xml
  3. 3
      nsca_client/models/nsca_check.py
  4. 4
      nsca_client/models/nsca_server.py
  5. 3
      nsca_client/views/nsca_server.xml

1
nsca_client/__openerp__.py

@ -13,7 +13,6 @@
"installable": True,
"data": [
"security/ir.model.access.csv",
"data/ir_config_parameter.xml",
"data/nsca_server.xml",
"views/nsca_menu.xml",
"views/nsca_check.xml",

13
nsca_client/data/ir_config_parameter.xml

@ -1,13 +0,0 @@
<?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_client_hostname" model="ir.config_parameter">
<field name="key">nsca_client.hostname</field>
<field name="value">localhost</field>
</record>
</data>
</openerp>

3
nsca_client/models/nsca_check.py

@ -106,8 +106,7 @@ class NscaCheck(models.Model):
def _format_check_result(self, check, rc, message):
"""Format the check result with tabulations as delimiter."""
message = message.replace('\t', ' ')
hostname = self.env['ir.config_parameter'].get_param(
'nsca_client.hostname', 'localhost')
hostname = check.server_id.node_hostname
check_result = u"%s\t%s\t%s\t%s" % (
hostname, check.service, rc, message)
return check_result.encode('utf-8')

4
nsca_client/models/nsca_server.py

@ -11,6 +11,10 @@ class NscaServer(models.Model):
name = fields.Char(u"Hostname", required=True)
port = fields.Integer(u"Port", default=5667, required=True)
node_hostname = fields.Char(
u"Hostname of this node", required=True,
help=u"This is the hostname of the current node declared in the "
u"monitoring server.")
config_file_path = fields.Char(
u"Configuration file", default="/etc/send_nsca.cfg", required=True)
check_ids = fields.One2many(

3
nsca_client/views/nsca_server.xml

@ -16,6 +16,9 @@
<field name="port"/>
<field name="config_file_path"/>
</group>
<group string="Node identity">
<field name="node_hostname"/>
</group>
<group string="Checks">
<field name="check_ids" nolabel="1"/>
</group>

Loading…
Cancel
Save