Prometheus docker-compose
docker compose prometheus
version: '3.3'
services:
prometheus:
ports:
- '9093:9090'
image: prom/prometheus
volumes:
- /mnt/koa-02/prometheus:/etc/prometheus
deploy:
mode: global
placement:
constraints: [node.hostname == EVA-02]
Les dernières images sont disponibles sur le site officiel Docker Hub, accessibles via ce lien : Prometheus
Fichier de scraping prometheus.yml
# my global config
global:
scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
# scrape_timeout is set to the global default (10s).
# Alertmanager configuration
alerting:
alertmanagers:
- static_configs:
- targets:
# - alertmanager:9093
# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
rule_files:
# - "first_rules.yml"
# - "second_rules.yml"
# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
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: 'docker-eva-00-netdata-scrape'
metrics_path: '/api/v1/allmetrics'
params:
# format: prometheus | prometheus_all_hosts
# You can use `prometheus_all_hosts` if you want Prometheus to set the `instance` to your hostname instead of IP
format: [prometheus]
#
# source: as-collected | raw | average | sum | volume
# default is: average
#source: [as-collected]
#
# server name for this prometheus - the default is the client IP
# for Netdata to uniquely identify it
#server: ['prometheus1']
honor_labels: true
static_configs:
- targets: ['XXX.XXX.XXX.XXX:19999']
#################################################################################################
- job_name: 'docker_eva-01-netdata-scrape'
metrics_path: '/api/v1/allmetrics'
params:
# format: prometheus | prometheus_all_hosts
# You can use `prometheus_all_hosts` if you want Prometheus to set the `instance` to your hostname instead of IP
format: [prometheus]
#
# source: as-collected | raw | average | sum | volume
# default is: average
#source: [as-collected]
#
# server name for this prometheus - the default is the client IP
# for Netdata to uniquely identify it
#server: ['prometheus1']
honor_labels: true
static_configs:
- targets: ['XXX.XXX.XXX.XXX:19999']
#################################################################################################
- job_name: 'docker_eva-02-netdata-scrape'
metrics_path: '/api/v1/allmetrics'
params:
# format: prometheus | prometheus_all_hosts
# You can use `prometheus_all_hosts` if you want Prometheus to set the `instance` to your hostname instead of IP
format: [prometheus]
#
# source: as-collected | raw | average | sum | volume
# default is: average
#source: [as-collected]
#
# server name for this prometheus - the default is the client IP
# for Netdata to uniquely identify it
#server: ['prometheus1']
honor_labels: true
static_configs:
- targets: ['XXX.XXX.XXX.XXX:19999']
#################################################################################################
- job_name: 'nextcloud-netdata-scrape'
metrics_path: '/api/v1/allmetrics'
params:
# format: prometheus | prometheus_all_hosts
# You can use `prometheus_all_hosts` if you want Prometheus to set the `instance` to your hostname instead of IP
format: [prometheus]
#
# source: as-collected | raw | average | sum | volume
# default is: average
#source: [as-collected]
#
# server name for this prometheus - the default is the client IP
# for Netdata to uniquely identify it
#server: ['prometheus1']
honor_labels: true
static_configs:
- targets: ['XXX.XXX.XXX.XXX:19999']
#################################################################################################
- job_name: 'Storage-koa-01-netdata-scrape'
metrics_path: '/api/v1/allmetrics'
params:
# format: prometheus | prometheus_all_hosts
# You can use `prometheus_all_hosts` if you want Prometheus to set the `instance` to your hostname instead of IP
format: [prometheus]
#
# source: as-collected | raw | average | sum | volume
# default is: average
#source: [as-collected]
#
# server name for this prometheus - the default is the client IP
# for Netdata to uniquely identify it
#server: ['prometheus1']
honor_labels: true
static_configs:
- targets: ['XXX.XXX.XXX.XXX:19999']
#################################################################################################
- job_name: 'Storage-koa-02-netdata-scrape'
metrics_path: '/api/v1/allmetrics'
params:
# format: prometheus | prometheus_all_hosts
# You can use `prometheus_all_hosts` if you want Prometheus to set the `instance` to your hostname instead of IP
format: [prometheus]
#
# source: as-collected | raw | average | sum | volume
# default is: average
#source: [as-collected]
#
# server name for this prometheus - the default is the client IP
# for Netdata to uniquely identify it
#server: ['prometheus1']
honor_labels: true
static_configs:
- targets: ['XXX.XXX.XXX.XXX:19999']
#################################################################################################
- job_name: 'cadvisor-docker-eva-02-scrape'
metrics_path: '/metrics'
scheme: http
#params:
# format: prometheus | prometheus_all_hosts
# You can use `prometheus_all_hosts` if you want Prometheus to set the `instance` to your hostname instead of IP
#format: [prometheus]
#
# source: as-collected | raw | average | sum | volume
# default is: average
#source: [as-collected]
#
# server name for this prometheus - the default is the client IP
# for Netdata to uniquely identify it
#server: ['prometheus1']
#honor_labels: true
static_configs:
- targets: ['XXX.XXX.XXX.XXX:8489']
relabel_configs:
- separator: ;
regex: (.*)
target_label: instance
replacement: cadvisor-docker-eva-02
action: replace
#################################################################################################
- job_name: 'cadvisor-docker-eva-01-scrape'
metrics_path: '/metrics'
scheme: http
#params:
# format: prometheus | prometheus_all_hosts
# You can use `prometheus_all_hosts` if you want Prometheus to set the `instance` to your hostname instead of IP
#format: [prometheus]
#
# source: as-collected | raw | average | sum | volume
# default is: average
#source: [as-collected]
#
# server name for this prometheus - the default is the client IP
# for Netdata to uniquely identify it
#server: ['prometheus1']
#honor_labels: true
static_configs:
- targets: ['XXX.XXX.XXX.XXX:8488']
relabel_configs:
- separator: ;
regex: (.*)
target_label: instance
replacement: cadvisor-docker-eva-01
action: replace
#################################################################################################
- job_name: 'cadvisor-docker-eva-00-scrape'
metrics_path: '/metrics'
scheme: http
#params:
# format: prometheus | prometheus_all_hosts
# You can use `prometheus_all_hosts` if you want Prometheus to set the `instance` to your hostname instead of IP
#format: [prometheus]
#
# source: as-collected | raw | average | sum | volume
# default is: average
#source: [as-collected]
#
# server name for this prometheus - the default is the client IP
# for Netdata to uniquely identify it
#server: ['prometheus1']
#honor_labels: true
static_configs:
- targets: ['XXX.XXX.XXX.XXX:8487']
relabel_configs:
- separator: ;
regex: (.*)
target_label: instance
replacement: cadvisor-docker-eva-00
action: replace
#################################################################################################
- job_name: 'OPNSense'
metrics_path: '/metrics'
scheme: http
#params:
# format: prometheus | prometheus_all_hosts
# You can use `prometheus_all_hosts` if you want Prometheus to set the `instance` to your hostname instead of IP
#format: [prometheus]
#
# source: as-collected | raw | average | sum | volume
# default is: average
#source: [as-collected]
#
# server name for this prometheus - the default is the client IP
# for Netdata to uniquely identify it
#server: ['prometheus1']
#honor_labels: true
static_configs:
- targets: ['XXX.XXX.XXX.XXX:9100']
#relabel_configs:
# - separator: ;
# regex: (.*)
# target_label: instance
# replacement: cadvisor-docker-minion-4
#################################################################################################
- job_name: 'uptime'
scrape_interval: 30s
scheme: http
metrics_path: '/metrics'
static_configs:
- targets: ['XXX.XXX.XXX.XXX:3001']
basic_auth: # Only needed if authentication is enabled (default)
username: XXXXXXXX
password: XXXXXXXX
#################################################################################################