formula-prometheus-ng/prometheus/alertmanager.sls

94 lines
2.8 KiB
Text
Raw Normal View History

2016-10-04 11:03:07 -04:00
{% from "prometheus/map.jinja" import prometheus with context %}
include:
- prometheus.user
alertmanager_tarball:
archive.extracted:
- name: {{ prometheus.alertmanager.install_dir }}
- source: {{ prometheus.alertmanager.source }}
- source_hash: {{ prometheus.alertmanager.source_hash }}
- archive_format: tar
- if_missing: {{ prometheus.alertmanager.version_path }}
2016-10-04 11:03:07 -04:00
{#
2016-10-04 11:03:07 -04:00
alertmanager_bin_link:
file.symlink:
- name: /usr/bin/alertmanager
- target: {{ prometheus.alertmanager.version_path }}/alertmanager
2016-10-04 11:03:07 -04:00
- require:
- archive: alertmanager_tarball
#}
2016-10-04 11:03:07 -04:00
alertmanager_config:
file.serialize:
- name: {{ prometheus.alertmanager.args.config_file }}
- user: {{ prometheus.user }}
- group: {{ prometheus.group }}
- dataset_pillar: prometheus:alertmanager:config
{#
2016-10-04 11:03:07 -04:00
alertmanager_config:
file.managed:
- name: {{ prometheus.alertmanager.args.config_file }}
- source: salt://prometheus/files/config.jinja
2016-10-04 11:03:07 -04:00
- template: jinja
- user: {{ prometheus.user }}
- group: {{ prometheus.group }}
2016-10-04 11:03:07 -04:00
- makedirs: True
- defaults:
data: {{ prometheus.alertmanager.config }}
#}
2016-10-04 11:03:07 -04:00
alertmanager_defaults:
file.managed:
- name: /etc/default/alertmanager
- source: salt://prometheus/files/default-alertmanager.jinja
2016-10-04 11:03:07 -04:00
- template: jinja
- defaults:
config_file: {{ prometheus.alertmanager.args.config_file }}
storage_path: {{ prometheus.alertmanager.args.storage.path }}
alertmanager_storage_path:
file.directory:
- name: {{ prometheus.alertmanager.args.storage.path }}
- user: {{ prometheus.user }}
- group: {{ prometheus.group }}
2016-10-04 11:03:07 -04:00
- makedirs: True
- watch:
- file: alertmanager_defaults
alertmanager_service_unit:
file.managed:
{%- if grains.get('init') == 'systemd' %}
- name: /etc/systemd/system/alertmanager.service
{# - source: salt://prometheus/files/alertmanager.systemd.jinja #}
- source: salt://prometheus/files/exporter.systemd.jinja
2016-10-04 11:03:07 -04:00
{%- elif grains.get('init') == 'upstart' %}
- name: /etc/init/alertmanager.conf
- source: salt://prometheus/files/alertmanager.upstart.jinja
2016-10-04 11:03:07 -04:00
{%- endif %}
- template: jinja
- defaults:
svc: alertmanager
user: {{ prometheus.user }}
group: {{ prometheus.group }}
bin_path: {{ prometheus.alertmanager.version_path }}
args: {{ prometheus.alertmanager.args.get('service_args', []) }}
url: {{ prometheus.alertmanager.args.url }}
description: AlertManager Service
2016-10-04 11:03:07 -04:00
- watch:
- file: alertmanager_defaults
- require_in:
- file: alertmanager_service
alertmanager_service:
service.running:
- name: alertmanager
- enable: True
- reload: True
- watch:
- file: alertmanager_service_unit
2016-10-04 11:03:07 -04:00
- file: alertmanager_config
{# - file: alertmanager_bin_link #}