Add prometheus

This commit is contained in:
Aykhan Shahsuvarov 2025-04-11 00:41:27 +04:00
parent d2789c07aa
commit 98faa391f0
3 changed files with 68 additions and 0 deletions

2
prometheus/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
/data/*
!/data/config

View File

@ -0,0 +1,18 @@
global:
scrape_interval: 10s
scrape_configs:
- job_name: "node_exporter"
scrape_interval: 2s
static_configs:
- targets: ["node_exporter:9100"]
- job_name: "cadvisor"
scrape_interval: 2s
static_configs:
- targets: ["cadvisor:8080"]
- job_name: caddy
scrape_interval: 2s
static_configs:
- targets: ["caddy:2019"]

View File

@ -0,0 +1,48 @@
networks:
prometheus:
external: false
grafana:
name: grafana
driver: bridge
external: true
services:
prometheus:
image: prom/prometheus:v3.2.1
container_name: prometheus
networks:
- prometheus
- grafana
command: "--config.file=/etc/prometheus/prometheus.yaml --storage.tsdb.retention.time=10d storage.tsdb.retention.size=5GB"
volumes:
- ./data/config/prometheus.yaml:/etc/prometheus/prometheus.yaml:ro
- prometheus-data:/prometheus
node_exporter:
image: quay.io/prometheus/node-exporter:v1.9.1
container_name: node_exporter
networks:
- prometheus
command:
- "--path.rootfs=/host"
pid: host
volumes:
- "/:/host:ro,rslave"
cadvisor:
image: gcr.io/cadvisor/cadvisor:v0.49.1
container_name: cadvisor
networks:
- prometheus
volumes:
- "/:/rootfs:ro"
- "/var/run:/var/run:ro"
- "/sys:/sys:ro"
- "/var/lib/docker/:/var/lib/docker:ro"
- "/dev/disk/:/dev/disk:ro"
privileged: true
devices:
- "/dev/kmsg:/dev/kmsg"
volumes:
prometheus-data: