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
|
2017-01-17 10:09:06 -05:00
|
|
|
- if_missing: {{ prometheus.alertmanager.version_path }}
|
2016-10-04 11:03:07 -04:00
|
|
|
|
|
|
|
alertmanager_bin_link:
|
2016-10-11 12:18:58 -04:00
|
|
|
file.symlink:
|
|
|
|
- name: /usr/bin/alertmanager
|
2017-01-17 10:09:06 -05:00
|
|
|
- target: {{ prometheus.alertmanager.version_path }}/alertmanager
|
2016-10-04 11:03:07 -04:00
|
|
|
- require:
|
|
|
|
- archive: alertmanager_tarball
|
|
|
|
|
2016-11-15 08:34:04 -05:00
|
|
|
alertmanager_config:
|
|
|
|
file.serialize:
|
|
|
|
- name: {{ prometheus.alertmanager.args.config_file }}
|
2017-01-17 10:09:06 -05:00
|
|
|
- user: {{ prometheus.user }}
|
|
|
|
- group: {{ prometheus.group }}
|
2016-11-15 08:34:04 -05:00
|
|
|
- dataset_pillar: prometheus:alertmanager:config
|
|
|
|
|
2016-10-04 11:03:07 -04:00
|
|
|
alertmanager_config:
|
|
|
|
file.managed:
|
|
|
|
- name: {{ prometheus.alertmanager.args.config_file }}
|
2019-05-08 16:09:25 -04:00
|
|
|
- source: salt://prometheus-ng/files/config.jinja
|
2016-10-04 11:03:07 -04:00
|
|
|
- template: jinja
|
2017-01-17 10:09:06 -05:00
|
|
|
- user: {{ prometheus.user }}
|
|
|
|
- group: {{ prometheus.group }}
|
2016-10-04 11:03:07 -04:00
|
|
|
- makedirs: True
|
|
|
|
- defaults:
|
|
|
|
data: {{ prometheus.alertmanager.config }}
|
|
|
|
|
|
|
|
alertmanager_defaults:
|
|
|
|
file.managed:
|
|
|
|
- name: /etc/default/alertmanager
|
2019-05-08 16:09:25 -04:00
|
|
|
- source: salt://prometheus-ng/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 }}
|
2017-01-17 10:09:06 -05:00
|
|
|
- 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
|
2019-05-08 16:09:25 -04:00
|
|
|
- source: salt://prometheus-ng/files/alertmanager.systemd.jinja
|
2016-10-04 11:03:07 -04:00
|
|
|
{%- elif grains.get('init') == 'upstart' %}
|
|
|
|
- name: /etc/init/alertmanager.conf
|
2019-05-08 16:09:25 -04:00
|
|
|
- source: salt://prometheus-ng/files/alertmanager.upstart.jinja
|
2016-10-04 11:03:07 -04:00
|
|
|
{%- endif %}
|
|
|
|
- watch:
|
|
|
|
- file: alertmanager_defaults
|
|
|
|
- require_in:
|
|
|
|
- file: alertmanager_service
|
|
|
|
|
|
|
|
alertmanager_service:
|
|
|
|
service.running:
|
|
|
|
- name: alertmanager
|
|
|
|
- enable: True
|
|
|
|
- reload: True
|
|
|
|
- watch:
|
2017-01-17 10:09:06 -05:00
|
|
|
- file: alertmanager_service_unit
|
2016-10-04 11:03:07 -04:00
|
|
|
- file: alertmanager_config
|
2016-12-12 08:04:06 -05:00
|
|
|
- file: alertmanager_bin_link
|