blob: 2e5949948cf32691dc0129e9cac8cd4b9723dfa1 [file] [log] [blame]
{%- from "haproxy/map.jinja" import proxy with context -%}
{%- from "linux/map.jinja" import network with context -%}
{%- if grains.ipv4[0] == '127.0.0.1' %}{% set address = grains.ipv4[1] %}{% else %}{% set address = grains.ipv4[0] %}{% endif %}
check:
local_haproxy_server_proc:
command: "PATH=$PATH:/usr/lib64/nagios/plugins:/usr/lib/nagios/plugins check_procs -C haproxy -u haproxy -c 1:1"
interval: 60
occurrences: 1
subscribers:
- local-haproxy-server
{# remote_haproxy_proxy_metrics_{{ network.fqdn }}:
command: "PATH=$PATH:/etc/sensu/plugins haproxy-metrics.rb -c {{ address }} -P 9600 -u admin -p admin"
interval: 60
occurrences: 1
subscribers:
- remote_network
remote_haproxy_proxy_status_{{ network.fqdn }}:
command: "PATH=$PATH:/etc/sensu/plugins check-haproxy.rb -S {{ address }} -P 9600 -u admin -p admin -A"
interval: 60
occurrences: 1
subscribers:
- remote_network #}
{%- for listen_name, listen in proxy.get('listen', {}).iteritems() %}
{%- if listen.get('check', True) %}
{%- if listen.binds.0.address|length == 1 or listen.binds.0.address == '0.0.0.0' %}
{% if grains.ipv4[0] == '127.0.0.1' %}{% set address = grains.ipv4[1] %}{% else %}{% set address = grains.ipv4[0] %}{% endif %}
{%- else %}
{%- set address = listen.binds.0.address %}
{%- endif %}
{%- if listen.type|default(None) in ['general-service', 'openstack-service', 'http', 'contrail-api', 'admin'] or listen.mode|default('tcp') == 'http' %}
remote_haproxy_proxy_http_{{ listen_name }}_{{ network.fqdn }}:
command: "PATH=$PATH:/usr/lib64/nagios/plugins:/usr/lib/nagios/plugins check_http -H {{ address }} -p {{ listen.binds.0.port }} -w 5 -c 10 -e HTTP/1. -N"
interval: 60
occurrences: 1
subscribers:
- remote-network
{%- else %}
remote_haproxy_proxy_tcp_{{ listen_name }}_{{ network.fqdn }}:
command: "PATH=$PATH:/usr/lib64/nagios/plugins:/usr/lib/nagios/plugins check_tcp -H {{ address }} -p {{ listen.binds.0.port }} -w 5 -c 10"
interval: 60
occurrences: 1
subscribers:
- remote-network
{%- endif %}
{%- endif %}
{%- endfor %}