test(archive): add unofficial exporter test

This commit is contained in:
lagooj 2020-11-12 11:53:50 +01:00
parent 10c0b4a030
commit 43053a6e59
3 changed files with 69 additions and 2 deletions

View File

@ -197,8 +197,6 @@ prometheus:
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:
# 'Alternatives system' priority: zero disables (default)
# yamllint disable-line rule:braces

View File

@ -8,10 +8,14 @@ control 'prometheus components' do
service_dir = '/lib/systemd/system'
alert_manager_service = 'prometheus-alertmanager'
node_exporter_service = 'prometheus-node-exporter'
php_fpm_exporter_service = 'php-fpm_exporter'
postgres_exporter_service = 'prometheus-postgres-exporter'
else
service_dir = '/usr/lib/systemd/system'
alert_manager_service = 'alertmanager'
node_exporter_service = 'node_exporter'
php_fpm_exporter_service = 'php-fpm_exporter'
postgres_exporter_service = 'postgres_exporter'
end
# describe package('cron') do
@ -35,6 +39,12 @@ control 'prometheus components' do
describe user('node_exporter') do
it { should exist }
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
it { should exist }
end
@ -89,6 +99,38 @@ control 'prometheus components' do
its('group') { should eq 'root' }
its('mode') { should cmp '0644' }
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
it { should exist }
its('group') { should eq 'root' }

View File

@ -15,6 +15,8 @@ prometheus:
- node_exporter
- blackbox_exporter
- consul_exporter
- php-fpm_exporter
- postgres_exporter
# - memcached_exporter # not in upstream repo, only archive
exporters:
@ -171,6 +173,31 @@ prometheus:
web.listen-address: ":9091"
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:
# 'Alternatives system' priority: zero disables (default)
# yamllint disable-line rule:braces