fix: added guidance and reverted incorrected changes from prior commits
Added inspec checks for environment files and specifically prometheus and node_exporter args. Provided comments throughout the key reference points for users to signpost the differing approaches to args used along with more clearly identifying the difference between archive and repo approach. Tests appear to be working on both approaches though updates have been focused at repo install method. Fixes: #59
This commit is contained in:
parent
696bee0522
commit
a4dfb87554
@ -7,9 +7,6 @@ driver:
|
|||||||
use_sudo: false
|
use_sudo: false
|
||||||
privileged: true
|
privileged: true
|
||||||
run_command: /lib/systemd/systemd
|
run_command: /lib/systemd/systemd
|
||||||
forward:
|
|
||||||
- 9090:9090
|
|
||||||
- 9110:9110
|
|
||||||
|
|
||||||
platforms:
|
platforms:
|
||||||
## SALT `tiamat`
|
## SALT `tiamat`
|
||||||
@ -353,7 +350,7 @@ suites:
|
|||||||
state_top:
|
state_top:
|
||||||
base:
|
base:
|
||||||
'*':
|
'*':
|
||||||
# - prometheus._mapdata
|
- prometheus._mapdata
|
||||||
- prometheus
|
- prometheus
|
||||||
pillars:
|
pillars:
|
||||||
top.sls:
|
top.sls:
|
||||||
|
@ -1,6 +1,17 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vim: ft=yaml
|
# vim: ft=yaml
|
||||||
---
|
---
|
||||||
|
# Prometheus has two approaches to handling config arguments, through an environment
|
||||||
|
# file or directly adding to the service file.
|
||||||
|
# This formular takes both approaches in seperate circumstances, with the archive
|
||||||
|
# install approach implementing a custom service file, and the repo (default) approach
|
||||||
|
# using an environ file with the standard package provided service file.
|
||||||
|
# As a result, depending on the install method used, the environ:args or service:args
|
||||||
|
# pillars need to be set appropriately.
|
||||||
|
# The default options given under service in the default.yaml may not therefore apply
|
||||||
|
# depending on the install method, and in some cases they are no longer consistent
|
||||||
|
# with the default configuration in the latest package.
|
||||||
|
# This applies to all components with an example provided for node_exporter.
|
||||||
prometheus:
|
prometheus:
|
||||||
wanted:
|
wanted:
|
||||||
clientlibs:
|
clientlibs:
|
||||||
@ -33,6 +44,12 @@ prometheus:
|
|||||||
smartctl: /usr/sbin/smartctl
|
smartctl: /usr/sbin/smartctl
|
||||||
pkg:
|
pkg:
|
||||||
use_upstream_repo: false
|
use_upstream_repo: false
|
||||||
|
# Uses the archive install method with true or repo method with false. Default is
|
||||||
|
# false.
|
||||||
|
# The archive and repo methods use completely different approaches to
|
||||||
|
# / service arguments handling, with different required pillar values.
|
||||||
|
# The repo method uses the package service config, the archive method uses a custom
|
||||||
|
# service config.
|
||||||
use_upstream_archive: true
|
use_upstream_archive: true
|
||||||
|
|
||||||
clientlibs:
|
clientlibs:
|
||||||
@ -94,6 +111,10 @@ prometheus:
|
|||||||
version: v0.18.1
|
version: v0.18.1
|
||||||
archive:
|
archive:
|
||||||
source_hash: b2503fd932f85f4e5baf161268854bf5d22001869b84f00fd2d1f57b51b72424
|
source_hash: b2503fd932f85f4e5baf161268854bf5d22001869b84f00fd2d1f57b51b72424
|
||||||
|
environ:
|
||||||
|
args:
|
||||||
|
collector.systemd: null
|
||||||
|
web.listen-address: ":9110"
|
||||||
service:
|
service:
|
||||||
name: prometheus-node-exporter
|
name: prometheus-node-exporter
|
||||||
args:
|
args:
|
||||||
|
@ -46,6 +46,8 @@ prometheus:
|
|||||||
config: {}
|
config: {}
|
||||||
environ_file: /etc/default/prometheus-alertmanager
|
environ_file: /etc/default/prometheus-alertmanager
|
||||||
environ: {}
|
environ: {}
|
||||||
|
# These service args will not impact installs using the non archive method and
|
||||||
|
# instead should be added as environ args in such a case
|
||||||
service:
|
service:
|
||||||
args:
|
args:
|
||||||
config.file: /etc/prometheus/alertmanager.yml
|
config.file: /etc/prometheus/alertmanager.yml
|
||||||
@ -135,6 +137,8 @@ prometheus:
|
|||||||
environ: {}
|
environ: {}
|
||||||
config_file: /etc/prometheus/node_exporter.yml
|
config_file: /etc/prometheus/node_exporter.yml
|
||||||
config: {}
|
config: {}
|
||||||
|
# These service args will not impact installs using the non archive method and
|
||||||
|
# instead should be added as environ args in such a case
|
||||||
service:
|
service:
|
||||||
args:
|
args:
|
||||||
collector.textfile.directory: /var/tmp/node_exporter
|
collector.textfile.directory: /var/tmp/node_exporter
|
||||||
@ -154,6 +158,8 @@ prometheus:
|
|||||||
config: {}
|
config: {}
|
||||||
environ_file: /etc/default/prometheus
|
environ_file: /etc/default/prometheus
|
||||||
environ: {}
|
environ: {}
|
||||||
|
# These service args will not impact installs using the non archive method and
|
||||||
|
# instead should be added as environ args in such a case
|
||||||
service:
|
service:
|
||||||
args:
|
args:
|
||||||
config.file: /etc/prometheus/prometheus.yml
|
config.file: /etc/prometheus/prometheus.yml
|
||||||
|
@ -26,10 +26,24 @@ control 'prometheus services' do
|
|||||||
it { should be_enabled }
|
it { should be_enabled }
|
||||||
it { should be_running }
|
it { should be_running }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe file("/etc/default/#{service}") do
|
||||||
|
it { should exist }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# prometheus-node-exporter port
|
# prometheus-node-exporter port
|
||||||
describe port(9100) do
|
describe port(9110) do
|
||||||
it { should be_listening }
|
it { should be_listening }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# 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
|
||||||
end
|
end
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vim: ft=yaml
|
# vim: ft=yaml
|
||||||
---
|
---
|
||||||
|
# Uses the archive install method identified by 'use_upstream_archive: true'
|
||||||
prometheus:
|
prometheus:
|
||||||
wanted:
|
wanted:
|
||||||
clientlibs:
|
clientlibs:
|
||||||
@ -14,31 +15,29 @@ prometheus:
|
|||||||
- alertmanager
|
- alertmanager
|
||||||
- node_exporter
|
- node_exporter
|
||||||
- blackbox_exporter
|
- blackbox_exporter
|
||||||
# - consul_exporter
|
- consul_exporter
|
||||||
# - php-fpm_exporter
|
- php-fpm_exporter
|
||||||
- postgres_exporter
|
- postgres_exporter
|
||||||
# - mysqld_exporter
|
- mysqld_exporter
|
||||||
# - memcached_exporter # not in upstream repo, only archive
|
- memcached_exporter # not in upstream repo, only archive
|
||||||
|
|
||||||
# exporters:
|
exporters:
|
||||||
# node_exporter:
|
node_exporter:
|
||||||
# textfile_collectors_dependencies: []
|
textfile_collectors_dependencies: []
|
||||||
# textfile_collectors:
|
textfile_collectors:
|
||||||
# ipmitool:
|
ipmitool:
|
||||||
# enable: false
|
enable: false
|
||||||
# remove: false
|
remove: false
|
||||||
# pkg: ipmitool
|
pkg: ipmitool
|
||||||
# smartmon:
|
smartmon:
|
||||||
# enable: false
|
enable: false
|
||||||
# remove: false
|
remove: false
|
||||||
# pkg: smartmontools
|
pkg: smartmontools
|
||||||
# bash_pkg: bash
|
bash_pkg: bash
|
||||||
# smartctl: /usr/sbin/smartctl
|
smartctl: /usr/sbin/smartctl
|
||||||
pkg:
|
pkg:
|
||||||
use_upstream_repo: false
|
use_upstream_repo: false
|
||||||
# Changed to use non archive install as default (the archive includes a bespoke
|
use_upstream_archive: true
|
||||||
# implementation of service thats needs updating)
|
|
||||||
use_upstream_archive: false
|
|
||||||
|
|
||||||
clientlibs:
|
clientlibs:
|
||||||
# https://prometheus.io/docs/instrumenting/clientlibs
|
# https://prometheus.io/docs/instrumenting/clientlibs
|
||||||
@ -108,12 +107,12 @@ prometheus:
|
|||||||
# This is to test that any fancy name we use, will work in archive mode
|
# This is to test that any fancy name we use, will work in archive mode
|
||||||
name: my-fancy-consul-exporter-service
|
name: my-fancy-consul-exporter-service
|
||||||
|
|
||||||
# mysqld_exporter:
|
mysqld_exporter:
|
||||||
# service:
|
service:
|
||||||
# args:
|
args:
|
||||||
# web.listen-address: 0.0.0.0:9192
|
web.listen-address: 0.0.0.0:9192
|
||||||
# env:
|
env:
|
||||||
# - 'DATA_SOURCE_NAME=foo:bar@/'
|
- 'DATA_SOURCE_NAME=foo:bar@/'
|
||||||
|
|
||||||
prometheus:
|
prometheus:
|
||||||
service:
|
service:
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vim: ft=yaml
|
# vim: ft=yaml
|
||||||
---
|
---
|
||||||
|
# Uses the standard install method from package repo
|
||||||
prometheus:
|
prometheus:
|
||||||
wanted:
|
wanted:
|
||||||
clientlibs:
|
clientlibs:
|
||||||
@ -78,6 +79,10 @@ prometheus:
|
|||||||
version: v0.18.1
|
version: v0.18.1
|
||||||
archive:
|
archive:
|
||||||
source_hash: b2503fd932f85f4e5baf161268854bf5d22001869b84f00fd2d1f57b51b72424
|
source_hash: b2503fd932f85f4e5baf161268854bf5d22001869b84f00fd2d1f57b51b72424
|
||||||
|
environ:
|
||||||
|
args:
|
||||||
|
collector.systemd: true
|
||||||
|
web.listen-address: ":9110"
|
||||||
service:
|
service:
|
||||||
args:
|
args:
|
||||||
web.listen-address: ":9110"
|
web.listen-address: ":9110"
|
||||||
@ -92,6 +97,10 @@ prometheus:
|
|||||||
service:
|
service:
|
||||||
args:
|
args:
|
||||||
web.listen-address: 0.0.0.0:9090
|
web.listen-address: 0.0.0.0:9090
|
||||||
|
environ:
|
||||||
|
args:
|
||||||
|
web.listen-address: 0.0.0.0:9090
|
||||||
|
log.level: debug
|
||||||
config:
|
config:
|
||||||
# yamllint disable-line rule:line-length
|
# yamllint disable-line rule:line-length
|
||||||
# ref https://raw.githubusercontent.com/prometheus/prometheus/release-2.10/config/testdata/conf.good.yml
|
# ref https://raw.githubusercontent.com/prometheus/prometheus/release-2.10/config/testdata/conf.good.yml
|
||||||
|
Loading…
Reference in New Issue
Block a user