If any of the consul agents such as manage, tenant, or warehouse are not set.
This exception is raised: Exception when host-monitored by console: Object 'NoneType' has no attribute 'get_health': AttributeError: Object 'NoneType' has no attribute 'get_health'. Now to handle this exception, we just need to check the condition whether the name exists in 'agents.name'. Change-Id: I00ca3271f52eb4de770dbd719a57b2d15c138833
This commit is contained in:
12
masakari-monitors/doc/source/reference/conf.rst
Normal file
12
masakari-monitors/doc/source/reference/conf.rst
Normal file
@@ -0,0 +1,12 @@
|
||||
.. _monitors-config:
|
||||
|
||||
---------------------------------------
|
||||
Masakari Monitors Configuration Options
|
||||
---------------------------------------
|
||||
|
||||
The following is an overview of all available configuration options in
|
||||
masakari-monitors.
|
||||
To see sample configuration file, see :ref:`monitors-config-file`.
|
||||
|
||||
.. _show-options::
|
||||
:config-file: etc/masakarimonitors/masakarimonitors-config-generator.conf
|
@@ -71,21 +71,23 @@ class ConsulManager(object):
|
||||
hosts_health = {}
|
||||
all_agents = []
|
||||
for name in sequence:
|
||||
consul_agent = self.agents.get(name)
|
||||
agent_health = consul_agent.get_health()
|
||||
hosts_health[name] = agent_health
|
||||
if not all_agents:
|
||||
all_agents = agent_health.keys()
|
||||
if name in self.agents:
|
||||
consul_agent = self.agents.get(name)
|
||||
agent_health = consul_agent.get_health()
|
||||
hosts_health[name] = agent_health
|
||||
if not all_agents:
|
||||
all_agents = agent_health.keys()
|
||||
|
||||
sequence_hosts_health = {}
|
||||
for host in all_agents:
|
||||
sequence_hosts_health[host] = []
|
||||
for name in sequence:
|
||||
state = hosts_health[name].get(host)
|
||||
if state:
|
||||
sequence_hosts_health[host].append(state)
|
||||
else:
|
||||
continue
|
||||
if name in self.agents:
|
||||
state = hosts_health[name].get(host)
|
||||
if state:
|
||||
sequence_hosts_health[host].append(state)
|
||||
else:
|
||||
continue
|
||||
|
||||
return sequence_hosts_health
|
||||
|
||||
|
Reference in New Issue
Block a user