2019-04-24 18:18:44 +02:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
# vim: ft=yaml
|
|
|
|
---
|
2021-06-25 11:51:30 +02:00
|
|
|
# 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.
|
2019-04-24 18:18:44 +02:00
|
|
|
prometheus:
|
2019-06-20 02:36:58 +02:00
|
|
|
wanted:
|
2020-05-14 01:27:23 +02:00
|
|
|
clientlibs:
|
|
|
|
- golang
|
|
|
|
- haskell
|
|
|
|
- rust
|
|
|
|
component:
|
2020-08-21 15:46:48 +02:00
|
|
|
# List components (ie, exporters) using underscores and
|
|
|
|
# removing the 'prometheus' prefix
|
2020-05-14 01:27:23 +02:00
|
|
|
- prometheus
|
2020-08-21 15:46:48 +02:00
|
|
|
- alertmanager
|
2020-05-14 01:27:23 +02:00
|
|
|
- node_exporter
|
2020-11-12 11:53:16 +01:00
|
|
|
- php-fpm_exporter
|
|
|
|
- postgres_exporter
|
2020-05-14 01:27:23 +02:00
|
|
|
# - memcached_exporter # not in upstream repo, only archive
|
2019-06-22 19:19:41 +02:00
|
|
|
|
2020-05-14 01:27:23 +02:00
|
|
|
exporters:
|
|
|
|
node_exporter:
|
|
|
|
textfile_collectors_dependencies: []
|
|
|
|
textfile_collectors:
|
|
|
|
ipmitool:
|
|
|
|
enable: false
|
|
|
|
remove: false
|
|
|
|
pkg: ipmitool
|
|
|
|
smartmon:
|
|
|
|
enable: false
|
|
|
|
remove: false
|
|
|
|
pkg: smartmontools
|
|
|
|
bash_pkg: bash
|
|
|
|
smartctl: /usr/sbin/smartctl
|
2019-06-08 19:39:21 +02:00
|
|
|
pkg:
|
2020-05-14 01:27:23 +02:00
|
|
|
use_upstream_repo: false
|
2021-06-25 11:51:30 +02:00
|
|
|
# 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.
|
2020-05-14 01:27:23 +02:00
|
|
|
use_upstream_archive: true
|
2019-04-24 18:18:44 +02:00
|
|
|
|
2020-05-14 01:27:23 +02:00
|
|
|
clientlibs:
|
|
|
|
# https://prometheus.io/docs/instrumenting/clientlibs
|
|
|
|
# no bash & perl client tarballs are available
|
|
|
|
golang:
|
|
|
|
version: v1.6.0
|
|
|
|
component:
|
2020-08-21 15:46:48 +02:00
|
|
|
# If you use OS packages in Debian's family, components should have
|
|
|
|
# a 'name' variable stating the name of the package (it's generally
|
|
|
|
# something like `prometheus-component-with-dashes-replacing-underscores`
|
|
|
|
# ie,
|
|
|
|
# node_exporter:
|
|
|
|
# name: prometheus-node-exporter
|
|
|
|
#
|
|
|
|
# See prometheus/osfamilymap.yaml for more examples
|
2020-05-14 01:27:23 +02:00
|
|
|
alertmanager:
|
|
|
|
config:
|
|
|
|
# yamllint disable-line rule:line-length
|
|
|
|
# ref https://github.com/prometheus/alertmanager/blob/master/config/testdata/conf.good.yml
|
|
|
|
global:
|
|
|
|
smtp_smarthost: 'localhost:25'
|
|
|
|
smtp_from: 'alertmanager@example.org'
|
|
|
|
smtp_auth_username: 'alertmanager'
|
|
|
|
smtp_auth_password: "multiline\nmysecret"
|
|
|
|
smtp_hello: "host.example.org"
|
|
|
|
slack_api_url: "http://mysecret.example.com/"
|
|
|
|
http_config:
|
|
|
|
proxy_url: 'http://127.0.0.1:1025'
|
|
|
|
route:
|
|
|
|
group_by: ['alertname', 'cluster', 'service']
|
|
|
|
group_wait: 30s
|
|
|
|
group_interval: 5m
|
|
|
|
repeat_interval: 3h
|
|
|
|
receiver: team-X-mails
|
|
|
|
routes:
|
|
|
|
- match_re:
|
|
|
|
service: ^(foo1|foo2|baz)$
|
|
|
|
receiver: team-X-mails
|
|
|
|
routes:
|
|
|
|
- match:
|
|
|
|
severity: critical
|
|
|
|
receiver: team-X-mails
|
|
|
|
receivers:
|
|
|
|
- name: 'team-X-mails'
|
|
|
|
email_configs:
|
|
|
|
- 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:
|
|
|
|
version: v0.18.1
|
|
|
|
archive:
|
|
|
|
source_hash: b2503fd932f85f4e5baf161268854bf5d22001869b84f00fd2d1f57b51b72424
|
2021-06-25 11:51:30 +02:00
|
|
|
environ:
|
|
|
|
args:
|
|
|
|
collector.systemd: null
|
|
|
|
web.listen-address: ":9110"
|
2020-05-14 01:27:23 +02:00
|
|
|
service:
|
|
|
|
name: prometheus-node-exporter
|
|
|
|
args:
|
2021-05-03 17:17:32 +02:00
|
|
|
collector.systemd: null
|
2020-05-14 01:27:23 +02:00
|
|
|
web.listen-address: ":9110"
|
|
|
|
# collector.textfile.directory: /var/tmp/node_exporter
|
|
|
|
|
|
|
|
prometheus:
|
|
|
|
service:
|
|
|
|
args:
|
|
|
|
web.listen-address: 0.0.0.0:9090
|
|
|
|
config:
|
|
|
|
# yamllint disable-line rule:line-length
|
|
|
|
# ref https://raw.githubusercontent.com/prometheus/prometheus/release-2.10/config/testdata/conf.good.yml
|
|
|
|
# my global config
|
|
|
|
global:
|
|
|
|
# Set the scrape interval to every 15 seconds. Default is every 1 minute
|
|
|
|
scrape_interval: 15s
|
|
|
|
# Evaluate rules every 15 seconds. The default is every 1 minute
|
|
|
|
evaluation_interval: 15s
|
|
|
|
# scrape_timeout is set to the global default (10s)
|
|
|
|
|
|
|
|
# Alertmanager configuration
|
|
|
|
alerting:
|
|
|
|
alertmanagers:
|
|
|
|
- static_configs:
|
|
|
|
- targets:
|
|
|
|
- alertmanager1:9093
|
|
|
|
- alertmanager2:9093
|
|
|
|
- alertmanager3:9093
|
|
|
|
|
|
|
|
# Load rules once and periodically evaluate them according to the global
|
|
|
|
# 'evaluation_interval'
|
2021-05-28 01:16:17 +02:00
|
|
|
# You can manage these files with the `extra_files` dict (see below)
|
2020-05-14 01:27:23 +02:00
|
|
|
rule_files:
|
|
|
|
- "first_rules.yml"
|
|
|
|
# - "second_rules.yml"
|
|
|
|
|
|
|
|
# A scrape configuration containing exactly one endpoint to scrape:
|
|
|
|
scrape_configs:
|
|
|
|
# The job name is added as a label `job=<job_name>` to any timeseries
|
|
|
|
# scraped from this config
|
|
|
|
- job_name: 'prometheus'
|
|
|
|
# metrics_path defaults to '/metrics'
|
|
|
|
# scheme defaults to 'http'
|
|
|
|
static_configs:
|
|
|
|
- targets: ['localhost:9090']
|
|
|
|
|
|
|
|
- job_name: pushgateway
|
|
|
|
scrape_interval: 5s
|
|
|
|
honor_labels: true
|
|
|
|
static_configs:
|
|
|
|
- targets: ['pushgateway:9091']
|
|
|
|
|
|
|
|
- job_name: 'blackbox'
|
|
|
|
# https://github.com/prometheus/blackbox_exporter#prometheus-configuration
|
|
|
|
metrics_path: /probe
|
|
|
|
params:
|
|
|
|
module: [http_2xx] # Look for a HTTP 200 response
|
|
|
|
static_configs:
|
|
|
|
- targets:
|
|
|
|
- http://prometheus.io # Target to probe with http
|
|
|
|
- https://prometheus.io # Target to probe with https
|
|
|
|
- http://example.com:8080 # Target to probe with http on port 8080
|
|
|
|
relabel_configs:
|
|
|
|
- source_labels: [__address__]
|
|
|
|
target_label: __param_target
|
|
|
|
- source_labels: [__param_target]
|
|
|
|
target_label: instance
|
|
|
|
- target_label: __address__
|
|
|
|
replacement: '127.0.0.1:9115' # real hostname and port
|
|
|
|
|
|
|
|
pushgateway:
|
|
|
|
version: v0.8.0
|
|
|
|
archive:
|
|
|
|
source_hash: 6949866ba9ad0cb88d3faffd4281f17df79281398b4dbd0ec3aab300071681ca
|
|
|
|
service:
|
|
|
|
args:
|
|
|
|
web.listen-address: ":9091"
|
|
|
|
web.telemetry-path: "/metrics"
|
|
|
|
|
2020-11-12 11:53:16 +01:00
|
|
|
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
|
|
|
|
|
2020-11-12 14:32:14 +01:00
|
|
|
mysqld_exporter:
|
|
|
|
service:
|
|
|
|
env:
|
|
|
|
- 'DATA_SOURCE_NAME=foo:bar@/'
|
2020-05-14 01:27:23 +02:00
|
|
|
linux:
|
|
|
|
# 'Alternatives system' priority: zero disables (default)
|
|
|
|
# yamllint disable-line rule:braces
|
fix(pillar): fix `OverflowError: Range too big` -- `MAX_RANGE (100000)`
https://gitlab.com/myii/prometheus-formula/-/jobs/1077740890#L779
```
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/salt/utils/templates.py", line 501, in render_jinja_tmpl
output = template.render(**decoded_context)
File "/usr/local/lib/python3.8/dist-packages/jinja2/environment.py", line 1090, in render
self.environment.handle_exception()
File "/usr/local/lib/python3.8/dist-packages/jinja2/environment.py", line 832, in handle_exception
reraise(*rewrite_traceback_stack(source=source))
File "/usr/local/lib/python3.8/dist-packages/jinja2/_compat.py", line 28, in reraise
raise value.with_traceback(tb)
File "<template>", line 212, in top-level template code
File "/usr/local/lib/python3.8/dist-packages/jinja2/sandbox.py", line 462, in call
return __context.call(__obj, *args, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/jinja2/sandbox.py", line 173, in safe_range
raise OverflowError(
OverflowError: Range too big. The sandbox blocks ranges larger than MAX_RANGE (100000).
; line 212
---
[...]
skip_verify: true
linux:
# 'Alternatives system' priority: zero disables (default)
# yamllint disable-line rule:braces
altpriority: {{ range(1, 9100000) | random }} <======================
```
2021-03-07 01:44:31 +01:00
|
|
|
altpriority: {{ range(1, 100000) | random }}
|
2019-06-16 02:33:24 +02:00
|
|
|
|
2021-05-28 01:16:17 +02:00
|
|
|
# This dict lets you manage other config files (like the `rule_files` for the
|
|
|
|
# alertmanager) or split the config un multiple and organize files in meaninful ways
|
|
|
|
extra_files:
|
|
|
|
first_rules:
|
|
|
|
component: alertmanager
|
|
|
|
config:
|
|
|
|
groups:
|
|
|
|
- name: example
|
|
|
|
rules:
|
|
|
|
- alert: HighRequestLatency
|
|
|
|
expr: 'job:request_latency_seconds:mean5m{job="myjob"} > 0.5'
|
|
|
|
for: 10m
|
|
|
|
labels:
|
|
|
|
severity: page
|
|
|
|
annotations:
|
|
|
|
summary: High request latency
|
|
|
|
# You can specify a `file` parameter, which will be used to create a file
|
|
|
|
# under the prometheus config dir. In this example, the file will be
|
|
|
|
# named /etc/prometheus/subdir/second.yml
|
|
|
|
second_rules:
|
|
|
|
file: subdir/second
|
|
|
|
component: alertmanager
|
|
|
|
config:
|
|
|
|
groups:
|
|
|
|
- name: example
|
|
|
|
rules:
|
|
|
|
- alert: HighRequestLatency
|
|
|
|
expr: 'job:request_latency_seconds:mean5m{job="myjob"} > 0.5'
|
|
|
|
for: 10m
|
|
|
|
labels: {}
|
|
|
|
|
2019-04-24 18:18:44 +02:00
|
|
|
tofs:
|
|
|
|
# The files_switch key serves as a selector for alternative
|
|
|
|
# directories under the formula files directory. See TOFS pattern
|
2020-05-14 01:27:23 +02:00
|
|
|
# doc for more info
|
|
|
|
# Note: Any value not evaluated by `config.get` will be used literally
|
|
|
|
# This can be used to set custom paths, as many levels deep as required
|
2019-04-24 18:18:44 +02:00
|
|
|
files_switch:
|
|
|
|
- any/path/can/be/used/here
|
|
|
|
- id
|
|
|
|
- osfinger
|
|
|
|
- os
|
|
|
|
- os_family
|
2020-05-14 01:27:23 +02:00
|
|
|
# All aspects of path/file resolution are customisable using the options below
|
|
|
|
# This is unnecessary in most cases; there are sensible defaults
|
2019-04-24 18:18:44 +02:00
|
|
|
# path_prefix: prometheus_alt
|
|
|
|
# dirs:
|
|
|
|
# files: files_alt
|
|
|
|
# default: default_alt
|
2019-08-06 21:57:50 +02:00
|
|
|
source_files:
|
|
|
|
prometheus-config-file-file-managed:
|
|
|
|
- 'alt_config.yml.jinja'
|
2019-12-12 06:38:58 +01:00
|
|
|
prometheus-archive-install-managed-service:
|
|
|
|
- 'alt_systemd.ini.jinja'
|