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 = {}
|
hosts_health = {}
|
||||||
all_agents = []
|
all_agents = []
|
||||||
for name in sequence:
|
for name in sequence:
|
||||||
consul_agent = self.agents.get(name)
|
if name in self.agents:
|
||||||
agent_health = consul_agent.get_health()
|
consul_agent = self.agents.get(name)
|
||||||
hosts_health[name] = agent_health
|
agent_health = consul_agent.get_health()
|
||||||
if not all_agents:
|
hosts_health[name] = agent_health
|
||||||
all_agents = agent_health.keys()
|
if not all_agents:
|
||||||
|
all_agents = agent_health.keys()
|
||||||
|
|
||||||
sequence_hosts_health = {}
|
sequence_hosts_health = {}
|
||||||
for host in all_agents:
|
for host in all_agents:
|
||||||
sequence_hosts_health[host] = []
|
sequence_hosts_health[host] = []
|
||||||
for name in sequence:
|
for name in sequence:
|
||||||
state = hosts_health[name].get(host)
|
if name in self.agents:
|
||||||
if state:
|
state = hosts_health[name].get(host)
|
||||||
sequence_hosts_health[host].append(state)
|
if state:
|
||||||
else:
|
sequence_hosts_health[host].append(state)
|
||||||
continue
|
else:
|
||||||
|
continue
|
||||||
|
|
||||||
return sequence_hosts_health
|
return sequence_hosts_health
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user