Merge pull request #44 from netmanagers/master
fix(debian): add some valid defaults
This commit is contained in:
commit
a53d228c95
@ -82,11 +82,11 @@ prometheus-archive-install-{{ name }}-file-directory:
|
|||||||
- user: prometheus-config-user-install-{{ name }}-user-present
|
- user: prometheus-config-user-install-{{ name }}-user-present
|
||||||
- group: prometheus-config-user-install-{{ name }}-user-present
|
- group: prometheus-config-user-install-{{ name }}-user-present
|
||||||
|
|
||||||
{%- if grains.kernel|lower == 'linux' and 'config_file' in p.pkg.component[name] %}
|
{%- if grains.kernel|lower == 'linux' %}
|
||||||
|
|
||||||
prometheus-archive-install-{{ name }}-managed-service:
|
prometheus-archive-install-{{ name }}-managed-service:
|
||||||
file.managed:
|
file.managed:
|
||||||
- name: {{ p.dir.service }}/{{ name }}.service
|
- name: {{ p.dir.service }}/{{ p.pkg.component[name]['service'].get('name', name) }}.service
|
||||||
- source: {{ files_switch(['systemd.ini.jinja'],
|
- source: {{ files_switch(['systemd.ini.jinja'],
|
||||||
lookup='prometheus-archive-install-' ~ name ~ '-managed-service'
|
lookup='prometheus-archive-install-' ~ name ~ '-managed-service'
|
||||||
)
|
)
|
||||||
@ -103,7 +103,7 @@ prometheus-archive-install-{{ name }}-managed-service:
|
|||||||
group: {{ name }}
|
group: {{ name }}
|
||||||
workdir: {{ p.dir.var }}/{{ name }}
|
workdir: {{ p.dir.var }}/{{ name }}
|
||||||
stop: ''
|
stop: ''
|
||||||
{%- if name in ('node_exporter',) %}
|
{%- if name in ('node_exporter', 'consul_exporter') or 'config_file' not in p.pkg.component[name] %}
|
||||||
start: {{ p.pkg.component[name]['path'] }}/{{ name }}
|
start: {{ p.pkg.component[name]['path'] }}/{{ name }}
|
||||||
{%- else %}
|
{%- else %}
|
||||||
start: {{ p.pkg.component[name]['path'] }}/{{ name }} --config.file {{ p.pkg.component[name]['config_file'] }} # noqa 204
|
start: {{ p.pkg.component[name]['path'] }}/{{ name }} --config.file {{ p.pkg.component[name]['config_file'] }} # noqa 204
|
||||||
|
@ -20,6 +20,8 @@ Arch: {}
|
|||||||
Alpine: {}
|
Alpine: {}
|
||||||
|
|
||||||
Debian:
|
Debian:
|
||||||
|
dir:
|
||||||
|
service: /lib/systemd/system
|
||||||
pkg:
|
pkg:
|
||||||
deps:
|
deps:
|
||||||
- cron
|
- cron
|
||||||
@ -31,66 +33,108 @@ Debian:
|
|||||||
name: prometheus
|
name: prometheus
|
||||||
alertmanager:
|
alertmanager:
|
||||||
name: prometheus-alertmanager
|
name: prometheus-alertmanager
|
||||||
|
service:
|
||||||
|
name: prometheus-alertmanager
|
||||||
|
args_file: /etc/default/prometheus-alertmanager
|
||||||
apache_exporter:
|
apache_exporter:
|
||||||
name: prometheus-apache-exporter
|
name: prometheus-apache-exporter
|
||||||
|
service:
|
||||||
|
name: prometheus-apache-exporter
|
||||||
|
args_file: /etc/default/prometheus-apache-exporter
|
||||||
bind_exporter:
|
bind_exporter:
|
||||||
name: prometheus-bind-exporter
|
name: prometheus-bind-exporter
|
||||||
|
args_file: /etc/default/prometheus-bind-exporter
|
||||||
bird_exporter:
|
bird_exporter:
|
||||||
name: prometheus-bird-exporter
|
name: prometheus-bird-exporter
|
||||||
|
args_file: /etc/default/prometheus-bird-exporter
|
||||||
blackbox_exporter:
|
blackbox_exporter:
|
||||||
name: prometheus-blackbox-exporter
|
name: prometheus-blackbox-exporter
|
||||||
|
service:
|
||||||
|
name: prometheus-blackbox-exporter
|
||||||
|
config_file: /etc/prometheus/blackbox.yml
|
||||||
hacluster_exporter:
|
hacluster_exporter:
|
||||||
name: prometheus-hacluster-exporter
|
name: prometheus-hacluster-exporter
|
||||||
|
args_file: /etc/default/prometheus-hacluster-exporter
|
||||||
haproxy_exporter:
|
haproxy_exporter:
|
||||||
name: prometheus-haproxy-exporter
|
name: prometheus-haproxy-exporter
|
||||||
|
args_file: /etc/default/prometheus-haproxy-exporter
|
||||||
homeplug_exporter:
|
homeplug_exporter:
|
||||||
name: prometheus-homeplug-exporter
|
name: prometheus-homeplug-exporter
|
||||||
|
args_file: /etc/default/prometheus-homeplug-exporter
|
||||||
ipmi_exporter:
|
ipmi_exporter:
|
||||||
name: prometheus-ipmi-exporter
|
name: prometheus-ipmi-exporter
|
||||||
|
args_file: /etc/default/prometheus-ipmi-exporter
|
||||||
libvirt_exporter:
|
libvirt_exporter:
|
||||||
name: prometheus-libvirt-exporter
|
name: prometheus-libvirt-exporter
|
||||||
|
args_file: /etc/default/prometheus-libvirt-exporter
|
||||||
mailexporter:
|
mailexporter:
|
||||||
name: prometheus-mailexporter
|
name: prometheus-mailexporter
|
||||||
|
args_file: /etc/default/prometheus-mailexporter
|
||||||
mongodb_exporter:
|
mongodb_exporter:
|
||||||
name: prometheus-mongodb-exporter
|
name: prometheus-mongodb-exporter
|
||||||
|
args_file: /etc/default/prometheus-mongodb-exporter
|
||||||
mysqld_exporter:
|
mysqld_exporter:
|
||||||
name: prometheus-mysqld-exporter
|
name: prometheus-mysqld-exporter
|
||||||
|
service:
|
||||||
|
name: prometheus-mysqld-exporter
|
||||||
|
args_file: /etc/default/prometheus-mysqld-exporter
|
||||||
nginx_exporter:
|
nginx_exporter:
|
||||||
name: prometheus-nginx-exporter
|
name: prometheus-nginx-exporter
|
||||||
|
service:
|
||||||
|
name: prometheus-nginx-exporter
|
||||||
|
args_file: /etc/default/prometheus-nginx-exporter
|
||||||
nginx_vts_exporter:
|
nginx_vts_exporter:
|
||||||
name: prometheus-nginx-vts-exporter
|
name: prometheus-nginx-vts-exporter
|
||||||
|
args_file: /etc/default/prometheus-nginx-vts-exporter
|
||||||
node_exporter:
|
node_exporter:
|
||||||
name: prometheus-node-exporter
|
name: prometheus-node-exporter
|
||||||
|
service:
|
||||||
|
name: prometheus-node-exporter
|
||||||
args_file: /etc/default/prometheus-node-exporter
|
args_file: /etc/default/prometheus-node-exporter
|
||||||
node_exporter_collectors:
|
node_exporter_collectors:
|
||||||
name: prometheus-node-exporter-collectors
|
name: prometheus-node-exporter-collectors
|
||||||
|
args_file: /etc/default/prometheus-node-exporter-collectors
|
||||||
openstack_exporter:
|
openstack_exporter:
|
||||||
name: prometheus-openstack-exporter
|
name: prometheus-openstack-exporter
|
||||||
|
args_file: /etc/default/prometheus-openstack-exporter
|
||||||
pgbouncer_exporter:
|
pgbouncer_exporter:
|
||||||
name: prometheus-pgbouncer-exporter
|
name: prometheus-pgbouncer-exporter
|
||||||
|
args_file: /etc/default/prometheus-pgbouncer-exporter
|
||||||
postfix_exporter:
|
postfix_exporter:
|
||||||
name: prometheus-postfix-exporter
|
name: prometheus-postfix-exporter
|
||||||
|
args_file: /etc/default/prometheus-postfix-exporter
|
||||||
postgres_exporter:
|
postgres_exporter:
|
||||||
name: prometheus-postgres-exporter
|
name: prometheus-postgres-exporter
|
||||||
|
service:
|
||||||
|
name: prometheus-postgres-exporter
|
||||||
|
args_file: /etc/default/prometheus-postgres-exporter
|
||||||
process_exporter:
|
process_exporter:
|
||||||
name: prometheus-process-exporter
|
name: prometheus-process-exporter
|
||||||
|
args_file: /etc/default/prometheus-process-exporter
|
||||||
pushgateway:
|
pushgateway:
|
||||||
name: prometheus-pushgateway
|
name: prometheus-pushgateway
|
||||||
|
args_file: /etc/default/prometheus-pushgateway
|
||||||
snmp_exporter:
|
snmp_exporter:
|
||||||
name: prometheus-snmp-exporter
|
name: prometheus-snmp-exporter
|
||||||
|
args_file: /etc/default/prometheus-snmp-exporter
|
||||||
sql_exporter:
|
sql_exporter:
|
||||||
name: prometheus-sql-exporter
|
name: prometheus-sql-exporter
|
||||||
|
args_file: /etc/default/prometheus-sql-exporter
|
||||||
squid_exporter:
|
squid_exporter:
|
||||||
name: prometheus-squid-exporter
|
name: prometheus-squid-exporter
|
||||||
|
args_file: /etc/default/prometheus-squid-exporter
|
||||||
tplink_plug_exporter:
|
tplink_plug_exporter:
|
||||||
name: prometheus-tplink-plug-exporter
|
name: prometheus-tplink-plug-exporter
|
||||||
|
args_file: /etc/default/prometheus-tplink-plug-exporter
|
||||||
trafficserver_exporter:
|
trafficserver_exporter:
|
||||||
name: prometheus-trafficserver-exporter
|
name: prometheus-trafficserver-exporter
|
||||||
|
args_file: /etc/default/prometheus-trafficserver-exporter
|
||||||
varnish_exporter:
|
varnish_exporter:
|
||||||
name: prometheus-varnish-exporter
|
name: prometheus-varnish-exporter
|
||||||
|
args_file: /etc/default/prometheus-varnish-exporter
|
||||||
xmpp_alerts:
|
xmpp_alerts:
|
||||||
name: prometheus-xmpp-alerts
|
name: prometheus-xmpp-alerts
|
||||||
|
args_file: /etc/default/prometheus-xmpp-alerts
|
||||||
|
|
||||||
exporters:
|
exporters:
|
||||||
node_exporter:
|
node_exporter:
|
||||||
|
@ -3,6 +3,17 @@
|
|||||||
control 'prometheus components' do
|
control 'prometheus components' do
|
||||||
title 'should be installed'
|
title 'should be installed'
|
||||||
|
|
||||||
|
case platform[:family]
|
||||||
|
when 'debian'
|
||||||
|
service_dir = '/lib/systemd/system'
|
||||||
|
alert_manager_service = 'prometheus-alertmanager'
|
||||||
|
node_exporter_service = 'prometheus-node-exporter'
|
||||||
|
else
|
||||||
|
service_dir = '/usr/lib/systemd/system'
|
||||||
|
alert_manager_service = 'alertmanager'
|
||||||
|
node_exporter_service = 'node_exporter'
|
||||||
|
end
|
||||||
|
|
||||||
# describe package('cron') do
|
# describe package('cron') do
|
||||||
# it { should be_installed } # not available on amazonlinux?
|
# it { should be_installed } # not available on amazonlinux?
|
||||||
# end
|
# end
|
||||||
@ -39,7 +50,7 @@ control 'prometheus components' do
|
|||||||
it { should exist }
|
it { should exist }
|
||||||
its('group') { should eq 'prometheus' }
|
its('group') { should eq 'prometheus' }
|
||||||
end
|
end
|
||||||
describe file('/usr/lib/systemd/system/prometheus.service') do
|
describe file("#{service_dir}/prometheus.service") do
|
||||||
it { should exist }
|
it { should exist }
|
||||||
its('group') { should eq 'root' }
|
its('group') { should eq 'root' }
|
||||||
its('mode') { should cmp '0644' }
|
its('mode') { should cmp '0644' }
|
||||||
@ -56,7 +67,7 @@ control 'prometheus components' do
|
|||||||
it { should exist }
|
it { should exist }
|
||||||
its('group') { should eq 'alertmanager' }
|
its('group') { should eq 'alertmanager' }
|
||||||
end
|
end
|
||||||
describe file('/usr/lib/systemd/system/alertmanager.service') do
|
describe file("#{service_dir}/#{alert_manager_service}.service") do
|
||||||
it { should exist }
|
it { should exist }
|
||||||
its('group') { should eq 'root' }
|
its('group') { should eq 'root' }
|
||||||
its('mode') { should cmp '0644' }
|
its('mode') { should cmp '0644' }
|
||||||
@ -73,7 +84,7 @@ control 'prometheus components' do
|
|||||||
it { should exist }
|
it { should exist }
|
||||||
its('group') { should eq 'node_exporter' }
|
its('group') { should eq 'node_exporter' }
|
||||||
end
|
end
|
||||||
describe file('/usr/lib/systemd/system/node_exporter.service') do
|
describe file("#{service_dir}/#{node_exporter_service}.service") do
|
||||||
it { should exist }
|
it { should exist }
|
||||||
its('group') { should eq 'root' }
|
its('group') { should eq 'root' }
|
||||||
its('mode') { should cmp '0644' }
|
its('mode') { should cmp '0644' }
|
||||||
|
@ -1,15 +1,53 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
control 'prometheus services' do
|
control 'services with a consistent service name on each distro' do
|
||||||
title 'should be running'
|
title 'should be running'
|
||||||
|
|
||||||
describe service('node_exporter') do
|
distro_services =
|
||||||
|
case platform[:family]
|
||||||
|
when 'debian'
|
||||||
|
%w[
|
||||||
|
prometheus
|
||||||
|
prometheus-alertmanager
|
||||||
|
prometheus-node-exporter
|
||||||
|
prometheus-blackbox-exporter
|
||||||
|
]
|
||||||
|
else
|
||||||
|
%w[
|
||||||
|
prometheus
|
||||||
|
alertmanager
|
||||||
|
node_exporter
|
||||||
|
blackbox_exporter
|
||||||
|
]
|
||||||
|
end
|
||||||
|
|
||||||
|
distro_services.each do |service|
|
||||||
|
describe service(service) do
|
||||||
|
it { should be_enabled }
|
||||||
|
it { should be_running }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# blackbox_exporter port
|
||||||
|
describe port(9115) do
|
||||||
|
it { should be_listening }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
control 'services with any service name we want to give them' do
|
||||||
|
title 'should be running'
|
||||||
|
|
||||||
|
# if we set a service name in the pillar,
|
||||||
|
# the formula should work, no matter what it is or the
|
||||||
|
# install method we choose
|
||||||
|
|
||||||
|
describe service('my-fancy-consul-exporter-service') do
|
||||||
it { should be_enabled }
|
it { should be_enabled }
|
||||||
it { should be_running }
|
it { should be_running }
|
||||||
end
|
end
|
||||||
|
|
||||||
# node_exporter port
|
# consul_exporter port
|
||||||
describe port(9100) do
|
describe port(9107) do
|
||||||
it { should be_listening }
|
it { should be_listening }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -3,17 +3,29 @@
|
|||||||
control 'prometheus services' do
|
control 'prometheus services' do
|
||||||
title 'should be running'
|
title 'should be running'
|
||||||
|
|
||||||
service =
|
services =
|
||||||
case platform[:family]
|
case platform[:family]
|
||||||
when 'redhat'
|
when 'redhat'
|
||||||
'node_exporter'
|
%w[
|
||||||
|
node_exporter
|
||||||
|
prometheus
|
||||||
|
blackbox_exporter
|
||||||
|
alertmanager
|
||||||
|
]
|
||||||
else
|
else
|
||||||
'prometheus-node-exporter'
|
%w[
|
||||||
|
prometheus
|
||||||
|
prometheus-node-exporter
|
||||||
|
prometheus-blackbox-exporter
|
||||||
|
prometheus-alertmanager
|
||||||
|
]
|
||||||
end
|
end
|
||||||
|
|
||||||
describe service(service) do
|
services.each do |service|
|
||||||
it { should be_enabled }
|
describe service(service) do
|
||||||
it { should be_running }
|
it { should be_enabled }
|
||||||
|
it { should be_running }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# prometheus-node-exporter port
|
# prometheus-node-exporter port
|
||||||
|
@ -13,6 +13,8 @@ prometheus:
|
|||||||
- prometheus
|
- prometheus
|
||||||
- alertmanager
|
- alertmanager
|
||||||
- node_exporter
|
- node_exporter
|
||||||
|
- blackbox_exporter
|
||||||
|
- consul_exporter
|
||||||
# - memcached_exporter # not in upstream repo, only archive
|
# - memcached_exporter # not in upstream repo, only archive
|
||||||
|
|
||||||
exporters:
|
exporters:
|
||||||
@ -79,25 +81,26 @@ prometheus:
|
|||||||
email_configs:
|
email_configs:
|
||||||
- to: 'team-X+alerts@example.org'
|
- to: 'team-X+alerts@example.org'
|
||||||
|
|
||||||
inhibit_rules:
|
|
||||||
- name: opsGenie-receiver
|
|
||||||
opsgenie_configs:
|
|
||||||
- api_key: mysecret
|
|
||||||
- name: slack-receiver
|
|
||||||
slack_configs:
|
|
||||||
- channel: '#my-channel'
|
|
||||||
image_url: 'http://some.img.com/img.png'
|
|
||||||
|
|
||||||
node_exporter:
|
node_exporter:
|
||||||
version: v0.18.1
|
version: v0.18.1
|
||||||
archive:
|
archive:
|
||||||
source_hash: b2503fd932f85f4e5baf161268854bf5d22001869b84f00fd2d1f57b51b72424
|
source_hash: b2503fd932f85f4e5baf161268854bf5d22001869b84f00fd2d1f57b51b72424
|
||||||
service:
|
service:
|
||||||
# name: prometheus-node-exporter
|
|
||||||
args:
|
args:
|
||||||
web.listen-address: ":9110"
|
web.listen-address: ":9110"
|
||||||
# collector.textfile.directory: /var/tmp/node_exporter
|
# collector.textfile.directory: /var/tmp/node_exporter
|
||||||
|
|
||||||
|
blackbox_exporter:
|
||||||
|
service:
|
||||||
|
args:
|
||||||
|
web.listen-address: ":9115"
|
||||||
|
config_file: /opt/prometheus/blackbox_exporter-v0.14.0/blackbox.yml
|
||||||
|
|
||||||
|
consul_exporter:
|
||||||
|
service:
|
||||||
|
# This is to test that any fancy name we use, will work in archive mode
|
||||||
|
name: my-fancy-consul-exporter-service
|
||||||
|
|
||||||
prometheus:
|
prometheus:
|
||||||
service:
|
service:
|
||||||
args:
|
args:
|
||||||
|
@ -12,7 +12,6 @@ prometheus:
|
|||||||
- alertmanager
|
- alertmanager
|
||||||
- node_exporter
|
- node_exporter
|
||||||
- blackbox_exporter
|
- blackbox_exporter
|
||||||
# - memcached_exporter # not in upstream repo, only archive
|
|
||||||
|
|
||||||
exporters:
|
exporters:
|
||||||
node_exporter:
|
node_exporter:
|
||||||
@ -72,20 +71,6 @@ prometheus:
|
|||||||
email_configs:
|
email_configs:
|
||||||
- to: 'team-X+alerts@example.org'
|
- to: 'team-X+alerts@example.org'
|
||||||
|
|
||||||
inhibit_rules:
|
|
||||||
- name: opsGenie-receiver
|
|
||||||
opsgenie_configs:
|
|
||||||
- api_key: mysecret
|
|
||||||
- name: slack-receiver
|
|
||||||
slack_configs:
|
|
||||||
- channel: '#my-channel'
|
|
||||||
image_url: 'http://some.img.com/img.png'
|
|
||||||
|
|
||||||
{% if grains['os_family'] == 'Debian' %}
|
|
||||||
service:
|
|
||||||
name: prometheus-alertmanager
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
node_exporter:
|
node_exporter:
|
||||||
version: v0.18.1
|
version: v0.18.1
|
||||||
archive:
|
archive:
|
||||||
@ -94,9 +79,11 @@ prometheus:
|
|||||||
args:
|
args:
|
||||||
web.listen-address: ":9110"
|
web.listen-address: ":9110"
|
||||||
# collector.textfile.directory: /var/tmp/node_exporter
|
# collector.textfile.directory: /var/tmp/node_exporter
|
||||||
{% if grains['os_family'] == 'Debian' %}
|
|
||||||
name: prometheus-node-exporter
|
blackbox_exporter:
|
||||||
{% endif %}
|
service:
|
||||||
|
args:
|
||||||
|
web.listen-address: ":9115"
|
||||||
|
|
||||||
prometheus:
|
prometheus:
|
||||||
service:
|
service:
|
||||||
|
Loading…
Reference in New Issue
Block a user