Added python-monascaclient and Added more doc for Monasca driver
Enrich monasca-driver doc strings and documented un-documented methods Added missing Monasca client dependency Change-Id: Ie3dd02e5c70415a4e05d1add19a79de33705b712
This commit is contained in:
parent
61558d2b33
commit
5af54e4f62
|
@ -28,6 +28,10 @@ LOG = log.getLogger(__name__)
|
|||
|
||||
|
||||
class MonascaDriver(driver.MonitorBaseDriver):
|
||||
"""Monasca monitoring driver to monitor compute nodes. It makes use of
|
||||
Monasca to monitor the compute nodes. Metric information needed. 'hostname'
|
||||
must be used in dimensions to filter the values in alarms. You need to
|
||||
define alarms for all hosts with the required metrics."""
|
||||
|
||||
_OPTS = [
|
||||
cfg.StrOpt('keystone_url',
|
||||
|
@ -101,7 +105,7 @@ class MonascaDriver(driver.MonitorBaseDriver):
|
|||
)
|
||||
self.nodes = self.get_compute_nodes()
|
||||
# register metric options in their groups and load their values
|
||||
self.load_metrics()
|
||||
self.__load_metrics()
|
||||
|
||||
def _get_raw_data(self):
|
||||
""" This function returns the raw data we got from Monasca before
|
||||
|
@ -171,6 +175,7 @@ class MonascaDriver(driver.MonitorBaseDriver):
|
|||
return self.conf['metrics']
|
||||
|
||||
def _build_metrics(self, metric, hostname=None):
|
||||
"""Build the query to send to Monasca"""
|
||||
metric = CONF[metric]
|
||||
dimensions = {'hostname': hostname}
|
||||
dimensions.update(metric.get('dimensions', {}))
|
||||
|
@ -188,7 +193,7 @@ class MonascaDriver(driver.MonitorBaseDriver):
|
|||
2. ALARM
|
||||
3. UNDEFINED
|
||||
"""
|
||||
# @todo use list comprehension instead of loops
|
||||
# @todo(szaher) use list comprehension instead of loops
|
||||
# list below is correct and should return the extact same value like
|
||||
# the two nested for loops
|
||||
# nodes_down = [
|
||||
|
@ -225,6 +230,10 @@ class MonascaDriver(driver.MonitorBaseDriver):
|
|||
]
|
||||
|
||||
def __process_metric(self, node, metric_name, metric_data):
|
||||
"""Process metric values got from Monasca.
|
||||
Handles UNDETERMINED states and changes it to required state(read
|
||||
from config file).
|
||||
If no metric data found,"""
|
||||
metric_conf = CONF[metric_name]
|
||||
# process UNDETERMINED State and change it to the required state
|
||||
metric_data = [
|
||||
|
@ -244,9 +253,10 @@ class MonascaDriver(driver.MonitorBaseDriver):
|
|||
<li>Check your Monasca configuration and Metric configuration
|
||||
defined in freezer-dr.conf </li>
|
||||
</ul>
|
||||
You can try this command to check: <br />
|
||||
You can try this command to check: <br /><code>
|
||||
$ monasca alarm-list --metric-name {3} --metric-dimensions
|
||||
hostname={2}
|
||||
</code>
|
||||
<br /> <br />
|
||||
Freezer-DR
|
||||
""".format(metric_name, str(metric_data), node,
|
||||
|
@ -292,12 +302,14 @@ class MonascaDriver(driver.MonitorBaseDriver):
|
|||
client = utils.get_os_client()
|
||||
return client.novacomputes()
|
||||
|
||||
def load_metrics(self):
|
||||
def __load_metrics(self):
|
||||
"""load custom sections created by user"""
|
||||
for metric in self.conf.metrics:
|
||||
CONF.register_opts(self._metric_opts, group=metric)
|
||||
CONF.register_opts(self.__metric_opts, group=metric)
|
||||
|
||||
@property
|
||||
def _metric_opts(self):
|
||||
def __metric_opts(self):
|
||||
"""List of options to be used in metric defined sections"""
|
||||
return [
|
||||
cfg.StrOpt("metric_name",
|
||||
help="Metric Name used to log monitoring information"
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
pbr>=1.6 # Apache-2.0
|
||||
python-keystoneclient>=2.0.0,!=2.1.0 # Apache-2.0
|
||||
python-monascaclient>=1.1.0 # Apache-2.0
|
||||
python-neutronclient>=5.1.0 # Apache-2.0
|
||||
python-novaclient>=2.29.0,!=2.33.0 # Apache-2.0
|
||||
PyYAML>=3.1.0 # MIT
|
||||
|
@ -8,4 +9,4 @@ oslo.i18n>=2.1.0 # Apache-2.0
|
|||
oslo.utils>=3.16.0 # Apache-2.0
|
||||
oslo.log>=1.14.0 # Apache-2.0
|
||||
libvirt-python>=1.2.5 # LGPLv2+
|
||||
Jinja2>=2.8 # BSD License (3 clause)
|
||||
Jinja2>=2.8 # BSD License (3 clause)
|
||||
|
|
Loading…
Reference in New Issue