Use stronger tests in alarm definitions
We need to take in account the case where pillar.cinder.controller is
defined but it is actually disabled (with "enabled" set to False).
Likewise for pillar.cinder.volume.
Change-Id: I7d9213c1a521d79e64e8e2bb60c53da9f191abdb
diff --git a/cinder/meta/heka.yml b/cinder/meta/heka.yml
index 51beb04..66fb675 100644
--- a/cinder/meta/heka.yml
+++ b/cinder/meta/heka.yml
@@ -1,3 +1,7 @@
+{%- from "cinder/map.jinja" import controller as _controller with context %}
+{%- from "cinder/map.jinja" import volume as _volume with context %}
+{%- set controller = _controller.get('enabled', False) %}
+{%- set volume = _volume.get('enabled', False) %}
log_collector:
decoder:
cinder:
@@ -20,6 +24,7 @@
splitter: "cinder_splitter"
metric_collector:
trigger:
+ {%- if controller or volume %}
cinder_logs_error:
description: 'Too many errors have been detected in Cinder logs'
severity: warning
@@ -34,7 +39,8 @@
window: 70
periods: 0
function: max
- {%- if pillar.cinder.controller is defined %}
+ {%- endif %}
+ {%- if controller %}
cinder_api_local_endpoint:
description: 'Cinder API is locally down'
severity: down
@@ -49,7 +55,7 @@
function: last
{%- endif %}
alarm:
- {%- if pillar.cinder.controller is defined %}
+ {%- if controller %}
cinder_logs:
alerting: enabled
triggers:
@@ -63,7 +69,7 @@
dimension:
service: cinder-api-endpoint
{%- endif %}
- {%- if pillar.cinder.compute is defined %}
+ {%- if volume %}
cinder_logs_volume:
alerting: enabled
triggers:
@@ -73,7 +79,7 @@
{%- endif %}
remote_collector:
trigger:
- {%- if pillar.cinder.controller is defined %}
+ {%- if controller %}
cinder_api_check_failed:
description: 'Endpoint check for cinder-api is failed'
severity: down
@@ -126,7 +132,7 @@
periods: 0
function: last
{%- endif %}
- {%- if pillar.cinder.volume is defined %}
+ {%- if volume %}
cinder_volume_one_down:
description: 'At least one Cinder volume is down'
severity: warning
@@ -168,7 +174,7 @@
function: last
{%- endif %}
alarm:
- {%- if pillar.cinder.controller is defined %}
+ {%- if controller %}
cinder_api_check:
alerting: enabled
triggers:
@@ -184,7 +190,7 @@
dimension:
service: cinder-scheduler
{%- endif %}
- {%- if pillar.cinder.volume is defined %}
+ {%- if volume %}
cinder_volume:
alerting: enabled
triggers: