blob: 4447cc94f2bb9273e0f6c3ccd27938f3bd7dc983 [file] [log] [blame]
{%- from "haproxy/map.jinja" import proxy with context %}
{%- if proxy.enabled and proxy.listen is defined and proxy.listen|length > 0 %}
metric_collector:
trigger:
haproxy_check:
description: 'HAProxy cannot be checked'
severity: down
rules:
- metric: haproxy_check
relational_operator: '=='
threshold: 0
window: 60
periods: 0
function: last
{%- for listen_name, listen in proxy.listen.iteritems() if listen.get('check', True) %}
haproxy_{{ listen_name }}_backends_all_down:
description: 'All API backends are down for {{ listen_name }}'
severity: down
rules:
- metric: haproxy_backend_servers
field:
backend: {{ listen_name }}
state: up
relational_operator: '=='
threshold: 0
window: 60
periods: 0
function: last
haproxy_{{ listen_name }}_backends_majority_down:
description: 'Less than 50% of backends are up for {{ listen_name }}'
severity: critical
rules:
- metric: haproxy_backend_servers_percent
field:
backend: {{ listen_name }}
state: up
relational_operator: '<='
threshold: 50
window: 60
periods: 0
function: last
haproxy_{{ listen_name }}_backends_one_down:
description: 'At least one API backend is down for {{ listen_name }}'
severity: warning
rules:
- metric: haproxy_backend_servers
field:
backend: {{ listen_name }}
state: down
relational_operator: '>'
threshold: 0
window: 60
periods: 0
function: last
{%- if listen.get('type', None) == 'openstack-service' %}
haproxy_{{ listen_name }}_http_errors:
description: 'Too many 5xx HTTP errors have been detected on {{ listen_name }}'
severity: warning
rules:
- metric: haproxy_backend_response_5xx
field:
backend: {{ listen_name }}
relational_operator: '>'
threshold: 0
window: 60
periods: 1
function: diff
{%- endif %}
{%- endfor %}
alarm:
haproxy_check:
alerting: enabled
triggers:
- haproxy_check
dimension:
service: haproxy
{%- for listen_name, listen in proxy.listen.iteritems() if listen.get('check', True) %}
haproxy_{{ listen_name }}_backends:
alerting: enabled
triggers:
- haproxy_{{ listen_name }}_backends_all_down
- haproxy_{{ listen_name }}_backends_majority_down
- haproxy_{{ listen_name }}_backends_one_down
dimension:
backend: {{ listen_name }}
{%- if listen.get('type', None) == 'openstack-service' %}
{{ listen_name }}_http_errors:
triggers:
- haproxy_{{ listen_name }}_http_errors
dimension:
backend: {{ listen_name }}
{%- endif %}
{%- endfor %}
aggregator:
alarm_cluster:
haproxy_check:
policy: majority_of_members
alerting: enabled_with_notification
match:
service: haproxy
group_by: hostname
members:
- haproxy_check
dimension:
cluster_name: haproxy-openstack
nagios_host: 00-top-clusters
{%- for listen_name, listen in proxy.listen.iteritems() if listen.get('check', True) %}
haproxy_{{ listen_name }}:
policy: highest_severity
alerting: enabled
match:
backend: {{ listen_name }}
members:
- haproxy_{{ listen_name }}_backends
{%- if listen.get('type', None) == 'openstack-service' %}
- haproxy_{{ listen_name }}_http_errors
{%- endif %}
dimension:
service: {{ listen.service_name|default(listen_name) }}
nagios_host: 01-service-clusters
{%- endfor %}
{%- endif %}