Prometheus instance label control
Jump to navigation
Jump to search
https://www.robustperception.io/controlling-the-instance-label/
https://prometheus.io/docs/guides/multi-target-exporter/
https://www.robustperception.io/checking-if-ssh-is-responding-with-prometheus/
wget https://github.com/prometheus/prometheus/releases/download/v2.0.0/prometheus-2.0.0.linux-amd64.tar.gz tar -xzf prometheus-*.tar.gz cd prometheus-* cat <<'EOF' > prometheus.yml global: scrape_interval: 10s scrape_configs: - job_name: 'blackbox' metrics_path: /probe params: module: [ssh_banner] static_configs: - targets: - 127.0.0.1 # Targets to probe relabel_configs: # Ensure port is 22, pass as URL parameter - source_labels: [__address__] regex: (.*?)(:.*)? replacement: ${1}:22 target_label: __param_target # Make instance label the target - source_labels: [__param_target] target_label: instance # Actually talk to the blackbox exporter though - target_label: __address__ replacement: 127.0.0.1:9115 EOF ./prometheus
https://valyala.medium.com/how-to-use-relabeling-in-prometheus-and-victoriametrics-8b90fc22c4b2 https://www.robustperception.io/controlling-the-instance-label/
https://grafana.com/blog/2022/03/21/how-relabeling-in-prometheus-works/
https://medium.com/geekculture/single-prometheus-job-for-dozens-of-blackbox-exporters-2a7ba492d6c8
https://prometheus.io/blog/2015/06/01/advanced-service-discovery/