prometheus-formula/test/integration/repo/controls/service_spec.rb
BlueWolf 076869a8cd fix: added handle for alternative argument opts header
Centos and oraclelinux repositories for prometheus include bespoke headers
in the environment files (e.g. Debian: ARGS=, Centos: PROMETHEUS_OPTS=
ALERTMANAGER_OPTS=). This has been added as a default pillar with osmap
variances.
Additionally archlinux repo install was failing so added basic support -
an issue still remains for the prometheus app itself due to the service
file included in the arch repo hardcoding some config options - resulting
in the possibility to duplicate arguments resulting in a service error.
The prometheus service currently does not start due to permissions not being
applied to a data folder. The added config.storage begins to solve this and
ensures alignment on all platforms but would result in a duplicate config
entry as above. Prometheus on arch therefore needs more work but the exporter
installs now work.

Resolves: #59
2021-06-30 05:16:56 +01:00

58 lines
1.2 KiB
Ruby

# frozen_string_literal: true
control 'prometheus services' do
title 'should be running'
services =
case platform[:family]
when 'redhat'
%w[
node_exporter
prometheus
blackbox_exporter
alertmanager
]
else
%w[
prometheus
prometheus-node-exporter
prometheus-blackbox-exporter
prometheus-alertmanager
]
end
node_exporter =
case platform[:family]
when 'redhat'
'node_exporter'
else
'prometheus-node-exporter'
end
services.each do |service|
describe service(service) do
it { should be_enabled }
it { should be_running }
end
describe file("/etc/default/#{service}") do
it { should exist }
end
end
# prometheus-node-exporter port
describe port(9110) do
it { should be_listening }
end
# environ args check
describe file('/etc/default/prometheus') do
its('content') { should include '--log.level=debug' }
end
describe file("/etc/default/#{node_exporter}") do
its('content') { should include '--web.listen-address=:9110' }
its('content') { should include '--log.level=debug' }
end
end