Compare commits

...

2 Commits

Author SHA1 Message Date
241d5bd1a4 modificato conf alloy e compose x hostname in grafana 2025-12-01 17:41:24 +01:00
40f261489a proxy e keepalived rinominati per i log 2025-11-30 21:25:11 +01:00
4 changed files with 49 additions and 6 deletions

View File

@@ -63,10 +63,26 @@ prometheus.exporter.unix "host" {
rootfs_path = "/host/root"
}
// Relabel configuration for Prometheus metrics
prometheus.relabel "host_metrics" {
forward_to = [prometheus.remote_write.mimir.receiver]
rule {
source_labels = ["__address__"]
target_label = "instance"
replacement = "vm1"
}
rule {
target_label = "hostname"
replacement = "vm1"
}
}
// Scrape metrics from the unix exporter
prometheus.scrape "host" {
targets = prometheus.exporter.unix.host.targets
forward_to = [prometheus.remote_write.mimir.receiver]
forward_to = [prometheus.relabel.host_metrics.receiver]
}
// Write metrics to Mimir/Prometheus

View File

@@ -115,7 +115,7 @@ services:
haproxy:
image: haproxy:2.8-alpine
container_name: haproxy
container_name: haproxy-vm1
restart: unless-stopped
volumes:
- ./haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro
@@ -128,7 +128,7 @@ services:
logging: "alloy"
keepalived:
image: alpine:latest
container_name: keepalived
container_name: keepalived-vm1
restart: unless-stopped
cap_add:
- NET_ADMIN
@@ -138,12 +138,15 @@ services:
volumes:
- ./keepalived-master.conf:/etc/keepalived/keepalived.conf:ro
command: sh -c "apk add --no-cache keepalived && keepalived -n -D -l -f /etc/keepalived/keepalived.conf"
labels:
logging: "alloy"
alloy:
image: grafana/alloy:latest
container_name: alloy
restart: unless-stopped
environment:
TZ: Europe/Rome
HOSTNAME: vm1
volumes:
- ./alloy-config.alloy:/etc/alloy/config.alloy:ro
- /var/run/docker.sock:/var/run/docker.sock:ro
@@ -161,6 +164,8 @@ services:
- "12345:12345" # Alloy UI
networks:
- app-network
labels:
hostname: "vm1"
networks:
app-network:
volumes:

View File

@@ -63,10 +63,26 @@ prometheus.exporter.unix "host" {
rootfs_path = "/host/root"
}
// Relabel configuration for Prometheus metrics
prometheus.relabel "host_metrics" {
forward_to = [prometheus.remote_write.mimir.receiver]
rule {
source_labels = ["__address__"]
target_label = "instance"
replacement = "vm2"
}
rule {
target_label = "hostname"
replacement = "vm2"
}
}
// Scrape metrics from the unix exporter
prometheus.scrape "host" {
targets = prometheus.exporter.unix.host.targets
forward_to = [prometheus.remote_write.mimir.receiver]
forward_to = [prometheus.relabel.host_metrics.receiver]
}
// Write metrics to Mimir/Prometheus

View File

@@ -115,7 +115,7 @@ services:
haproxy:
image: haproxy:2.8-alpine
container_name: haproxy
container_name: haproxy-vm2
restart: unless-stopped
volumes:
- ./haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro
@@ -128,7 +128,7 @@ services:
logging: "alloy"
keepalived:
image: alpine:latest
container_name: keepalived
container_name: keepalived-vm2
restart: unless-stopped
cap_add:
- NET_ADMIN
@@ -138,12 +138,16 @@ services:
volumes:
- ./keepalived-backup.conf:/etc/keepalived/keepalived.conf:ro
command: sh -c "apk add --no-cache keepalived && keepalived -n -D -l -f /etc/keepalived/keepalived.conf"
labels:
logging: "alloy"
alloy:
image: grafana/alloy:latest
container_name: alloy
restart: unless-stopped
environment:
TZ: Europe/Rome
HOSTNAME: vm2
volumes:
- ./alloy-config.alloy:/etc/alloy/config.alloy:ro
- /var/run/docker.sock:/var/run/docker.sock:ro
@@ -161,6 +165,8 @@ services:
- "12345:12345" # Alloy UI
networks:
- app-network
labels:
hostname: "vm2"
networks:
app-network:
volumes: