2020-08-24 17:37:06 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
control 'prometheus services' do
|
|
|
|
title 'should be running'
|
|
|
|
|
2020-08-25 16:30:05 +02:00
|
|
|
services =
|
2020-08-24 23:33:16 +02:00
|
|
|
case platform[:family]
|
|
|
|
when 'redhat'
|
2020-08-25 16:30:05 +02:00
|
|
|
%w[
|
|
|
|
node_exporter
|
|
|
|
prometheus
|
|
|
|
blackbox_exporter
|
|
|
|
alertmanager
|
|
|
|
]
|
2020-08-24 23:33:16 +02:00
|
|
|
else
|
2020-08-25 16:30:05 +02:00
|
|
|
%w[
|
|
|
|
prometheus
|
|
|
|
prometheus-node-exporter
|
|
|
|
prometheus-blackbox-exporter
|
|
|
|
prometheus-alertmanager
|
|
|
|
]
|
2020-08-24 23:33:16 +02:00
|
|
|
end
|
|
|
|
|
2020-08-25 16:30:05 +02:00
|
|
|
services.each do |service|
|
|
|
|
describe service(service) do
|
|
|
|
it { should be_enabled }
|
|
|
|
it { should be_running }
|
|
|
|
end
|
2021-06-25 11:51:30 +02:00
|
|
|
|
|
|
|
describe file("/etc/default/#{service}") do
|
|
|
|
it { should exist }
|
|
|
|
end
|
2020-08-24 17:37:06 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
# prometheus-node-exporter port
|
2021-06-25 11:51:30 +02:00
|
|
|
describe port(9110) do
|
2020-08-24 17:37:06 +02:00
|
|
|
it { should be_listening }
|
|
|
|
end
|
2021-06-25 11:51:30 +02:00
|
|
|
|
|
|
|
# environ args check
|
|
|
|
describe file('/etc/default/prometheus') do
|
|
|
|
its('content') { should include '--log.level=debug' }
|
|
|
|
end
|
|
|
|
|
|
|
|
describe file('/etc/default/prometheus-node-exporter') do
|
|
|
|
its('content') { should include '--web.listen-address=:9110' }
|
|
|
|
its('content') { should include '--collector.systemd' }
|
|
|
|
end
|
2020-08-24 17:37:06 +02:00
|
|
|
end
|