prometheus/documentation/examples/prometheus-puppetdb.yml
Julien Pivotto 8920024323 Add PuppetDB service discovery
We have been Puppet user for 10 years and we are users of
https://github.com/camptocamp/prometheus-puppetdb-sd

However, that file_sd implementation contains business logic and
assumptions around e.g. the modules which you are using.

This pull request adds a simple PuppetDB service discovery, which will
enable more use cases than the upstream sd.

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2021-09-16 16:54:26 +02:00

41 lines
1.5 KiB
YAML

# Prometheus example configuration to be used with PuppetDB.
scrape_configs:
- job_name: 'puppetdb-node-exporter'
puppetdb_sd_configs:
# This example discovers the nodes which have the class Prometheus::Node_exporter.
- url: https://puppetdb.example.com
query: 'resources { type = "Class" and title = "Prometheus::Node_exporter" }'
port: 9100
tls_config:
cert_file: prometheus-public.pem
key_file: prometheus-private.pem
ca_file: ca.pem
- job_name: 'puppetdb-scrape-jobs'
puppetdb_sd_configs:
# This example uses the Prometheus::Scrape_job
# exported resources.
# https://github.com/camptocamp/prometheus-puppetdb-sd
# This examples is compatible with Prometheus-puppetdb-sd,
# if the exported Prometheus::Scrape_job only have at most one target.
- url: https://puppetdb.example.com
query: 'resources { type = "Prometheus::Scrape_job" and exported = true }'
include_parameters: true
tls_config:
cert_file: prometheus-public.pem
key_file: prometheus-private.pem
ca_file: ca.pem
relabel_configs:
- source_labels: [__meta_puppetdb_certname]
target_label: certname
- source_labels: [__meta_puppetdb_parameter_targets]
regex: '(.+),?.*'
replacement: $1
target_label: __address__
- source_labels: [__meta_puppetdb_parameter_job_name]
target_label: job
- regex: '__meta_puppetdb_parameter_labels_(.+)'
replacement: '$1'
action: labelmap