feat: Add Prometheus Unix exporter to Alloy for host metrics collection, update Docker Compose volumes, and enable Keepalived daemon mode.

This commit is contained in:
2025-11-24 22:18:51 +01:00
parent 8dfcef5eb2
commit 17fa8eb056
4 changed files with 62 additions and 16 deletions

View File

@@ -55,3 +55,23 @@ loki.write "loki" {
url = "http://192.168.1.200:3100/loki/api/v1/push"
}
}
// Collect system metrics
prometheus.exporter.unix "host" {
procfs_path = "/host/proc"
sysfs_path = "/host/sys"
rootfs_path = "/host/root"
}
// Scrape metrics from the unix exporter
prometheus.scrape "host" {
targets = prometheus.exporter.unix.host.targets
forward_to = [prometheus.remote_write.mimir.receiver]
}
// Write metrics to Mimir/Prometheus
prometheus.remote_write "mimir" {
endpoint {
url = "http://192.168.1.200:9090/api/v1/write"
}
}

View File

@@ -153,7 +153,7 @@ services:
network_mode: host
volumes:
- ./keepalived-master.conf:/etc/keepalived/keepalived.conf:ro
command: sh -c "apk add --no-cache keepalived && keepalived -n -l -f /etc/keepalived/keepalived.conf"
command: sh -c "apk add --no-cache keepalived && keepalived -n -D -l -f /etc/keepalived/keepalived.conf"
alloy:
image: grafana/alloy:latest
container_name: alloy
@@ -165,6 +165,9 @@ services:
- /var/run/docker.sock:/var/run/docker.sock:ro
- /etc/localtime:/etc/localtime:ro
- /etc/timezone:/etc/timezone:ro
- /proc:/host/proc:ro
- /sys:/host/sys:ro
- /:/host/root:ro
command:
- run
- --server.http.listen-addr=0.0.0.0:12345

View File

@@ -55,3 +55,23 @@ loki.write "loki" {
url = "http://192.168.1.200:3100/loki/api/v1/push"
}
}
// Collect system metrics
prometheus.exporter.unix "host" {
procfs_path = "/host/proc"
sysfs_path = "/host/sys"
rootfs_path = "/host/root"
}
// Scrape metrics from the unix exporter
prometheus.scrape "host" {
targets = prometheus.exporter.unix.host.targets
forward_to = [prometheus.remote_write.mimir.receiver]
}
// Write metrics to Mimir/Prometheus
prometheus.remote_write "mimir" {
endpoint {
url = "http://192.168.1.200:9090/api/v1/write"
}
}

View File

@@ -127,7 +127,7 @@ services:
network_mode: host
volumes:
- ./keepalived-backup.conf:/etc/keepalived/keepalived.conf:ro
command: sh -c "apk add --no-cache keepalived && keepalived -n -l -f /etc/keepalived/keepalived.conf"
command: sh -c "apk add --no-cache keepalived && keepalived -n -D -l -f /etc/keepalived/keepalived.conf"
alloy:
image: grafana/alloy:latest
container_name: alloy
@@ -139,6 +139,9 @@ services:
- /var/run/docker.sock:/var/run/docker.sock:ro
- /etc/localtime:/etc/localtime:ro
- /etc/timezone:/etc/timezone:ro
- /proc:/host/proc:ro
- /sys:/host/sys:ro
- /:/host/root:ro
command:
- run
- --server.http.listen-addr=0.0.0.0:12345