-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/saltstack-formulas/promet…
…heus-formula into archives
- Loading branch information
Showing
10 changed files
with
169 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# -*- coding: utf-8 -*- | ||
# vim: ft=sls | ||
|
||
{#- Get the `tplroot` from `tpldir` #} | ||
{%- set tplroot = tpldir.split('/')[0] %} | ||
{%- from tplroot ~ "/map.jinja" import prometheus with context %} | ||
prometheus-exporters-node-service-dead: | ||
service.dead: | ||
- name: {{ prometheus.exporters.node.service }} | ||
- enable: False | ||
prometheus-exporters-node-pkg-removed: | ||
pkg.removed: | ||
- name: {{ prometheus.exporters.node.pkg.name }} | ||
- require: | ||
- service: prometheus-exporters-node-service-dead | ||
{# FreeBSD #} | ||
{%- if salt['grains.get']('os_family') == 'FreeBSD' %} | ||
{%- for parameter in ['args', 'listen_address', 'textfile_dir'] %} | ||
prometheus-exporters-node-args-{{ parameter }}: | ||
sysrc.absent: | ||
- name: node_exporter_{{ parameter }} | ||
- require: | ||
- service: prometheus-exporters-node-service-dead | ||
{%- endfor %} | ||
{%- endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# -*- coding: utf-8 -*- | ||
# vim: ft=sls | ||
|
||
{#- Get the `tplroot` from `tpldir` #} | ||
{%- set tplroot = tpldir.split('/')[0] %} | ||
{%- from tplroot ~ "/map.jinja" import prometheus with context %} | ||
{%- from tplroot ~ "/map.jinja" import concat_args %} | ||
prometheus-exporters-node-pkg-installed: | ||
pkg.installed: | ||
- name: {{ prometheus.exporters.node.pkg.name }} | ||
{%- if 'args' in prometheus.exporters.node %} | ||
{%- set args = prometheus.exporters.node.get('args', {}) -%} | ||
{# FreeBSD #} | ||
{%- if salt['grains.get']('os_family') == 'FreeBSD' %} | ||
{%- if 'web.listen-address' in args.keys() %} | ||
{%- set value = args.pop('web.listen-address') %} | ||
prometheus-exporters-node-args-web-listen-address: | ||
sysrc.managed: | ||
- name: node_exporter_listen_address | ||
- value: {{ value }} | ||
- watch_in: | ||
- service: prometheus-exporters-node-service-running | ||
{%- endif %} | ||
{%- if 'collector.textfile.directory' in args.keys() %} | ||
{%- set value = args.pop('collector.textfile.directory') %} | ||
prometheus-exporters-node-args-collector-textfile-directory: | ||
sysrc.managed: | ||
- name: node_exporter_textfile_dir | ||
- value: {{ value }} | ||
- watch_in: | ||
- service: prometheus-exporters-node-service-running | ||
{%- endif %} | ||
prometheus-exporters-node-args: | ||
sysrc.managed: | ||
- name: node_exporter_args | ||
# service node_exporter restart tended to hang on FreeBSD | ||
# https://github.com/saltstack/salt/issues/44848#issuecomment-487016414 | ||
- value: "{{ concat_args(args) }} >/dev/null 2>&1" | ||
- watch_in: | ||
- service: prometheus-exporters-node-service-running | ||
{# Debian #} | ||
{%- elif salt['grains.get']('os_family') == 'Debian'%} | ||
prometheus-exporters-node-args: | ||
file.managed: | ||
- name: {{ prometheus.exporters.node.config_file }} | ||
- contents: | | ||
ARGS="{{ concat_args(args) }}" | ||
- watch_in: | ||
- service: prometheus-exporters-node-service-running | ||
{%- endif %} | ||
{%- endif %} | ||
prometheus-exporters-node-service-running: | ||
service.running: | ||
- name: {{ prometheus.exporters.node.service }} | ||
- enable: True | ||
- watch: | ||
- pkg: prometheus-exporters-node-pkg-installed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# -*- coding: utf-8 -*- | ||
# vim: ft=sls | ||
|
||
{#- Get the `tplroot` from `tpldir` #} | ||
{%- set tplroot = tpldir.split('/')[0] %} | ||
{%- from tplroot ~ "/map.jinja" import prometheus with context %} | ||
{%- for name in prometheus.wanted %} | ||
{%- if name in prometheus.pkg and 'repo' in prometheus.pkg[name] and prometheus.pkg[name]['repo'] %} | ||
prometheus-package-repo-clean-{{ name }}-pkgrepo-absent: | ||
pkgrepo.absent: | ||
- name: {{ prometheus.pkg[name]['repo']['name'] }} | ||
{%- endif %} | ||
{%- endfor %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# -*- coding: utf-8 -*- | ||
# vim: ft=sls | ||
|
||
include: | ||
- .install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# -*- coding: utf-8 -*- | ||
# vim: ft=sls | ||
|
||
{#- Get the `tplroot` from `tpldir` #} | ||
{%- set tplroot = tpldir.split('/')[0] %} | ||
{%- from tplroot ~ "/map.jinja" import prometheus with context %} | ||
{%- for name in prometheus.wanted %} | ||
{%- if name in prometheus.pkg and 'repo' in prometheus.pkg[name] and prometheus.pkg[name]['repo'] %} | ||
{%- from tplroot ~ "/jinja/macros.jinja" import format_kwargs with context %} | ||
prometheus-package-repo-install-{{ name }}-pkgrepo-managed: | ||
pkgrepo.managed: | ||
{{- format_kwargs(prometheus.pkg[name]['repo']) }} | ||
prometheus-package-repo-install-{{ name }}-file-replace: | ||
# redhat workaround for salt issue #51494 | ||
file.replace: | ||
- name: /etc/yum.repos.d/{{ name }}.repo | ||
- pattern: ' gpgkey2=' | ||
- repl: '\n ' | ||
- ignore_if_missing: True | ||
- onlyif: {{ grains.os_family == 'RedHat' }} | ||
{%- endif %} | ||
{%- endfor %} |