Add Prometeus Monitoring
This commit is contained in:
parent
19bd12f765
commit
5d1f750b59
4 changed files with 72 additions and 18 deletions
|
@ -6,6 +6,7 @@ services:
|
|||
networks:
|
||||
- web
|
||||
- grafana
|
||||
- monitoring
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.http.routers.grafana.rule=Host(`monitoring.${DOMAIN}`)"
|
||||
|
@ -29,7 +30,7 @@ services:
|
|||
- GF_DATABASE_NAME=grafana
|
||||
- GF_DATABASE_USER=${POSTGRES_USER}
|
||||
- GF_DATABASE_PASSWORD=${POSTGRES_PASSWORD}
|
||||
- GF_INSTALL_PLUGINS=flant-statusmap-panel
|
||||
- GF_INSTALL_PLUGINS=flant-statusmap-panel,redis-datasource
|
||||
depends_on:
|
||||
- influxdb
|
||||
- grafanadb
|
||||
|
@ -55,6 +56,8 @@ services:
|
|||
restart: unless-stopped
|
||||
networks:
|
||||
- web
|
||||
- monitoring
|
||||
- grafana
|
||||
environment:
|
||||
- INFLUXDB_MONITOR_STORE_ENABLED=false
|
||||
volumes:
|
||||
|
@ -72,6 +75,19 @@ services:
|
|||
- "docker.group=monitoring"
|
||||
|
||||
|
||||
prometheus:
|
||||
image: prom/prometheus
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
- grafana
|
||||
- monitoring
|
||||
- web # also used to get traefik metrics
|
||||
volumes:
|
||||
- ./prometheus.yml:/etc/prometheus/prometheus.yml
|
||||
- ${VOLUMES_PATH}/prometheus:/prometheus
|
||||
labels:
|
||||
- "docker.group=monitoring"
|
||||
|
||||
|
||||
##################################################################
|
||||
# here starts data collection
|
||||
|
@ -98,11 +114,10 @@ services:
|
|||
depends_on:
|
||||
- influxdb
|
||||
|
||||
|
||||
telegraf_net:
|
||||
image: telegraf:${TELEGRAF_VERSION}
|
||||
restart: unless-stopped
|
||||
env_file:
|
||||
- ./.env # set environments into container
|
||||
volumes:
|
||||
- ./telegraf_net.conf:/etc/telegraf/telegraf.conf:ro
|
||||
networks:
|
||||
|
@ -113,6 +128,7 @@ services:
|
|||
depends_on:
|
||||
- influxdb
|
||||
|
||||
|
||||
networks:
|
||||
grafana:
|
||||
monitoring:
|
||||
|
|
37
monitoring/prometheus.yml
Normal file
37
monitoring/prometheus.yml
Normal file
|
@ -0,0 +1,37 @@
|
|||
# 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: "traefik"
|
||||
scrape_interval: 5s
|
||||
static_configs:
|
||||
- targets: ["traefik:8080"]
|
||||
|
||||
- job_name: "grafana"
|
||||
static_configs:
|
||||
- targets: ["grafana:3000"]
|
|
@ -82,10 +82,7 @@
|
|||
# urls = ["udp://127.0.0.1:8089"]
|
||||
# urls = ["http://127.0.0.1:8086"]
|
||||
|
||||
## HTTP Basic Auth
|
||||
username = "${INFLUXDB_HTTP_BASIC_AUTH_USER}"
|
||||
password = "${INFLUXDB_HTTP_BASIC_AUTH_PASSWORD}"
|
||||
urls = ["https://influxdb.florianzirker.de"] # required
|
||||
urls = ["http://influxdb:8086"]
|
||||
|
||||
|
||||
###############################################################################
|
||||
|
|
|
@ -29,6 +29,10 @@ services:
|
|||
- "--certificatesresolvers.netcup.acme.dnschallenge.delayBeforeCheck=900"
|
||||
- "--certificatesresolvers.netcup.acme.email=${LETSENCRYPT_MAIL}"
|
||||
- "--certificatesresolvers.netcup.acme.storage=/letsencrypt/acme.json"
|
||||
- "--metrics.prometheus=true"
|
||||
- "--metrics.prometheus.addEntryPointsLabels=true"
|
||||
- "--metrics.prometheus.addRoutersLabels=true"
|
||||
- "--metrics.prometheus.addServicesLabels=true"
|
||||
ports:
|
||||
- "80:80"
|
||||
- "443:443"
|
||||
|
@ -65,17 +69,17 @@ services:
|
|||
privileged: true
|
||||
|
||||
|
||||
# whoami:
|
||||
# image: containous/whoami
|
||||
# networks:
|
||||
# - web
|
||||
# labels:
|
||||
# - "traefik.enable=true"
|
||||
# - "traefik.http.routers.whoami.rule=Host(`whoami.${DOMAIN}`)"
|
||||
# - "traefik.http.routers.whoami.entrypoints=websecure"
|
||||
# - "traefik.http.routers.whoami.tls.certresolver=netcup"
|
||||
# - "docker.group=proxy"
|
||||
# restart: unless-stopped
|
||||
whoami:
|
||||
image: containous/whoami
|
||||
networks:
|
||||
- web
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.http.routers.whoami.rule=Host(`whoami.${DOMAIN}`)"
|
||||
- "traefik.http.routers.whoami.entrypoints=websecure"
|
||||
- "traefik.http.routers.whoami.tls.certresolver=netcup"
|
||||
- "docker.group=proxy"
|
||||
restart: unless-stopped
|
||||
|
||||
|
||||
networks:
|
||||
|
|
Loading…
Reference in a new issue