Updated alertmanager state to new design

This commit is contained in:
Eric Renfro 2019-05-10 04:12:48 -04:00
parent 58503256a9
commit a4b1255e0a
Signed by: psi-jack
GPG key ID: 14977F3A50D9A5BF
3 changed files with 21 additions and 4 deletions

View file

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

View file

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

View file

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