diff --git a/prometheus/alertmanager.sls b/prometheus/alertmanager.sls index 30e32fb..717febd 100644 --- a/prometheus/alertmanager.sls +++ b/prometheus/alertmanager.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 #} diff --git a/prometheus/defaults.yaml b/prometheus/defaults.yaml index de2bf54..09031e9 100644 --- a/prometheus/defaults.yaml +++ b/prometheus/defaults.yaml @@ -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 diff --git a/prometheus/server.sls b/prometheus/server.sls index ec59660..79d3c00 100644 --- a/prometheus/server.sls +++ b/prometheus/server.sls @@ -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 #}