Merge "Move suites definition from .travis.yml to .kitchen.yml"
diff --git a/cinder/map.jinja b/cinder/map.jinja
index a19420a..d0ea11a 100644
--- a/cinder/map.jinja
+++ b/cinder/map.jinja
@@ -81,3 +81,9 @@
'pkgs': ['python-cinderclient']
},
}, merge=pillar.cinder.get('client', {})) %}
+
+{% set monitoring = salt['grains.filter_by']({
+ 'default': {
+ 'error_log_rate': 0.2,
+ },
+}, grain='os_family', merge=salt['pillar.get']('cinder:monitoring')) %}
diff --git a/cinder/meta/collectd.yml b/cinder/meta/collectd.yml
index 5f0ee4b..ee9a2a9 100644
--- a/cinder/meta/collectd.yml
+++ b/cinder/meta/collectd.yml
@@ -1,12 +1,15 @@
{%- if pillar.cinder.controller is defined %}
{%- from "cinder/map.jinja" import controller with context %}
-{%- if pillar.cinder.controller.get('enabled', False) %}
+{%- if controller.get('enabled', False) %}
+{%- if controller.get('osapi') %}
local_plugin:
collectd_check_local_endpoint:
endpoint:
cinder-api:
expected_code: {% if controller.version in ('juno', 'kilo', 'liberty') %}200{% else %}300{% endif %}
url: "http://{{ controller.osapi.host|replace('0.0.0.0', '127.0.0.1') }}:8776/"
+{%- endif %}
+{%- if controller.get('identity') %}
remote_plugin:
openstack_cinder:
plugin: python
@@ -26,3 +29,4 @@
region: {{ controller.identity.region }}
{%- endif %}
{%- endif %}
+{%- endif %}
diff --git a/cinder/meta/prometheus.yml b/cinder/meta/prometheus.yml
index 6269b8a..d655a6f 100644
--- a/cinder/meta/prometheus.yml
+++ b/cinder/meta/prometheus.yml
@@ -1,5 +1,4 @@
-{%- from "cinder/map.jinja" import controller as controller with context %}
-{%- from "cinder/map.jinja" import volume as volume with context %}
+{%- from "cinder/map.jinja" import controller, volume, monitoring with context %}
{%- set is_controller = controller.get('enabled', False) %}
{%- set is_volume = volume.get('enabled', False) %}
@@ -22,7 +21,7 @@
{%- endraw %}
{%- endif %}
CinderErrorLogsTooHigh:
- {%- set log_threshold = prometheus_server.get('alert', {}).get('CinderErrorLogsTooHigh', {}).get('var', {}).get('threshold', 0.2 ) %}
+ {%- set log_threshold = monitoring.error_log_rate|float %}
if: >-
sum(rate(log_messages{service="cinder",level=~"error|emergency|fatal"}[5m])) without (level) > {{ log_threshold }}
{%- raw %}
diff --git a/cinder/meta/telegraf.yml b/cinder/meta/telegraf.yml
index c315be5..c626eaf 100644
--- a/cinder/meta/telegraf.yml
+++ b/cinder/meta/telegraf.yml
@@ -1,9 +1,9 @@
{%- from "cinder/map.jinja" import controller with context %}
-{%- if controller.get('enabled', False) %}
+{%- if controller.get('enabled', False) and controller.get('osapi') %}
agent:
input:
http_response:
cinder-api:
address: "http://{{ controller.osapi.host|replace('0.0.0.0', '127.0.0.1') }}:8776/"
expected_code: {% if controller.version in ('juno', 'kilo', 'liberty') %}200{% else %}300{% endif %}
-{%- endif %}
\ No newline at end of file
+{%- endif %}