Merge pull request #52 from lagooj/feat/unofficial_exporters
Manage unofficial exporters
This commit is contained in:
commit
6ab735e16c
@ -13,6 +13,8 @@ prometheus:
|
|||||||
- prometheus
|
- prometheus
|
||||||
- alertmanager
|
- alertmanager
|
||||||
- node_exporter
|
- node_exporter
|
||||||
|
- php-fpm_exporter
|
||||||
|
- postgres_exporter
|
||||||
# - memcached_exporter # not in upstream repo, only archive
|
# - memcached_exporter # not in upstream repo, only archive
|
||||||
|
|
||||||
exporters:
|
exporters:
|
||||||
@ -171,6 +173,30 @@ prometheus:
|
|||||||
web.listen-address: ":9091"
|
web.listen-address: ":9091"
|
||||||
web.telemetry-path: "/metrics"
|
web.telemetry-path: "/metrics"
|
||||||
|
|
||||||
|
php-fpm_exporter:
|
||||||
|
version: v0.6.1
|
||||||
|
archive:
|
||||||
|
official: false
|
||||||
|
tar: false
|
||||||
|
# yamllint disable-line rule:line-length
|
||||||
|
source: https://github.com/bakins/php-fpm-exporter/releases/download/v0.6.1/php-fpm-exporter.linux.amd64
|
||||||
|
source_hash: 40e52d84f7decb5fdad9fadacf63cb2de26ebddce56e11b20651555e8d6c6130
|
||||||
|
service:
|
||||||
|
args:
|
||||||
|
addr: ":9253"
|
||||||
|
fastcgi: "unix:///run/php/php-fpm.sock"
|
||||||
|
|
||||||
|
postgres_exporter:
|
||||||
|
version: v0.8.0
|
||||||
|
service:
|
||||||
|
env:
|
||||||
|
- 'DATA_SOURCE_NAME=foo:bar@/'
|
||||||
|
archive:
|
||||||
|
official: false
|
||||||
|
# yamllint disable-line rule:line-length
|
||||||
|
source: https://github.com/wrouesnel/postgres_exporter/releases/download/v0.8.0/postgres_exporter_v0.8.0_linux-amd64.tar.gz
|
||||||
|
skip_verify: true
|
||||||
|
|
||||||
linux:
|
linux:
|
||||||
# 'Alternatives system' priority: zero disables (default)
|
# 'Alternatives system' priority: zero disables (default)
|
||||||
# yamllint disable-line rule:braces
|
# yamllint disable-line rule:braces
|
||||||
|
@ -28,14 +28,10 @@ prometheus-archive-install-prerequisites:
|
|||||||
|
|
||||||
{%- for name in p.wanted.component %}
|
{%- for name in p.wanted.component %}
|
||||||
|
|
||||||
prometheus-archive-install-{{ name }}:
|
prometheus-archive-directory-{{ name }}:
|
||||||
file.directory:
|
file.directory:
|
||||||
- name: {{ p.pkg.component[name]['path'] }}
|
- name: {{ p.pkg.component[name]['path'] }}
|
||||||
- makedirs: True
|
- makedirs: True
|
||||||
- require:
|
|
||||||
- file: prometheus-archive-install-prerequisites
|
|
||||||
- require_in:
|
|
||||||
- archive: prometheus-archive-install-{{ name }}
|
|
||||||
{%- if grains.os != 'Windows' %}
|
{%- if grains.os != 'Windows' %}
|
||||||
- user: {{ p.identity.rootuser }}
|
- user: {{ p.identity.rootuser }}
|
||||||
- group: {{ p.identity.rootgroup }}
|
- group: {{ p.identity.rootgroup }}
|
||||||
@ -45,6 +41,8 @@ prometheus-archive-install-{{ name }}:
|
|||||||
- group
|
- group
|
||||||
- mode
|
- mode
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
prometheus-archive-install-{{ name }}:
|
||||||
|
{%- if p.pkg.component.get(name).get('archive').get('tar', true) %}
|
||||||
archive.extracted:
|
archive.extracted:
|
||||||
{{- format_kwargs(p.pkg.component[name]['archive']) }}
|
{{- format_kwargs(p.pkg.component[name]['archive']) }}
|
||||||
- trim_output: true
|
- trim_output: true
|
||||||
@ -53,12 +51,24 @@ prometheus-archive-install-{{ name }}:
|
|||||||
- force: {{ p.force }}
|
- force: {{ p.force }}
|
||||||
- retry: {{ p.retry_option|json }}
|
- retry: {{ p.retry_option|json }}
|
||||||
- require:
|
- require:
|
||||||
- file: prometheus-archive-install-{{ name }}
|
- file: prometheus-archive-directory-{{ name }}
|
||||||
{%- if grains.os != 'Windows' %}
|
{%- if grains.os != 'Windows' %}
|
||||||
- user: {{ p.identity.rootuser }}
|
- user: {{ p.identity.rootuser }}
|
||||||
- group: {{ p.identity.rootgroup }}
|
- group: {{ p.identity.rootgroup }}
|
||||||
|
{%- endif %}
|
||||||
|
{% else %}
|
||||||
|
file.managed:
|
||||||
|
- name: {{ p.pkg.component[name]['path'] }}/{{ name }}
|
||||||
|
- source: {{ p.pkg.component[name]['archive']['source'] }}
|
||||||
|
- source_hash: {{ p.pkg.component[name]['archive']['source_hash'] }}
|
||||||
|
- mode: '0755'
|
||||||
|
- require:
|
||||||
|
- file: prometheus-archive-directory-{{ name }}
|
||||||
|
{%- if grains.os != 'Windows' %}
|
||||||
|
- user: {{ p.identity.rootuser }}
|
||||||
|
- group: {{ p.identity.rootgroup }}
|
||||||
|
{%- endif %}
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
|
||||||
{%- if (grains.kernel|lower == 'linux' and p.linux.altpriority|int <= 0) or grains.os_family|lower in ('macos', 'arch') %}
|
{%- if (grains.kernel|lower == 'linux' and p.linux.altpriority|int <= 0) or grains.os_family|lower in ('macos', 'arch') %}
|
||||||
{%- if 'commands' in p.pkg.component[name] and p.pkg.component[name]['commands'] is iterable %}
|
{%- if 'commands' in p.pkg.component[name] and p.pkg.component[name]['commands'] is iterable %}
|
||||||
{%- for cmd in p.pkg.component[name]['commands'] %}
|
{%- for cmd in p.pkg.component[name]['commands'] %}
|
||||||
@ -73,7 +83,11 @@ prometheus-archive-install-{{ name }}-file-symlink-{{ cmd }}:
|
|||||||
- target: {{ p.pkg.component[name]['path'] }}/{{ cmd }}
|
- target: {{ p.pkg.component[name]['path'] }}/{{ cmd }}
|
||||||
- force: True
|
- force: True
|
||||||
- require:
|
- require:
|
||||||
|
{%- if p.pkg.component.get(name).get('archive').get('tar', true) %}
|
||||||
- archive: prometheus-archive-install-{{ name }}
|
- archive: prometheus-archive-install-{{ name }}
|
||||||
|
{% else %}
|
||||||
|
- file: prometheus-archive-install-{{ name }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{%- endfor %}
|
{%- endfor %}
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
@ -125,13 +139,21 @@ prometheus-archive-install-{{ name }}-managed-service:
|
|||||||
{%- endif %}
|
{%- endif %}
|
||||||
- require:
|
- require:
|
||||||
- file: prometheus-archive-install-{{ name }}-file-directory
|
- file: prometheus-archive-install-{{ name }}-file-directory
|
||||||
|
{%- if p.pkg.component.get(name).get('archive').get('tar', true) %}
|
||||||
- archive: prometheus-archive-install-{{ name }}
|
- archive: prometheus-archive-install-{{ name }}
|
||||||
|
{% else %}
|
||||||
|
- file: prometheus-archive-install-{{ name }}
|
||||||
|
{% endif %}
|
||||||
- user: prometheus-config-users-install-{{ name }}-user-present
|
- user: prometheus-config-users-install-{{ name }}-user-present
|
||||||
- group: prometheus-config-users-install-{{ name }}-group-present
|
- group: prometheus-config-users-install-{{ name }}-group-present
|
||||||
cmd.run:
|
cmd.run:
|
||||||
- name: systemctl daemon-reload
|
- name: systemctl daemon-reload
|
||||||
- require:
|
- require:
|
||||||
|
{%- if p.pkg.component.get(name).get('archive').get('tar', true) %}
|
||||||
- archive: prometheus-archive-install-{{ name }}
|
- archive: prometheus-archive-install-{{ name }}
|
||||||
|
{% else %}
|
||||||
|
- file: prometheus-archive-install-{{ name }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{%- endif %}{# linux #}
|
{%- endif %}{# linux #}
|
||||||
{%- endif %}{# service #}
|
{%- endif %}{# service #}
|
||||||
|
@ -34,7 +34,11 @@
|
|||||||
{%- set url = '%s-%s.%s-%s.tar.gz'|format(uri, v.version|replace('v',''), p.kernel, p.arch) %}
|
{%- set url = '%s-%s.%s-%s.tar.gz'|format(uri, v.version|replace('v',''), p.kernel, p.arch) %}
|
||||||
{%- set dir = '%s-%s'|format(name, v.version) %}
|
{%- set dir = '%s-%s'|format(name, v.version) %}
|
||||||
{%- do p.pkg.component[name].update({'path': p.dir.archive ~ '/' + dir }) %}
|
{%- do p.pkg.component[name].update({'path': p.dir.archive ~ '/' + dir }) %}
|
||||||
{%- do p.pkg.component[name]['archive'].update({'name': p.dir.archive + '/' + dir, 'source': url}) %}
|
{% if p.pkg.component[name]['archive'].get('official', true) %}
|
||||||
|
{%- do p.pkg.component[name]['archive'].update({'name': p.dir.archive + '/' + dir, 'source': url}) %}
|
||||||
|
{% else %}
|
||||||
|
{%- do p.pkg.component[name]['archive'].update({'name': p.dir.archive + '/' + dir }) %}
|
||||||
|
{% endif %}
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
{%- endfor %}
|
{%- endfor %}
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
@ -8,10 +8,14 @@ control 'prometheus components' do
|
|||||||
service_dir = '/lib/systemd/system'
|
service_dir = '/lib/systemd/system'
|
||||||
alert_manager_service = 'prometheus-alertmanager'
|
alert_manager_service = 'prometheus-alertmanager'
|
||||||
node_exporter_service = 'prometheus-node-exporter'
|
node_exporter_service = 'prometheus-node-exporter'
|
||||||
|
php_fpm_exporter_service = 'php-fpm_exporter'
|
||||||
|
postgres_exporter_service = 'prometheus-postgres-exporter'
|
||||||
else
|
else
|
||||||
service_dir = '/usr/lib/systemd/system'
|
service_dir = '/usr/lib/systemd/system'
|
||||||
alert_manager_service = 'alertmanager'
|
alert_manager_service = 'alertmanager'
|
||||||
node_exporter_service = 'node_exporter'
|
node_exporter_service = 'node_exporter'
|
||||||
|
php_fpm_exporter_service = 'php-fpm_exporter'
|
||||||
|
postgres_exporter_service = 'postgres_exporter'
|
||||||
end
|
end
|
||||||
|
|
||||||
# describe package('cron') do
|
# describe package('cron') do
|
||||||
@ -35,6 +39,12 @@ control 'prometheus components' do
|
|||||||
describe user('node_exporter') do
|
describe user('node_exporter') do
|
||||||
it { should exist }
|
it { should exist }
|
||||||
end
|
end
|
||||||
|
describe user('php-fpm_exporter') do
|
||||||
|
it { should exist }
|
||||||
|
end
|
||||||
|
describe user('postgres_exporter') do
|
||||||
|
it { should exist }
|
||||||
|
end
|
||||||
describe directory('/var/lib/prometheus') do
|
describe directory('/var/lib/prometheus') do
|
||||||
it { should exist }
|
it { should exist }
|
||||||
end
|
end
|
||||||
@ -89,6 +99,38 @@ control 'prometheus components' do
|
|||||||
its('group') { should eq 'root' }
|
its('group') { should eq 'root' }
|
||||||
its('mode') { should cmp '0644' }
|
its('mode') { should cmp '0644' }
|
||||||
end
|
end
|
||||||
|
describe directory('/opt/prometheus/php-fpm_exporter-v0.6.1') do
|
||||||
|
it { should exist }
|
||||||
|
its('group') { should eq 'root' }
|
||||||
|
end
|
||||||
|
describe file('/opt/prometheus/php-fpm_exporter-v0.6.1/php-fpm_exporter') do
|
||||||
|
it { should exist }
|
||||||
|
its('group') { should eq 'root' }
|
||||||
|
end
|
||||||
|
describe directory('/var/lib/prometheus/php-fpm_exporter') do
|
||||||
|
it { should exist }
|
||||||
|
end
|
||||||
|
describe file("#{service_dir}/#{php_fpm_exporter_service}.service") do
|
||||||
|
it { should exist }
|
||||||
|
its('group') { should eq 'root' }
|
||||||
|
its('mode') { should cmp '0644' }
|
||||||
|
end
|
||||||
|
describe directory('/var/lib/prometheus/postgres_exporter') do
|
||||||
|
it { should exist }
|
||||||
|
end
|
||||||
|
describe directory('/opt/prometheus/postgres_exporter-v0.8.0') do
|
||||||
|
it { should exist }
|
||||||
|
its('group') { should eq 'root' }
|
||||||
|
end
|
||||||
|
describe file('/opt/prometheus/postgres_exporter-v0.8.0/postgres_exporter') do
|
||||||
|
it { should exist }
|
||||||
|
its('group') { should eq 'root' }
|
||||||
|
end
|
||||||
|
describe file("#{service_dir}/#{postgres_exporter_service}.service") do
|
||||||
|
it { should exist }
|
||||||
|
its('group') { should eq 'root' }
|
||||||
|
its('mode') { should cmp '0644' }
|
||||||
|
end
|
||||||
describe file('/usr/local/sbin/alertmanager') do
|
describe file('/usr/local/sbin/alertmanager') do
|
||||||
it { should exist }
|
it { should exist }
|
||||||
its('group') { should eq 'root' }
|
its('group') { should eq 'root' }
|
||||||
|
@ -15,6 +15,8 @@ prometheus:
|
|||||||
- node_exporter
|
- node_exporter
|
||||||
- blackbox_exporter
|
- blackbox_exporter
|
||||||
- consul_exporter
|
- consul_exporter
|
||||||
|
- php-fpm_exporter
|
||||||
|
- postgres_exporter
|
||||||
# - memcached_exporter # not in upstream repo, only archive
|
# - memcached_exporter # not in upstream repo, only archive
|
||||||
|
|
||||||
exporters:
|
exporters:
|
||||||
@ -171,6 +173,31 @@ prometheus:
|
|||||||
web.listen-address: ":9091"
|
web.listen-address: ":9091"
|
||||||
web.telemetry-path: "/metrics"
|
web.telemetry-path: "/metrics"
|
||||||
|
|
||||||
|
# Unoffical php fpm exporter config
|
||||||
|
php-fpm_exporter:
|
||||||
|
version: v0.6.1
|
||||||
|
archive:
|
||||||
|
official: false
|
||||||
|
tar: false
|
||||||
|
# yamllint disable-line rule:line-length
|
||||||
|
source: https://github.com/bakins/php-fpm-exporter/releases/download/v0.6.1/php-fpm-exporter.linux.amd64
|
||||||
|
source_hash: 40e52d84f7decb5fdad9fadacf63cb2de26ebddce56e11b20651555e8d6c6130
|
||||||
|
service:
|
||||||
|
args:
|
||||||
|
addr: ":9253"
|
||||||
|
fastcgi: "unix:///run/php/php-fpm.sock"
|
||||||
|
|
||||||
|
postgres_exporter:
|
||||||
|
version: v0.8.0
|
||||||
|
service:
|
||||||
|
env:
|
||||||
|
- 'DATA_SOURCE_NAME=foo:bar@/'
|
||||||
|
archive:
|
||||||
|
official: false
|
||||||
|
# yamllint disable-line rule:line-length
|
||||||
|
source: https://github.com/wrouesnel/postgres_exporter/releases/download/v0.8.0/postgres_exporter_v0.8.0_linux-amd64.tar.gz
|
||||||
|
skip_verify: true
|
||||||
|
|
||||||
linux:
|
linux:
|
||||||
# 'Alternatives system' priority: zero disables (default)
|
# 'Alternatives system' priority: zero disables (default)
|
||||||
# yamllint disable-line rule:braces
|
# yamllint disable-line rule:braces
|
||||||
|
Loading…
Reference in New Issue
Block a user