mirror of
https://gitverse.ru/kpa39l/monitoring.git
synced 2026-09-29 09:55:09 +00:00
add blackbox-exporter, loki/promtail configs; fix prometheus: host network for WG access
This commit is contained in:
@@ -0,0 +1,7 @@
|
|||||||
|
modules:
|
||||||
|
http_2xx:
|
||||||
|
prober: http
|
||||||
|
timeout: 5s
|
||||||
|
http:
|
||||||
|
valid_status_codes: [200]
|
||||||
|
follow_redirects: true
|
||||||
+10
-4
@@ -14,10 +14,7 @@ services:
|
|||||||
- '--config.file=/etc/prometheus/prometheus.yml'
|
- '--config.file=/etc/prometheus/prometheus.yml'
|
||||||
- '--storage.tsdb.retention.time=30d'
|
- '--storage.tsdb.retention.time=30d'
|
||||||
- '--storage.tsdb.path=/prometheus'
|
- '--storage.tsdb.path=/prometheus'
|
||||||
ports:
|
network_mode: host
|
||||||
- "9090:9090"
|
|
||||||
networks:
|
|
||||||
- monitoring
|
|
||||||
|
|
||||||
grafana:
|
grafana:
|
||||||
image: grafana/grafana:11.1.0
|
image: grafana/grafana:11.1.0
|
||||||
@@ -65,6 +62,15 @@ services:
|
|||||||
networks:
|
networks:
|
||||||
- monitoring
|
- monitoring
|
||||||
|
|
||||||
|
blackbox-exporter:
|
||||||
|
image: prom/blackbox-exporter:v0.25.0
|
||||||
|
container_name: blackbox-exporter
|
||||||
|
restart: unless-stopped
|
||||||
|
command: --config.file=/etc/blackbox/blackbox.yml
|
||||||
|
volumes:
|
||||||
|
- ./blackbox.yml:/etc/blackbox/blackbox.yml:ro
|
||||||
|
network_mode: host
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
monitoring:
|
monitoring:
|
||||||
driver: bridge
|
driver: bridge
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
# Loki config (single-binary, local storage)
|
||||||
|
auth_enabled: false
|
||||||
|
|
||||||
|
server:
|
||||||
|
http_listen_port: 3100
|
||||||
|
|
||||||
|
common:
|
||||||
|
path_prefix: /loki
|
||||||
|
storage:
|
||||||
|
filesystem:
|
||||||
|
chunks_directory: /loki/chunks
|
||||||
|
rules_directory: /loki/rules
|
||||||
|
replication_factor: 1
|
||||||
|
ring:
|
||||||
|
kvstore:
|
||||||
|
store: inmemory
|
||||||
|
|
||||||
|
schema_config:
|
||||||
|
configs:
|
||||||
|
- from: 2024-01-01
|
||||||
|
store: tsdb
|
||||||
|
object_store: filesystem
|
||||||
|
schema: v13
|
||||||
|
index:
|
||||||
|
prefix: index_
|
||||||
|
period: 24h
|
||||||
|
|
||||||
|
limits_config:
|
||||||
|
retention_period: 168h # 7 дней
|
||||||
|
allow_structured_metadata: true
|
||||||
|
|
||||||
|
compactor:
|
||||||
|
working_directory: /loki/compactor
|
||||||
|
compaction_interval: 15m
|
||||||
+21
-7
@@ -8,7 +8,7 @@ rule_files:
|
|||||||
- /etc/prometheus/alerts.yml
|
- /etc/prometheus/alerts.yml
|
||||||
|
|
||||||
scrape_configs:
|
scrape_configs:
|
||||||
# Garage node metrics (admin API on WG)
|
# Garage node metrics (admin API on WG) — Bearer auth
|
||||||
- job_name: 'garage'
|
- job_name: 'garage'
|
||||||
metrics_path: /metrics
|
metrics_path: /metrics
|
||||||
scheme: http
|
scheme: http
|
||||||
@@ -20,16 +20,30 @@ scrape_configs:
|
|||||||
labels:
|
labels:
|
||||||
cluster: garage
|
cluster: garage
|
||||||
|
|
||||||
# Health check for each node (returns 200 if quorum OK)
|
# HTTP health probe via blackbox-exporter (returns probe_success)
|
||||||
- job_name: 'garage_health'
|
- job_name: 'garage_health'
|
||||||
metrics_path: /health
|
metrics_path: /probe
|
||||||
scheme: http
|
params:
|
||||||
|
module: [http_2xx]
|
||||||
static_configs:
|
static_configs:
|
||||||
- targets: ['10.8.0.1:3903', '10.8.0.2:3903', '10.8.0.4:3903']
|
- targets: ['http://10.8.0.1:3903/health']
|
||||||
labels:
|
labels:
|
||||||
cluster: garage
|
instance: vps01
|
||||||
|
- targets: ['http://10.8.0.2:3903/health']
|
||||||
|
labels:
|
||||||
|
instance: bigbox
|
||||||
|
- targets: ['http://10.8.0.4:3903/health']
|
||||||
|
labels:
|
||||||
|
instance: vps02
|
||||||
|
relabel_configs:
|
||||||
|
- source_labels: [__address__]
|
||||||
|
target_label: __param_target
|
||||||
|
- source_labels: [__param_target]
|
||||||
|
target_label: target
|
||||||
|
- target_label: __address__
|
||||||
|
replacement: 127.0.0.1:9115
|
||||||
|
|
||||||
# Node exporter on each host (system metrics)
|
# Node exporter on each host (system metrics via WG)
|
||||||
- job_name: 'node'
|
- job_name: 'node'
|
||||||
static_configs:
|
static_configs:
|
||||||
- targets: ['10.8.0.2:9100']
|
- targets: ['10.8.0.2:9100']
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
# Promtail config: docker-логи (garage и др.) + собственные логи vps01/vps02 через WG
|
||||||
|
server:
|
||||||
|
http_listen_port: 9080
|
||||||
|
grpc_listen_port: 0
|
||||||
|
|
||||||
|
positions:
|
||||||
|
filename: /tmp/positions.yaml
|
||||||
|
|
||||||
|
clients:
|
||||||
|
- url: http://loki:3100/loki/api/v1/push
|
||||||
|
|
||||||
|
scrape_configs:
|
||||||
|
# Логи docker-контейнеров на bigbox (garage и др.)
|
||||||
|
- job_name: docker
|
||||||
|
docker_sd_configs:
|
||||||
|
- host: unix:///var/run/docker.sock
|
||||||
|
refresh_interval: 15s
|
||||||
|
relabel_configs:
|
||||||
|
- source_labels: ['__meta_docker_container_name']
|
||||||
|
regex: '/(.*)'
|
||||||
|
target_label: 'container'
|
||||||
|
- source_labels: ['__meta_docker_container_log_stream']
|
||||||
|
target_label: 'stream'
|
||||||
Reference in New Issue
Block a user