feat(archives): support for various prometheus archives
This commit is contained in:
parent
36b3e62678
commit
3ec910e7f7
39
prometheus/archive/alternatives/clean.sls
Normal file
39
prometheus/archive/alternatives/clean.sls
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# vim: ft=sls
|
||||||
|
|
||||||
|
{#- Get the `tplroot` from `tpldir` #}
|
||||||
|
{%- set tplroot = tpldir.split('/')[0] %}
|
||||||
|
{%- from tplroot ~ "/map.jinja" import prometheus as p with context %}
|
||||||
|
{%- set sls_archive_clean = tplroot ~ '.archive.clean' %}
|
||||||
|
|
||||||
|
{%- if grains.kernel|lower == 'linux' and p.linux.altpriority|int > 0 %}
|
||||||
|
|
||||||
|
include:
|
||||||
|
- {{ sls_archive_clean }}
|
||||||
|
|
||||||
|
|
||||||
|
{%- for k in p.archive.wanted %}
|
||||||
|
{%- set dir = p.archive.dir + '/' + k + '-%s.%s-%s'|format(p.archive.version["k"], p.kernel, p.arch) %}
|
||||||
|
|
||||||
|
prometheus-archive-remove-{{ k }}-home-alternatives-remove:
|
||||||
|
alternatives.remove:
|
||||||
|
- name: prometheus-{{ k }}-home
|
||||||
|
- path: {{ dir }}
|
||||||
|
- onlyif: update-alternatives --get-selections |grep ^prometheus-{{ k }}-home
|
||||||
|
- require:
|
||||||
|
- sls: {{ sls_archive_clean }}
|
||||||
|
|
||||||
|
|
||||||
|
{% for i in p.archive.binaries['k'] %}
|
||||||
|
|
||||||
|
prometheus-archive-remove-{{ k }}-alternatives-remove-{{ i }}:
|
||||||
|
alternatives.remove:
|
||||||
|
- name: prometheus-{{ k }}-{{ i }}
|
||||||
|
- path: {{ dir }}/{{ i }}
|
||||||
|
- onlyif: update-alternatives --get-selections |grep ^prometheus-{{ k }}-{{ i }}
|
||||||
|
- require:
|
||||||
|
- sls: {{ sls_archive_clean }}
|
||||||
|
|
||||||
|
{% endfor %}
|
||||||
|
{% endfor %}
|
||||||
|
{%- endif %}
|
14
prometheus/archive/alternatives/init.sls
Normal file
14
prometheus/archive/alternatives/init.sls
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
# -*- 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 ~ "/jinja/macros.jinja" import format_kwargs with context %}
|
||||||
|
|
||||||
|
{%- if grains.kernel|lower == 'linux' and prometheus.pkg.use_upstream_archive %}
|
||||||
|
|
||||||
|
include:
|
||||||
|
- .install
|
||||||
|
|
||||||
|
{%- endif %}
|
75
prometheus/archive/alternatives/install.sls
Normal file
75
prometheus/archive/alternatives/install.sls
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# vim: ft=sls
|
||||||
|
|
||||||
|
{#- Get the `tplroot` from `tpldir` #}
|
||||||
|
{%- set tplroot = tpldir.split('/')[0] %}
|
||||||
|
{%- from tplroot ~ "/map.jinja" import prometheus as p with context %}
|
||||||
|
{%- from tplroot ~ "/libtofs.jinja" import files_switch with context %}
|
||||||
|
{%- set sls_archive_install = tplroot ~ '.archive.install' %}
|
||||||
|
|
||||||
|
{%- if grains.kernel|lower in ('linux',) and p.linux.altpriority|int > 0 %}
|
||||||
|
|
||||||
|
include:
|
||||||
|
- {{ sls_archive_install }}
|
||||||
|
|
||||||
|
|
||||||
|
{%- for k in p.archive.wanted %}
|
||||||
|
{%- set dir = p.archive.dir + '/' + k + '-%s.%s-%s'|format(p.archive.version["k"], p.kernel, p.arch) %}
|
||||||
|
|
||||||
|
prometheus-archive-alternatives-install-{{ k }}-home-alternatives-install:
|
||||||
|
cmd.run:
|
||||||
|
- onlyif: {{ grains.os_family in ('Suse',) }}
|
||||||
|
- name: update-alternatives --install {{ dir }} prometheus-{{ k }}-home {{ dir }} {{p.linux.altpriority}}
|
||||||
|
- watch:
|
||||||
|
- archive: prometheus-archive-install-{{ k }}-archive-extracted
|
||||||
|
- require:
|
||||||
|
- sls: {{ sls_archive_install }}
|
||||||
|
alternatives.install:
|
||||||
|
- name: prometheus-{{ k }}-home
|
||||||
|
- link: {{ p.dir }}
|
||||||
|
- path: {{ dir }}
|
||||||
|
- priority: {{ p.linux.altpriority }}
|
||||||
|
- order: 10
|
||||||
|
- watch:
|
||||||
|
- archive: prometheus-archive-install-{{ k }}-archive-extracted
|
||||||
|
- require:
|
||||||
|
- sls: {{ sls_archive_install }}
|
||||||
|
- onlyif: {{ grains.os_family not in ('Suse',) }}
|
||||||
|
|
||||||
|
prometheus-archive-alternatives-install-{{ k }}-home-alternatives-set:
|
||||||
|
alternatives.set:
|
||||||
|
- name: prometheus-{{ k }}-home
|
||||||
|
- path: {{ dir }}
|
||||||
|
- require:
|
||||||
|
- alternatives: prometheus-archive-alternatives-install-{{ k }}-home-alternatives-install
|
||||||
|
- onlyif: {{ grains.os_family not in ('Suse',) }}
|
||||||
|
|
||||||
|
{% for i in p.archive.binaries['k'] %}
|
||||||
|
|
||||||
|
prometheus-archive-alternatives-install-{{ k }}-alternatives-install-{{ i }}:
|
||||||
|
cmd.run:
|
||||||
|
- onlyif: {{ grains.os_family in ('Suse',) }}
|
||||||
|
- name: update-alternatives --install /usr/bin/{{i}} prometheus-{{ k }}-{{i}} {{ dir }}/{{i}} {{p.linux.altpriority}}
|
||||||
|
- require:
|
||||||
|
- cmd: prometheus-archive-alternatives-install-{{ k }}-home-alternatives-install
|
||||||
|
alternatives.install:
|
||||||
|
- name: prometheus-{{ k }}-{{ i }}
|
||||||
|
- link: /usr/bin/{{ i }}
|
||||||
|
- path: {{ dir }}/{{ i }}
|
||||||
|
- priority: {{ p.linux.altpriority }}
|
||||||
|
- order: 10
|
||||||
|
- require:
|
||||||
|
- alternatives: prometheus-archive-alternatives-install-{{ k }}-home-alternatives-install
|
||||||
|
- onlyif: {{ grains.os_family not in ('Suse',) }}
|
||||||
|
|
||||||
|
prometheus-archive-alternatives-install-{{ k }}-alternatives-set-{{ i }}:
|
||||||
|
alternatives.set:
|
||||||
|
- name: prometheus-{{ k }}-{{ i }}
|
||||||
|
- path: {{ dir }}/{{ i }}
|
||||||
|
- require:
|
||||||
|
- alternatives: prometheus-archive-alternatives-install-{{ k }}-alternatives-install-{{ i }}
|
||||||
|
- onlyif: {{ grains.os_family not in ('Suse',) }}
|
||||||
|
|
||||||
|
{% endfor %}
|
||||||
|
{% endfor %}
|
||||||
|
{%- endif %}
|
@ -4,8 +4,20 @@
|
|||||||
{#- Get the `tplroot` from `tpldir` #}
|
{#- Get the `tplroot` from `tpldir` #}
|
||||||
{%- set tplroot = tpldir.split('/')[0] %}
|
{%- set tplroot = tpldir.split('/')[0] %}
|
||||||
{%- from tplroot ~ "/map.jinja" import prometheus with context %}
|
{%- from tplroot ~ "/map.jinja" import prometheus with context %}
|
||||||
|
{%- set sls_alternatives_clean = tplroot ~ '.archive.alternatives.clean' %}
|
||||||
|
|
||||||
prometheus-cli-package-archive-clean-file-absent:
|
{%- if prometheus.pkg.use_upstream_archive %}
|
||||||
|
|
||||||
|
include:
|
||||||
|
- {{ sls_alternatives_clean }}
|
||||||
|
|
||||||
|
|
||||||
|
{%- for k in prometheus.archive.wanted %}
|
||||||
|
prometheus-archive-clean-{{ k }}-file-absent:
|
||||||
file.absent:
|
file.absent:
|
||||||
- names:
|
- name: {{ prometheus.archive.dir + '/' + k + '-%s.%s-%s'|format(prometheus.archive.versions[k], prometheus.kernel, prometheus.arch) }}
|
||||||
- {{ prometheus.base_dir }}
|
#- require:
|
||||||
|
#- sls: {{ sls_alternatives_clean }}
|
||||||
|
{%- endfor %}
|
||||||
|
|
||||||
|
{%- endif %}
|
||||||
|
67
prometheus/archive/defaults.yaml
Normal file
67
prometheus/archive/defaults.yaml
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# vim: ft=yaml
|
||||||
|
---
|
||||||
|
prometheus:
|
||||||
|
archive:
|
||||||
|
dir: /opt/prometheus
|
||||||
|
uri: https://github.com/prometheus
|
||||||
|
suffix: tar.gz
|
||||||
|
kwargs:
|
||||||
|
trim_output: True
|
||||||
|
enforce_toplevel: True
|
||||||
|
archive_format: tar
|
||||||
|
retry:
|
||||||
|
attempts: 3
|
||||||
|
until: True
|
||||||
|
interval: 60
|
||||||
|
splay: 10
|
||||||
|
binaries:
|
||||||
|
prometheus:
|
||||||
|
- prometheus
|
||||||
|
- promtool
|
||||||
|
alertmanager:
|
||||||
|
- amtool
|
||||||
|
- alertmanager
|
||||||
|
blackbox_exporter:
|
||||||
|
- blackbox_exporter
|
||||||
|
consul_exporter:
|
||||||
|
- consul_exporter
|
||||||
|
graphite_exporter:
|
||||||
|
- graphite_exporter
|
||||||
|
haproxy_exporter:
|
||||||
|
- haproxy_exporter
|
||||||
|
memcached_exporter:
|
||||||
|
- memcached_exporter
|
||||||
|
mysqld_exporter:
|
||||||
|
- mysqld_exporter
|
||||||
|
node_exporter:
|
||||||
|
- node_exporter
|
||||||
|
pushgateway:
|
||||||
|
- pushgateway
|
||||||
|
statsd_exporter:
|
||||||
|
- statsd_exporter
|
||||||
|
|
||||||
|
versions:
|
||||||
|
prometheus: '2.10.0'
|
||||||
|
alertmanager: '0.17.0'
|
||||||
|
blackbox_exporter: '0.14.0'
|
||||||
|
consul_exporter: '0.4.0'
|
||||||
|
graphite_exporter: '0.6.2'
|
||||||
|
haproxy_exporter: '0.10.0'
|
||||||
|
memcached_exporter: '0.5.0'
|
||||||
|
mysqld_exporter: '0.11.0'
|
||||||
|
node_exporter: '0.18.1'
|
||||||
|
pushgateway: '0.8.0'
|
||||||
|
statsd_exporter: '0.11.2'
|
||||||
|
hashes:
|
||||||
|
prometheus: f4233783826f18606b79e5cef0686e4a9c2030146a3c7ce134f0add09f5adcb7
|
||||||
|
alertmanager: 7c8d2cfeb021c80881ae9904d959131091b8785b6fda9800f84ddef148fe0a4f
|
||||||
|
blackbox_exporter: a2918a059023045cafb911272c88a9eb83cdac9a8a5e8e74844b5d6d27f19117
|
||||||
|
consul_exporter: ff77c03de67cf381f67480b5be6699901785a34145c518c3484ae3e5b8440d08
|
||||||
|
graphite_exporter: 9b962bd06406ece4a865ad6947a6e652e48a92a0d77e496a0351c04e9c2c5e9e
|
||||||
|
haproxy_exporter: 08150728e281f813a8fcfff4b336f16dbfe4268a1c7510212c8cff2579b10468
|
||||||
|
memcached_exporter: bb07f496ceb63dad9793ad4295205547a4bd20b90628476d64fa96c9a25a020f
|
||||||
|
mysqld_exporter: b53ad48ff14aa891eb6a959730ffc626db98160d140d9a66377394714c563acf
|
||||||
|
node_exporter: b2503fd932f85f4e5baf161268854bf5d22001869b84f00fd2d1f57b51b72424
|
||||||
|
pushgateway: 6949866ba9ad0cb88d3faffd4281f17df79281398b4dbd0ec3aab300071681ca
|
||||||
|
statsd_exporter: 4632ad0c5552e271e84c376da3ffe3af8c265ec5c3035334b70e35756aca1906
|
@ -1,5 +1,16 @@
|
|||||||
#.-*- coding: utf-8 -*-
|
#.-*- coding: utf-8 -*-
|
||||||
# vim: ft=sls
|
# vim: ft=sls
|
||||||
|
|
||||||
|
{#- Get the `tplroot` from `tpldir` #}
|
||||||
|
{%- set tplroot = tpldir.split('/')[0] %}
|
||||||
|
{%- from tplroot ~ "/map.jinja" import prometheus with context %}
|
||||||
|
|
||||||
|
{%- if prometheus.pkg.use_upstream_archive %}
|
||||||
|
|
||||||
include:
|
include:
|
||||||
- .install
|
- .install
|
||||||
|
{%- if grains.kernel|lower == 'linux' %}
|
||||||
|
- .alternatives
|
||||||
|
{%- endif %}
|
||||||
|
|
||||||
|
{%- endif %}
|
||||||
|
@ -3,33 +3,37 @@
|
|||||||
|
|
||||||
{#- Get the `tplroot` from `tpldir` #}
|
{#- Get the `tplroot` from `tpldir` #}
|
||||||
{%- set tplroot = tpldir.split('/')[0] %}
|
{%- set tplroot = tpldir.split('/')[0] %}
|
||||||
{%- from tplroot ~ "/map.jinja" import prometheus with context %}
|
{%- from tplroot ~ "/map.jinja" import prometheus as p with context %}
|
||||||
{%- from tplroot ~ "/jinja/macros.jinja" import format_kwargs with context %}
|
{%- from tplroot ~ "/jinja/macros.jinja" import format_kwargs with context %}
|
||||||
|
|
||||||
prometheus-package-archive-install-file-directory:
|
{%- for k in p.archive.wanted %}
|
||||||
|
|
||||||
|
prometheus-archive-install-{{ k }}-file-directory:
|
||||||
file.directory:
|
file.directory:
|
||||||
- name: {{ prometheus.pkg.archive.name }}
|
- name: {{ p.archive.dir }}
|
||||||
- user: root
|
- user: root
|
||||||
- group: root
|
- group: root
|
||||||
- mode: 755
|
- mode: 755
|
||||||
- makedirs: True
|
- makedirs: True
|
||||||
- require_in:
|
- require_in:
|
||||||
- archive: prometheus-package-archive-install-archive-extracted
|
- archive: prometheus-archive-install-{{ k }}-archive-extracted
|
||||||
- recurse:
|
- recurse:
|
||||||
- user
|
- user
|
||||||
- group
|
- group
|
||||||
- mode
|
- mode
|
||||||
|
|
||||||
prometheus-package-archive-install-archive-extracted:
|
prometheus-archive-install-{{ k }}-archive-extracted:
|
||||||
archive.extracted:
|
archive.extracted:
|
||||||
{{- format_kwargs(prometheus.pkg.archive) }}
|
- name: {{ p.archive.dir }}
|
||||||
- retry:
|
- source: {{ p.archive.uri + '/' + k + '/releases/download/v' + p.archive.versions[k]
|
||||||
attempts: 3
|
+ '/' + k + '-%s.%s-%s'|format(p.archive.versions[k], p.kernel, p.arch)
|
||||||
until: True
|
+ '.' + p.archive.suffix }}
|
||||||
interval: 60
|
- source_hash: {{ p.archive.hashes[k] }}
|
||||||
splay: 10
|
|
||||||
- user: root
|
- user: root
|
||||||
- group: root
|
- group: root
|
||||||
|
{{- format_kwargs(p.archive.kwargs) }}
|
||||||
- recurse:
|
- recurse:
|
||||||
- user
|
- user
|
||||||
- group
|
- group
|
||||||
|
|
||||||
|
{%- endfor %}
|
||||||
|
@ -1,34 +0,0 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
# vim: ft=sls
|
|
||||||
|
|
||||||
{#- Get the `tplroot` from `tpldir` #}
|
|
||||||
{%- set tplroot = tpldir.split('/')[0] %}
|
|
||||||
{%- from tplroot ~ "/map.jinja" import prometheus with context %}
|
|
||||||
{%- set sls_archive_clean = tplroot ~ '.archive.clean' %}
|
|
||||||
{%- set sls_package_clean = tplroot ~ '.package.clean' %}
|
|
||||||
|
|
||||||
{%- if grains.kernel|lower == 'linux' and prometheus.linux.altpriority|int > 0 %}
|
|
||||||
|
|
||||||
include:
|
|
||||||
- {{ sls_archive_clean if prometheus.pkg.use_upstream_archive else sls_package_clean }}
|
|
||||||
|
|
||||||
prometheus-package-archive-remove-home-alternative-remove:
|
|
||||||
alternatives.remove:
|
|
||||||
- name: prometheus-home
|
|
||||||
- path: {{ prometheus.base_dir }}
|
|
||||||
- onlyif: update-alternatives --get-selections |grep ^prometheus-home
|
|
||||||
- require:
|
|
||||||
- sls: {{ sls_archive_clean if prometheus.pkg.use_upstream_archive else sls_package_clean }}
|
|
||||||
|
|
||||||
{% for i in ['prometheus', 'promtool'] %}
|
|
||||||
|
|
||||||
prometheus-package-archive-remove-{{ i }}-alternative-remove:
|
|
||||||
alternatives.remove:
|
|
||||||
- name: link-{{ i }}
|
|
||||||
- path: {{ prometheus.base_dir }}/{{ i }}
|
|
||||||
- onlyif: update-alternatives --get-selections |grep ^link-{{ i }}
|
|
||||||
- require:
|
|
||||||
- sls: {{ sls_archive_clean if prometheus.pkg.use_upstream_archive else sls_package_clean }}
|
|
||||||
|
|
||||||
{% endfor %}
|
|
||||||
{%- endif %}
|
|
@ -1,5 +0,0 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
# vim: ft=sls
|
|
||||||
|
|
||||||
include:
|
|
||||||
- .install
|
|
@ -1,70 +0,0 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
# vim: ft=sls
|
|
||||||
|
|
||||||
{#- Get the `tplroot` from `tpldir` #}
|
|
||||||
{%- set tplroot = tpldir.split('/')[0] %}
|
|
||||||
{%- from tplroot ~ "/map.jinja" import prometheus with context %}
|
|
||||||
{%- set sls_archive_install = tplroot ~ '.archive.install' %}
|
|
||||||
{%- from tplroot ~ "/libtofs.jinja" import files_switch with context %}
|
|
||||||
|
|
||||||
{%- if grains.kernel|lower == 'linux' and prometheus.linux.altpriority|int > 0 %}
|
|
||||||
|
|
||||||
include:
|
|
||||||
- {{ sls_archive_install }}
|
|
||||||
|
|
||||||
prometheus-package-archive-install-home-alternative-install:
|
|
||||||
cmd.run:
|
|
||||||
- name: update-alternatives --install {{ prometheus.dir }} prometheus-home {{ prometheus.base_dir }} {{prometheus.linux.altpriority}}
|
|
||||||
- watch:
|
|
||||||
- archive: prometheus-package-archive-install-archive-extracted
|
|
||||||
- require:
|
|
||||||
- sls: {{ sls_archive_install }}
|
|
||||||
- onlyif: {{ grains.os_family in ('Suse',) }}
|
|
||||||
alternatives.install:
|
|
||||||
- name: prometheus-home
|
|
||||||
- link: {{ prometheus.dir }}
|
|
||||||
- path: {{ prometheus.base_dir }}
|
|
||||||
- priority: {{ prometheus.linux.altpriority }}
|
|
||||||
- order: 10
|
|
||||||
- watch:
|
|
||||||
- archive: prometheus-package-archive-install-archive-extracted
|
|
||||||
- unless: {{ grains.os_family in ('Suse',) }}
|
|
||||||
- require:
|
|
||||||
- sls: {{ sls_archive_install }}
|
|
||||||
|
|
||||||
prometheus-package-archive-install-home-alternative-set:
|
|
||||||
alternatives.set:
|
|
||||||
- name: prometheus-home
|
|
||||||
- path: {{ prometheus.base_dir }}
|
|
||||||
- require:
|
|
||||||
- alternatives: prometheus-package-archive-install-home-alternative-install
|
|
||||||
- unless: {{ grains.os_family in ('Suse',) }}
|
|
||||||
|
|
||||||
{% for i in ['prometheus', 'promtool'] %}
|
|
||||||
|
|
||||||
prometheus-package-archive-install-{{ i }}-alternative-install:
|
|
||||||
cmd.run:
|
|
||||||
- name: update-alternatives --install /usr/bin/{{i}} link-{{i}} {{ prometheus.base_dir }}/{{i}} {{prometheus.linux.altpriority}}
|
|
||||||
- require:
|
|
||||||
- cmd: prometheus-package-archive-install-home-alternative-install
|
|
||||||
- onlyif: {{ grains.os_family in ('Suse',) }}
|
|
||||||
alternatives.install:
|
|
||||||
- name: link-{{ i }}
|
|
||||||
- link: /usr/bin/{{ i }}
|
|
||||||
- path: {{ prometheus.base_dir }}/{{ i }}
|
|
||||||
- priority: {{ prometheus.linux.altpriority }}
|
|
||||||
- order: 10
|
|
||||||
- require:
|
|
||||||
- alternatives: prometheus-package-archive-install-home-alternative-install
|
|
||||||
- unless: {{ grains.os_family in ('Suse',) }}
|
|
||||||
|
|
||||||
prometheus-package-archive-install-{{ i }}-alternative-set:
|
|
||||||
alternatives.set:
|
|
||||||
- name: link-{{ i }}
|
|
||||||
- path: {{ prometheus.base_dir }}/{{ i }}
|
|
||||||
- require:
|
|
||||||
- alternatives: prometheus-package-archive-install-{{ i }}-alternative-install
|
|
||||||
- unless: {{ grains.os_family in ('Suse',) }}
|
|
||||||
|
|
||||||
{% endfor %}
|
|
||||||
{%- endif %}
|
|
@ -5,13 +5,12 @@
|
|||||||
{%- set tplroot = tpldir.split('/')[0] %}
|
{%- set tplroot = tpldir.split('/')[0] %}
|
||||||
{%- from tplroot ~ "/map.jinja" import prometheus with context %}
|
{%- from tplroot ~ "/map.jinja" import prometheus with context %}
|
||||||
{%- set sls_archive_clean = tplroot ~ '.archive.clean' %}
|
{%- set sls_archive_clean = tplroot ~ '.archive.clean' %}
|
||||||
{%- set sls_alternatives_clean = tplroot ~ '.config.alternatives.clean' %}
|
|
||||||
|
|
||||||
{%- if grains.kernel|lower == 'linux' and prometheus.linux.altpriority|int > 0 %}
|
|
||||||
|
|
||||||
include:
|
include:
|
||||||
- {{ sls_archive_clean }}
|
- {{ sls_archive_clean }}
|
||||||
- {{ sls_alternatives_clean }}
|
{%- if prometheus.pkg.use_upstream_archive and kernel|lower == 'linux' %}
|
||||||
|
- .systemd
|
||||||
|
{%- endif %}
|
||||||
|
|
||||||
prometheus-config-clean-file-absent:
|
prometheus-config-clean-file-absent:
|
||||||
file.absent:
|
file.absent:
|
||||||
@ -20,6 +19,3 @@ prometheus-config-clean-file-absent:
|
|||||||
- {{ prometheus.environ_file }}
|
- {{ prometheus.environ_file }}
|
||||||
- require:
|
- require:
|
||||||
- sls: {{ sls_archive_clean }}
|
- sls: {{ sls_archive_clean }}
|
||||||
- sls: {{ sls_alternatives_clean }}
|
|
||||||
|
|
||||||
{%- endif %}
|
|
||||||
|
@ -27,4 +27,3 @@ prometheus-config-file-file-managed-environ_file:
|
|||||||
prometheus: {{ prometheus|json }}
|
prometheus: {{ prometheus|json }}
|
||||||
- require:
|
- require:
|
||||||
- sls: {{ sls_archive_install if prometheus.pkg.use_upstream_archive else sls_package_install }}
|
- sls: {{ sls_archive_install if prometheus.pkg.use_upstream_archive else sls_package_install }}
|
||||||
|
|
||||||
|
@ -1,8 +1,16 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vim: ft=sls
|
# vim: ft=sls
|
||||||
|
{#- Get the `tplroot` from `tpldir` #}
|
||||||
|
{%- set tplroot = tpldir.split('/')[0] %}
|
||||||
|
{%- from tplroot ~ "/map.jinja" import prometheus with context %}
|
||||||
|
|
||||||
|
|
||||||
include:
|
include:
|
||||||
- .args
|
- .args
|
||||||
- .file
|
- .file
|
||||||
- .environ
|
- .environ
|
||||||
- .alternatives
|
{%- if prometheus.pkg.use_upstream_archive and kernel|lower == 'linux' %}
|
||||||
|
- .systemd
|
||||||
|
{%- endif %}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2,22 +2,10 @@
|
|||||||
# vim: ft=yaml
|
# vim: ft=yaml
|
||||||
---
|
---
|
||||||
prometheus:
|
prometheus:
|
||||||
dir: /opt/prometheus
|
|
||||||
base_dir: /opt/prometheus-2.10.0
|
|
||||||
version: '2.10.0'
|
|
||||||
pkg:
|
pkg:
|
||||||
name: prometheus
|
name: prometheus
|
||||||
binary: prometheus
|
|
||||||
use_upstream_archive: False
|
use_upstream_archive: False
|
||||||
archive:
|
|
||||||
name: /opt
|
|
||||||
uri: https://github.com/prometheus/prometheus/releases/download/
|
|
||||||
source: None
|
|
||||||
source_hash: f4233783826f18606b79e5cef0686e4a9c2030146a3c7ce134f0add09f5adcb7 #linux amd64
|
|
||||||
trim_output: True
|
|
||||||
enforce_toplevel: True
|
|
||||||
archive_suffix: tar.gz
|
|
||||||
archive_format: tar
|
|
||||||
rootgroup: root
|
rootgroup: root
|
||||||
kernel: {{ grains.kernel | lower }}
|
kernel: {{ grains.kernel | lower }}
|
||||||
config_file: /etc/prometheus/prometheus.yml
|
config_file: /etc/prometheus/prometheus.yml
|
||||||
@ -37,3 +25,10 @@ prometheus:
|
|||||||
linux:
|
linux:
|
||||||
#'Alternatives system' priority: zero disables (default)
|
#'Alternatives system' priority: zero disables (default)
|
||||||
altpriority: 0
|
altpriority: 0
|
||||||
|
|
||||||
|
archive:
|
||||||
|
# see ./archive/default.yaml
|
||||||
|
wanted:
|
||||||
|
- prometheus
|
||||||
|
- alertmanager
|
||||||
|
- node_exporter
|
||||||
|
@ -9,36 +9,30 @@
|
|||||||
{%- import_yaml tplroot ~ "/osmap.yaml" as osmap %}
|
{%- import_yaml tplroot ~ "/osmap.yaml" as osmap %}
|
||||||
{%- import_yaml tplroot ~ "/osarchmap.yaml" as osarchmap %}
|
{%- import_yaml tplroot ~ "/osarchmap.yaml" as osarchmap %}
|
||||||
{%- import_yaml tplroot ~ "/osfingermap.yaml" as osfingermap %}
|
{%- import_yaml tplroot ~ "/osfingermap.yaml" as osfingermap %}
|
||||||
|
{#- focused defaults #}
|
||||||
|
{%- import_yaml tplroot ~ "/archive/defaults.yaml" as archive_defaults %}
|
||||||
|
{%- import_yaml tplroot ~ "/archive/defaults.yaml" as config_defaults %}
|
||||||
|
|
||||||
{%- set defaults = salt['grains.filter_by'](default_settings,
|
{%- set defaults = salt['grains.filter_by'](default_settings,
|
||||||
default='prometheus',
|
merge=salt['grains.filter_by'](archive_defaults,
|
||||||
|
merge=salt['grains.filter_by'](config_defaults,
|
||||||
merge=salt['grains.filter_by'](osfamilymap, grain='os_family',
|
merge=salt['grains.filter_by'](osfamilymap, grain='os_family',
|
||||||
merge=salt['grains.filter_by'](osmap, grain='os',
|
merge=salt['grains.filter_by'](osmap, grain='os',
|
||||||
merge=salt['grains.filter_by'](osfingermap, grain='osfinger',
|
merge=salt['grains.filter_by'](osfingermap, grain='osfinger',
|
||||||
merge=salt['grains.filter_by'](osarchmap, grain='osarch',
|
merge=salt['grains.filter_by'](osarchmap, grain='osarch',
|
||||||
merge=salt['pillar.get']('prometheus:lookup', default={})
|
merge=salt['pillar.get']('prometheus:lookup', default={}),
|
||||||
)
|
base='prometheus'),
|
||||||
)
|
base='prometheus'),
|
||||||
)
|
base='prometheus'),
|
||||||
)
|
base='prometheus'),
|
||||||
) %}
|
base='prometheus'),
|
||||||
|
base='prometheus'),
|
||||||
|
base='prometheus')
|
||||||
|
%}
|
||||||
|
|
||||||
{#- Merge the prometheus pillar #}
|
{#- Merge the prometheus pillar #}
|
||||||
{%- set prometheus = salt['pillar.get']('prometheus', default=defaults, merge=True) %}
|
{%- set prometheus = salt['pillar.get']('prometheus', default=defaults, merge=True) %}
|
||||||
|
|
||||||
{#- archive jinja #}
|
|
||||||
{%- if prometheus.pkg.use_upstream_archive %}
|
|
||||||
{%- set name = 'prometheus-%s.%s-%s'|format(prometheus.version, prometheus.kernel, prometheus.arch) %}
|
|
||||||
{%- set uri = prometheus.pkg.archive.uri + '/v' + prometheus.version + '/' + name %}
|
|
||||||
{%- do prometheus.pkg.archive.update({
|
|
||||||
'source': uri + '.' + prometheus.pkg.archive.archive_suffix,
|
|
||||||
'archive_format': prometheus.pkg.archive.archive_format
|
|
||||||
}) %}
|
|
||||||
{%- do prometheus.update({'base_dir': prometheus.pkg.archive.name + '/' + name}) %}
|
|
||||||
{%- do prometheus.environ.append('export PATH=${PATH}:' + prometheus.pkg.archive.name + '/' + name) %}
|
|
||||||
{%- endif %}
|
|
||||||
|
|
||||||
|
|
||||||
{#- Contactenate arguments #}
|
{#- Contactenate arguments #}
|
||||||
{%- macro concat_args(args) %}
|
{%- macro concat_args(args) %}
|
||||||
{%- set args = args|dictsort %}
|
{%- set args = args|dictsort %}
|
||||||
|
@ -20,7 +20,9 @@ Debian:
|
|||||||
node:
|
node:
|
||||||
config_file: /etc/default/prometheus-node-exporter
|
config_file: /etc/default/prometheus-node-exporter
|
||||||
|
|
||||||
RedHat: {}
|
RedHat:
|
||||||
|
pkg:
|
||||||
|
use_upstream_archive: True
|
||||||
|
|
||||||
Suse: {}
|
Suse: {}
|
||||||
|
|
||||||
@ -38,35 +40,69 @@ FreeBSD:
|
|||||||
pkg:
|
pkg:
|
||||||
name: node_exporter
|
name: node_exporter
|
||||||
service: node_exporter
|
service: node_exporter
|
||||||
pkg:
|
|
||||||
archive:
|
archive:
|
||||||
source_hash: 94a63f14baeadab2f17b5ae0bbeda6688e6d06f964ef4e32c2954a0ecf3996a1
|
hashes:
|
||||||
|
prometheus: 94a63f14baeadab2f17b5ae0bbeda6688e6d06f964ef4e32c2954a0ecf3996a1
|
||||||
|
alertmanager: ec171b13976baceace193461f8a1e61021ab9657df5ba45157cd0095aee7d569
|
||||||
|
blackbox_exporter: 2b92752decf2cf1883ce4f72301e4f911dab79efbd87db4df23dc9771e53e4af
|
||||||
|
consul_exporter: 62e16c2f1acb9bf9411126478caccb5962da203cfb58d8c97f54b9c0add5171c
|
||||||
|
graphite_exporter: ff424b923733d8247314353ba4d13a1c4b06450c35f005bfd6c3b6ff60b047fd
|
||||||
|
haproxy_exporter: f32d158f9e3314828dc155a30a1f4c858876e1ea8ff543a4000afcbc7e923505
|
||||||
|
memcached_exporter: 8fd53b9aede6b78e0530b159ccd0a437cf2f100da1ddc586681f389d804f5f19
|
||||||
|
mysqld_exporter: 9bcbbd8b3568818fd4c95d255c6f93c357ea25aed3364d7428f4ff9c89cd489a
|
||||||
|
node_exporter: {}
|
||||||
|
pushgateway: ebcd21dc25e439eed64559e89cd7da9a94073d5ff321a8a3a4214ac2ebe04e34
|
||||||
|
statsd_exporter: f345dff6311501f09bb5b6ba1128e925d504c6325ee97ad91a975f2be0d44da9
|
||||||
|
|
||||||
OpenBSD:
|
OpenBSD:
|
||||||
rootgroup: wheel
|
rootgroup: wheel
|
||||||
kernel: openbsd
|
kernel: openbsd
|
||||||
pkg:
|
|
||||||
archive:
|
archive:
|
||||||
source_hash: c3c69919b359f00a84ef12f7ed6a956111790d64a71bd94990572baaf63377ce
|
hashes:
|
||||||
|
prometheus: c3c69919b359f00a84ef12f7ed6a956111790d64a71bd94990572baaf63377ce
|
||||||
|
alertmanager: 88ce1b3f11bb28f24b98235994277b2c31aa03b2b2609e0058c04efa0cc5596f
|
||||||
NetBSD:
|
blackbox_exporter: 0dee97d1204bac925bde919958ae890730d87386a816ed0b248c8038ee43794d
|
||||||
rootgroup: wheel
|
consul_exporter: b53ee2bd0e670907eac894387e286b0dd11eb3149fcd4e19ed586006d3de741a
|
||||||
kernel: netbsd
|
graphite_exporter: 98cbd7176f1c61023892de64ad26edc3cd7895037e3cc282c4edec53dded7156
|
||||||
pkg:
|
haproxy_exporter: bc2b222f6a08232ef643cd6dcda3264f3bd7388a5bee25365cef137c7dea17e8
|
||||||
archive:
|
memcached_exporter: 21db1bffc561d47b4490ccb2cde721244d00e95f504cdcfee618bc4bb877e731
|
||||||
source_hash: fbfed9922eb8f1045952e0e8b93406028e123a5adb233a0ba7d4fc4e5c537b2c
|
mysqld_exporter: b37d6fe68e2c884540ea41c5efcfb16d0bc5da517fe3ba713144504df1ba635d
|
||||||
|
node_exporter: {}
|
||||||
|
pushgateway: 0bce168e4b19234df9e954393a2102c91e4d62336b2721ed882f2003a4445d51
|
||||||
|
statsd_exporter: c89acb365b75af03ce612873d8b20226e3882c0177752ea0ce17a9f5e41eb5b4
|
||||||
|
|
||||||
Solaris: {}
|
Solaris: {}
|
||||||
|
|
||||||
Windows:
|
Windows:
|
||||||
pkg:
|
kernel: windows
|
||||||
archive:
|
archive:
|
||||||
name: C:\\Program Files
|
name: C:\\Program Files
|
||||||
source_hash: eb138082a4d5e4d5b1e3ca838fa508f053474d46bca76e87ab0834f0d8b110db
|
hashes:
|
||||||
|
prometheus: eb138082a4d5e4d5b1e3ca838fa508f053474d46bca76e87ab0834f0d8b110db
|
||||||
|
alertmanager: 512dbed02a3cc7e3f06d737f56179e458c462762b3427063b89c62a54d9645c6
|
||||||
|
blackbox_exporter: 21ea148870631310002cbd48be54ca45e8d300da5a902b0aec052f1a64316d93
|
||||||
|
consul_exporter: 54579bc5dfa6a238e310a1874b0a362027661dfa1754535e74610dc8ef6163b1
|
||||||
|
graphite_exporter: f83fad71bad99ccac145d65f82bf9d17fa37168a5dcce6415c6350e79a84e638
|
||||||
|
haproxy_exporter: 044118feb98b74eb921e27bd4b511732b553896c672c19bdd3418445dc030794
|
||||||
|
memcached_exporter: 9e83c00c9d249c942f65b6a48112e6bd6e28a3d15b8a1d35e935621657b3d837
|
||||||
|
mysqld_exporter: 38605ae648f8def07a0f412d81a30a6c48c0d20a6981468d25b91c8aa529e599
|
||||||
|
node_exporter: {}
|
||||||
|
pushgateway: 506b555e7a13cabf3d85ec0dbe1bc6bc3a2444c0cc468baa8d31e7fc2fe18dd1
|
||||||
|
statsd_exporter: 9362b7482e74792f111c4bb1a372b18a88f6354c78f24713bacfbcb050883556
|
||||||
|
|
||||||
MacOS:
|
MacOS:
|
||||||
rootgroup: {{ macos_group | d('') }}
|
rootgroup: {{ macos_group | d('') }}
|
||||||
pkg:
|
kernel: darwin
|
||||||
archive:
|
archive:
|
||||||
source_hash: 740e36bcacc0c5d4495f5341fcfa8b7e0dc623d12e8b07ac291052ea0a681325
|
hashes:
|
||||||
|
prometheus: 740e36bcacc0c5d4495f5341fcfa8b7e0dc623d12e8b07ac291052ea0a681325
|
||||||
|
alertmanager: efeebaa8e51c521ecb3440345fb65962533cae022d71dff8b127911e893ded2a
|
||||||
|
blackbox_exporter: a371d0496adb5d62368d6606928c5effd318d1387f6b9a9998f8d0333492645a
|
||||||
|
consul_exporter: 75641783938967c11c18d6d340028ff2dce7ad0ae5e300fa631b813cc6ea9647
|
||||||
|
graphite_exporter: f9c0aa745502c0ab01fdcca29181801810202e0aed512a9aa9a37bb4be88a919
|
||||||
|
haproxy_exporter: 8fdb8bb182586c57e5892816a02846bae0998916765d22bb81b2c444a3565862
|
||||||
|
memcached_exporter: e10685cca5ffd8a3a7574b3dc096dc7418f34906abd399f881be06dd38be62cb
|
||||||
|
mysqld_exporter: 8e0a7d8847790d6dcdcf392e6dd227458a7bcaa1e0890cc6326fdf956421f2a7
|
||||||
|
node_exporter: 20fadb3108de0a9cc70a1333394e5be90416b4f91025f9fc66f5736335e94398
|
||||||
|
pushgateway: 25399a4c6600c1931f9d9bd5294700c2b53f964188b1c6003f9d12a2e176aac1
|
||||||
|
statsd_exporter: 15132494523c2b6a89e09b2da63452c8fe587fb82fcc3fd21cc75a4aa2766644
|
||||||
|
Loading…
Reference in New Issue
Block a user