Updated alertmanager state to new design

master
Eric Renfro 4 years ago
parent 58503256a9
commit a4b1255e0a
Signed by: psi-jack
GPG Key ID: 14977F3A50D9A5BF
  1. 18
      prometheus/alertmanager.sls
  2. 1
      prometheus/defaults.yaml
  3. 6
      prometheus/server.sls

@ -11,12 +11,14 @@ alertmanager_tarball:
- archive_format: tar
- if_missing: {{ prometheus.alertmanager.version_path }}
{#
alertmanager_bin_link:
file.symlink:
- name: /usr/bin/alertmanager
- target: {{ prometheus.alertmanager.version_path }}/alertmanager
- require:
- archive: alertmanager_tarball
#}
alertmanager_config:
file.serialize:
@ -25,6 +27,7 @@ alertmanager_config:
- group: {{ prometheus.group }}
- dataset_pillar: prometheus:alertmanager:config
{#
alertmanager_config:
file.managed:
- name: {{ prometheus.alertmanager.args.config_file }}
@ -35,6 +38,7 @@ alertmanager_config:
- makedirs: True
- defaults:
data: {{ prometheus.alertmanager.config }}
#}
alertmanager_defaults:
file.managed:
@ -58,11 +62,21 @@ 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/alertmanager.systemd.jinja #}
- source: salt://prometheus/files/exporter.systemd.jinja
{%- elif grains.get('init') == 'upstart' %}
- name: /etc/init/alertmanager.conf
- source: salt://prometheus/files/alertmanager.upstart.jinja
{%- 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
- watch:
- file: alertmanager_defaults
- require_in:
@ -76,4 +90,4 @@ alertmanager_service:
- watch:
- file: alertmanager_service_unit
- file: alertmanager_config
- file: alertmanager_bin_link
{# - file: alertmanager_bin_link #}

@ -20,6 +20,7 @@ prometheus:
config_file: /etc/alertmanager/alertmanager.yml
storage:
path: /var/lib/alertmanager
url: https://prometheus.io/docs/alerting/alertmanager/
exporter:
node:
version: 0.17.0.linux-amd64

@ -11,12 +11,14 @@ prometheus_server_tarball:
- archive_format: tar
- if_missing: {{ prometheus.server.version_path }}
{#
prometheus_bin_link:
file.symlink:
- name: /usr/bin/prometheus
- target: {{ prometheus.server.version_path }}/prometheus
- require:
- archive: prometheus_server_tarball
#}
prometheus_server_config:
file.serialize:
@ -58,7 +60,7 @@ prometheus_service_unit:
- source: salt://prometheus/files/prometheus.upstart.jinja
{%- endif %}
- template: jinja
- context:
- defaults:
svc: prometheus
user: {{ prometheus.user }}
group: {{ prometheus.group }}
@ -79,4 +81,4 @@ prometheus_service:
- watch:
- file: prometheus_service_unit
- file: prometheus_server_config
- file: prometheus_bin_link
{# - file: prometheus_bin_link #}

Loading…
Cancel
Save