Merge "Improve the configuration parameters for grafana"
This commit is contained in:
@@ -19,7 +19,10 @@
|
|||||||
from oslo_config import cfg
|
from oslo_config import cfg
|
||||||
|
|
||||||
grafana_client = cfg.OptGroup(name='grafana_client',
|
grafana_client = cfg.OptGroup(name='grafana_client',
|
||||||
title='Configuration Options for Grafana')
|
title='Configuration Options for Grafana',
|
||||||
|
help="See https://docs.openstack.org/watcher/lat"
|
||||||
|
"est/datasources/grafana.html for details "
|
||||||
|
"on how these options are used.")
|
||||||
|
|
||||||
GRAFANA_CLIENT_OPTS = [
|
GRAFANA_CLIENT_OPTS = [
|
||||||
# TODO(Dantali0n) each individual metric could have its own token.
|
# TODO(Dantali0n) each individual metric could have its own token.
|
||||||
@@ -31,7 +34,7 @@ GRAFANA_CLIENT_OPTS = [
|
|||||||
# A similar structure to the database_map would solve this.
|
# A similar structure to the database_map would solve this.
|
||||||
cfg.StrOpt('base_url',
|
cfg.StrOpt('base_url',
|
||||||
default=None,
|
default=None,
|
||||||
help="first part of the url (including https:// or http://) up "
|
help="First part of the url (including https:// or http://) up "
|
||||||
"until project id part. "
|
"until project id part. "
|
||||||
"Example: https://secure.org/api/datasource/proxy/"),
|
"Example: https://secure.org/api/datasource/proxy/"),
|
||||||
cfg.DictOpt('project_id_map',
|
cfg.DictOpt('project_id_map',
|
||||||
@@ -48,7 +51,7 @@ GRAFANA_CLIENT_OPTS = [
|
|||||||
'instance_l3_cache_usage': None,
|
'instance_l3_cache_usage': None,
|
||||||
'instance_root_disk_size': None,
|
'instance_root_disk_size': None,
|
||||||
},
|
},
|
||||||
help="Mapping of grafana project ids to datasource metrics. "
|
help="Mapping of datasource metrics to grafana project ids. "
|
||||||
"Dictionary values should be positive integers. "
|
"Dictionary values should be positive integers. "
|
||||||
"Example: 7465"),
|
"Example: 7465"),
|
||||||
cfg.DictOpt('database_map',
|
cfg.DictOpt('database_map',
|
||||||
@@ -65,7 +68,7 @@ GRAFANA_CLIENT_OPTS = [
|
|||||||
'instance_l3_cache_usage': None,
|
'instance_l3_cache_usage': None,
|
||||||
'instance_root_disk_size': None,
|
'instance_root_disk_size': None,
|
||||||
},
|
},
|
||||||
help="Mapping of grafana databases to datasource metrics. "
|
help="Mapping of datasource metrics to grafana databases. "
|
||||||
"Values should be strings. Example: influx_production"),
|
"Values should be strings. Example: influx_production"),
|
||||||
cfg.DictOpt('attribute_map',
|
cfg.DictOpt('attribute_map',
|
||||||
default={
|
default={
|
||||||
@@ -81,10 +84,10 @@ GRAFANA_CLIENT_OPTS = [
|
|||||||
'instance_l3_cache_usage': None,
|
'instance_l3_cache_usage': None,
|
||||||
'instance_root_disk_size': None,
|
'instance_root_disk_size': None,
|
||||||
},
|
},
|
||||||
help="Mapping of resource attributes to datasource metrics. "
|
help="Mapping of datasource metrics to resource attributes. "
|
||||||
"For a complete list of available attributes see "
|
"For a complete list of available attributes see "
|
||||||
"instance.py and node.py in "
|
"https://docs.openstack.org/watcher/latest/datasources/gr"
|
||||||
"decision_engine/model/element. "
|
"afana.html#attribute "
|
||||||
"Values should be strings. Example: hostname"),
|
"Values should be strings. Example: hostname"),
|
||||||
cfg.DictOpt('translator_map',
|
cfg.DictOpt('translator_map',
|
||||||
default={
|
default={
|
||||||
@@ -100,7 +103,7 @@ GRAFANA_CLIENT_OPTS = [
|
|||||||
'instance_l3_cache_usage': None,
|
'instance_l3_cache_usage': None,
|
||||||
'instance_root_disk_size': None,
|
'instance_root_disk_size': None,
|
||||||
},
|
},
|
||||||
help="Mapping of grafana translators to datasource metrics. "
|
help="Mapping of datasource metrics to grafana translators. "
|
||||||
"Values should be strings. Example: influxdb"),
|
"Values should be strings. Example: influxdb"),
|
||||||
cfg.DictOpt('query_map',
|
cfg.DictOpt('query_map',
|
||||||
# {0} = aggregate
|
# {0} = aggregate
|
||||||
@@ -121,12 +124,17 @@ GRAFANA_CLIENT_OPTS = [
|
|||||||
'instance_l3_cache_usage': None,
|
'instance_l3_cache_usage': None,
|
||||||
'instance_root_disk_size': None,
|
'instance_root_disk_size': None,
|
||||||
},
|
},
|
||||||
help="Mapping of grafana queries to datasource metrics. "
|
help="Mapping of datasource metrics to grafana queries. "
|
||||||
"Values should be strings for which the .format method "
|
"Values should be strings for which the .format method "
|
||||||
"will transform it. These queries will need to be "
|
"will transform it. The transformation offers five "
|
||||||
"constructed using tools such as Postman. "
|
"parameters to the query labeled {0} to {4}. {0} will be "
|
||||||
"Example: SELECT cpu FROM {4}.cpu_percent WHERE "
|
"replaced with the aggregate, {1} with the resource "
|
||||||
"host == '{1}' AND time > now()-{2}s")]
|
"attribute, {2} with the period, {3} with the "
|
||||||
|
"granularity and {4} with translator specifics for "
|
||||||
|
"InfluxDB this will be the retention period. "
|
||||||
|
"These queries will need to be constructed using tools "
|
||||||
|
"such as Postman. Example: SELECT cpu FROM {4}."
|
||||||
|
"cpu_percent WHERE host == '{1}' AND time > now()-{2}s")]
|
||||||
|
|
||||||
|
|
||||||
def register_opts(conf):
|
def register_opts(conf):
|
||||||
@@ -135,4 +143,4 @@ def register_opts(conf):
|
|||||||
|
|
||||||
|
|
||||||
def list_opts():
|
def list_opts():
|
||||||
return [('grafana_client', GRAFANA_CLIENT_OPTS)]
|
return [(grafana_client, GRAFANA_CLIENT_OPTS)]
|
||||||
|
|||||||
Reference in New Issue
Block a user