NRPE services is a list not a string
Pass charm-helpers' nrpe.add_init_service_checks() a list of services as its second argument, instead of a string. Additionally adjust amulet tests to configure hacluster's cluster_count when > 1 unit is configured. Change-Id: Ib48a31e17c1e8d8c68e774b64fcf52c0ee99bef5 Closes-Bug: 1643855
This commit is contained in:
parent
7d21e6bc94
commit
d367494fbe
|
@ -699,7 +699,7 @@ def update_nrpe_config():
|
|||
hostname = nrpe.get_nagios_hostname()
|
||||
current_unit = nrpe.get_nagios_unit_name()
|
||||
nrpe_setup = nrpe.NRPE(hostname=hostname)
|
||||
nrpe.add_init_service_checks(nrpe_setup, 'mysql', current_unit)
|
||||
nrpe.add_init_service_checks(nrpe_setup, ['mysql'], current_unit)
|
||||
nrpe_setup.add_check(
|
||||
shortname='mysql_proc',
|
||||
description='Check MySQL process {%s}' % current_unit,
|
||||
|
|
|
@ -72,6 +72,7 @@ class BasicDeployment(OpenStackAmuletDeployment):
|
|||
|
||||
configs = {'percona-cluster': cfg_percona}
|
||||
if self.units > 1:
|
||||
cfg_ha['cluster_count'] = str(self.units)
|
||||
configs['hacluster'] = cfg_ha
|
||||
|
||||
return configs
|
||||
|
|
|
@ -192,3 +192,18 @@ class TestHostResolution(CharmTestCase):
|
|||
self.resolve_network_cidr.return_value = '192.168.20.2/24'
|
||||
self.assertEqual(hooks.get_db_host('myclient'), '192.168.20.200')
|
||||
self.network_get_primary_address.assert_called_with('shared-db')
|
||||
|
||||
|
||||
class TestNRPERelation(CharmTestCase):
|
||||
def setUp(self):
|
||||
patch_targets_nrpe = TO_PATCH[:]
|
||||
patch_targets_nrpe.remove("update_nrpe_config")
|
||||
patch_targets_nrpe.append("nrpe")
|
||||
patch_targets_nrpe.append("apt_install")
|
||||
CharmTestCase.setUp(self, hooks, patch_targets_nrpe)
|
||||
|
||||
def test_mysql_monitored(self):
|
||||
"""The mysql service is monitored by Nagios."""
|
||||
hooks.update_nrpe_config()
|
||||
self.nrpe.add_init_service_checks.assert_called_once_with(
|
||||
mock.ANY, ["mysql"], mock.ANY)
|
||||
|
|
Loading…
Reference in New Issue