modificato conf alloy e compose x hostname in grafana
This commit is contained in:
@@ -63,10 +63,26 @@ prometheus.exporter.unix "host" {
|
|||||||
rootfs_path = "/host/root"
|
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
|
// Scrape metrics from the unix exporter
|
||||||
prometheus.scrape "host" {
|
prometheus.scrape "host" {
|
||||||
targets = prometheus.exporter.unix.host.targets
|
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
|
// Write metrics to Mimir/Prometheus
|
||||||
|
|||||||
@@ -146,6 +146,7 @@ services:
|
|||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
environment:
|
environment:
|
||||||
TZ: Europe/Rome
|
TZ: Europe/Rome
|
||||||
|
HOSTNAME: vm1
|
||||||
volumes:
|
volumes:
|
||||||
- ./alloy-config.alloy:/etc/alloy/config.alloy:ro
|
- ./alloy-config.alloy:/etc/alloy/config.alloy:ro
|
||||||
- /var/run/docker.sock:/var/run/docker.sock:ro
|
- /var/run/docker.sock:/var/run/docker.sock:ro
|
||||||
@@ -163,6 +164,8 @@ services:
|
|||||||
- "12345:12345" # Alloy UI
|
- "12345:12345" # Alloy UI
|
||||||
networks:
|
networks:
|
||||||
- app-network
|
- app-network
|
||||||
|
labels:
|
||||||
|
hostname: "vm1"
|
||||||
networks:
|
networks:
|
||||||
app-network:
|
app-network:
|
||||||
volumes:
|
volumes:
|
||||||
|
|||||||
@@ -63,10 +63,26 @@ prometheus.exporter.unix "host" {
|
|||||||
rootfs_path = "/host/root"
|
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
|
// Scrape metrics from the unix exporter
|
||||||
prometheus.scrape "host" {
|
prometheus.scrape "host" {
|
||||||
targets = prometheus.exporter.unix.host.targets
|
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
|
// Write metrics to Mimir/Prometheus
|
||||||
|
|||||||
@@ -147,6 +147,7 @@ services:
|
|||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
environment:
|
environment:
|
||||||
TZ: Europe/Rome
|
TZ: Europe/Rome
|
||||||
|
HOSTNAME: vm2
|
||||||
volumes:
|
volumes:
|
||||||
- ./alloy-config.alloy:/etc/alloy/config.alloy:ro
|
- ./alloy-config.alloy:/etc/alloy/config.alloy:ro
|
||||||
- /var/run/docker.sock:/var/run/docker.sock:ro
|
- /var/run/docker.sock:/var/run/docker.sock:ro
|
||||||
@@ -164,6 +165,8 @@ services:
|
|||||||
- "12345:12345" # Alloy UI
|
- "12345:12345" # Alloy UI
|
||||||
networks:
|
networks:
|
||||||
- app-network
|
- app-network
|
||||||
|
labels:
|
||||||
|
hostname: "vm2"
|
||||||
networks:
|
networks:
|
||||||
app-network:
|
app-network:
|
||||||
volumes:
|
volumes:
|
||||||
|
|||||||
Reference in New Issue
Block a user