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:
@@ -55,3 +55,23 @@ loki.write "loki" {
|
|||||||
url = "http://192.168.1.200:3100/loki/api/v1/push"
|
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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ services:
|
|||||||
ports:
|
ports:
|
||||||
- "3306:3306"
|
- "3306:3306"
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "root", "-p${MYSQL_ROOT_PASSWORD:-Ase@2025}"]
|
test: [ "CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "root", "-p${MYSQL_ROOT_PASSWORD:-Ase@2025}" ]
|
||||||
interval: 10s
|
interval: 10s
|
||||||
timeout: 5s
|
timeout: 5s
|
||||||
retries: 3
|
retries: 3
|
||||||
@@ -29,7 +29,7 @@ services:
|
|||||||
build: .
|
build: .
|
||||||
container_name: orchestrator-1-load
|
container_name: orchestrator-1-load
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
command: ["python", "-m", "src.load_orchestrator"]
|
command: [ "python", "-m", "src.load_orchestrator" ]
|
||||||
environment:
|
environment:
|
||||||
DB_HOST: ${VIP:-192.168.1.210}
|
DB_HOST: ${VIP:-192.168.1.210}
|
||||||
ORCHESTRATOR_ID: 1
|
ORCHESTRATOR_ID: 1
|
||||||
@@ -46,7 +46,7 @@ services:
|
|||||||
build: .
|
build: .
|
||||||
container_name: orchestrator-2-elab
|
container_name: orchestrator-2-elab
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
command: ["python", "-m", "src.elab_orchestrator"]
|
command: [ "python", "-m", "src.elab_orchestrator" ]
|
||||||
environment:
|
environment:
|
||||||
DB_HOST: ${VIP:-192.168.1.210}
|
DB_HOST: ${VIP:-192.168.1.210}
|
||||||
ORCHESTRATOR_ID: 2
|
ORCHESTRATOR_ID: 2
|
||||||
@@ -63,7 +63,7 @@ services:
|
|||||||
build: .
|
build: .
|
||||||
container_name: orchestrator-3-send
|
container_name: orchestrator-3-send
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
command: ["python", "-m", "src.send_orchestrator"]
|
command: [ "python", "-m", "src.send_orchestrator" ]
|
||||||
environment:
|
environment:
|
||||||
DB_HOST: ${VIP:-192.168.1.210}
|
DB_HOST: ${VIP:-192.168.1.210}
|
||||||
ORCHESTRATOR_ID: 3
|
ORCHESTRATOR_ID: 3
|
||||||
@@ -80,7 +80,7 @@ services:
|
|||||||
build: .
|
build: .
|
||||||
container_name: ftp-server-1
|
container_name: ftp-server-1
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
command: ["python", "-m", "src.ftp_csv_receiver"]
|
command: [ "python", "-m", "src.ftp_csv_receiver" ]
|
||||||
environment:
|
environment:
|
||||||
DB_HOST: ${VIP:-192.168.1.210}
|
DB_HOST: ${VIP:-192.168.1.210}
|
||||||
FTP_INSTANCE_ID: 1
|
FTP_INSTANCE_ID: 1
|
||||||
@@ -107,7 +107,7 @@ services:
|
|||||||
build: .
|
build: .
|
||||||
container_name: sftp-server-1
|
container_name: sftp-server-1
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
command: ["python", "-m", "src.ftp_csv_receiver"]
|
command: [ "python", "-m", "src.ftp_csv_receiver" ]
|
||||||
environment:
|
environment:
|
||||||
DB_HOST: ${VIP:-192.168.1.210}
|
DB_HOST: ${VIP:-192.168.1.210}
|
||||||
FTP_INSTANCE_ID: 11
|
FTP_INSTANCE_ID: 11
|
||||||
@@ -153,7 +153,7 @@ services:
|
|||||||
network_mode: host
|
network_mode: host
|
||||||
volumes:
|
volumes:
|
||||||
- ./keepalived-master.conf:/etc/keepalived/keepalived.conf:ro
|
- ./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:
|
alloy:
|
||||||
image: grafana/alloy:latest
|
image: grafana/alloy:latest
|
||||||
container_name: alloy
|
container_name: alloy
|
||||||
@@ -165,13 +165,16 @@ services:
|
|||||||
- /var/run/docker.sock:/var/run/docker.sock:ro
|
- /var/run/docker.sock:/var/run/docker.sock:ro
|
||||||
- /etc/localtime:/etc/localtime:ro
|
- /etc/localtime:/etc/localtime:ro
|
||||||
- /etc/timezone:/etc/timezone:ro
|
- /etc/timezone:/etc/timezone:ro
|
||||||
|
- /proc:/host/proc:ro
|
||||||
|
- /sys:/host/sys:ro
|
||||||
|
- /:/host/root:ro
|
||||||
command:
|
command:
|
||||||
- run
|
- run
|
||||||
- --server.http.listen-addr=0.0.0.0:12345
|
- --server.http.listen-addr=0.0.0.0:12345
|
||||||
- --storage.path=/var/lib/alloy/data
|
- --storage.path=/var/lib/alloy/data
|
||||||
- /etc/alloy/config.alloy
|
- /etc/alloy/config.alloy
|
||||||
ports:
|
ports:
|
||||||
- "12345:12345" # Alloy UI
|
- "12345:12345" # Alloy UI
|
||||||
networks:
|
networks:
|
||||||
- app-network
|
- app-network
|
||||||
networks:
|
networks:
|
||||||
|
|||||||
@@ -55,3 +55,23 @@ loki.write "loki" {
|
|||||||
url = "http://192.168.1.200:3100/loki/api/v1/push"
|
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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ services:
|
|||||||
build: .
|
build: .
|
||||||
container_name: orchestrator-4-load
|
container_name: orchestrator-4-load
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
command: ["python", "-m", "src.load_orchestrator"]
|
command: [ "python", "-m", "src.load_orchestrator" ]
|
||||||
environment:
|
environment:
|
||||||
DB_HOST: ${VIP:-192.168.1.210}
|
DB_HOST: ${VIP:-192.168.1.210}
|
||||||
ORCHESTRATOR_ID: 4
|
ORCHESTRATOR_ID: 4
|
||||||
@@ -20,7 +20,7 @@ services:
|
|||||||
build: .
|
build: .
|
||||||
container_name: orchestrator-5-elab
|
container_name: orchestrator-5-elab
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
command: ["python", "-m", "src.elab_orchestrator"]
|
command: [ "python", "-m", "src.elab_orchestrator" ]
|
||||||
environment:
|
environment:
|
||||||
DB_HOST: ${VIP:-192.168.1.210}
|
DB_HOST: ${VIP:-192.168.1.210}
|
||||||
ORCHESTRATOR_ID: 5
|
ORCHESTRATOR_ID: 5
|
||||||
@@ -37,7 +37,7 @@ services:
|
|||||||
build: .
|
build: .
|
||||||
container_name: orchestrator-6-send
|
container_name: orchestrator-6-send
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
command: ["python", "-m", "src.send_orchestrator"]
|
command: [ "python", "-m", "src.send_orchestrator" ]
|
||||||
environment:
|
environment:
|
||||||
DB_HOST: ${VIP:-192.168.1.210}
|
DB_HOST: ${VIP:-192.168.1.210}
|
||||||
ORCHESTRATOR_ID: 6
|
ORCHESTRATOR_ID: 6
|
||||||
@@ -54,7 +54,7 @@ services:
|
|||||||
build: .
|
build: .
|
||||||
container_name: ftp-server-2
|
container_name: ftp-server-2
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
command: ["python", "-m", "src.ftp_csv_receiver"]
|
command: [ "python", "-m", "src.ftp_csv_receiver" ]
|
||||||
environment:
|
environment:
|
||||||
DB_HOST: ${VIP:-192.168.1.210}
|
DB_HOST: ${VIP:-192.168.1.210}
|
||||||
FTP_INSTANCE_ID: 2
|
FTP_INSTANCE_ID: 2
|
||||||
@@ -81,7 +81,7 @@ services:
|
|||||||
build: .
|
build: .
|
||||||
container_name: sftp-server-2
|
container_name: sftp-server-2
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
command: ["python", "-m", "src.ftp_csv_receiver"]
|
command: [ "python", "-m", "src.ftp_csv_receiver" ]
|
||||||
environment:
|
environment:
|
||||||
DB_HOST: ${VIP:-192.168.1.210}
|
DB_HOST: ${VIP:-192.168.1.210}
|
||||||
FTP_INSTANCE_ID: 12
|
FTP_INSTANCE_ID: 12
|
||||||
@@ -102,7 +102,7 @@ services:
|
|||||||
- "22:22"
|
- "22:22"
|
||||||
labels:
|
labels:
|
||||||
logging: "alloy"
|
logging: "alloy"
|
||||||
|
|
||||||
haproxy:
|
haproxy:
|
||||||
image: haproxy:2.8-alpine
|
image: haproxy:2.8-alpine
|
||||||
container_name: haproxy
|
container_name: haproxy
|
||||||
@@ -127,7 +127,7 @@ services:
|
|||||||
network_mode: host
|
network_mode: host
|
||||||
volumes:
|
volumes:
|
||||||
- ./keepalived-backup.conf:/etc/keepalived/keepalived.conf:ro
|
- ./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:
|
alloy:
|
||||||
image: grafana/alloy:latest
|
image: grafana/alloy:latest
|
||||||
container_name: alloy
|
container_name: alloy
|
||||||
@@ -139,13 +139,16 @@ services:
|
|||||||
- /var/run/docker.sock:/var/run/docker.sock:ro
|
- /var/run/docker.sock:/var/run/docker.sock:ro
|
||||||
- /etc/localtime:/etc/localtime:ro
|
- /etc/localtime:/etc/localtime:ro
|
||||||
- /etc/timezone:/etc/timezone:ro
|
- /etc/timezone:/etc/timezone:ro
|
||||||
|
- /proc:/host/proc:ro
|
||||||
|
- /sys:/host/sys:ro
|
||||||
|
- /:/host/root:ro
|
||||||
command:
|
command:
|
||||||
- run
|
- run
|
||||||
- --server.http.listen-addr=0.0.0.0:12345
|
- --server.http.listen-addr=0.0.0.0:12345
|
||||||
- --storage.path=/var/lib/alloy/data
|
- --storage.path=/var/lib/alloy/data
|
||||||
- /etc/alloy/config.alloy
|
- /etc/alloy/config.alloy
|
||||||
ports:
|
ports:
|
||||||
- "12345:12345" # Alloy UI
|
- "12345:12345" # Alloy UI
|
||||||
networks:
|
networks:
|
||||||
- app-network
|
- app-network
|
||||||
networks:
|
networks:
|
||||||
|
|||||||
Reference in New Issue
Block a user