Compare commits

...
Author SHA1 Message Date
Tower e6c78597f6 add: docker ps 2026-09-06 19:51:27 +02:00
Tower d8f857ab9e init 2026-08-27 10:12:46 +02:00
4 changed files with 164 additions and 1 deletions

No files matched your search

+36
View File
@@ -0,0 +1,36 @@
# /data/PROMETHEUS/config/prometheus.yml
global:
scrape_interval: 15s
scrape_configs:
- job_name: 'prometheus'
static_configs:
- targets: ['localhost:9090']
# Webserver
- job_name: 'node_exporter_webserver'
static_configs:
- targets: ['152.53.159.169:8008']
- job_name: 'cadvisor_exporter_webserver'
static_configs:
- targets: ['152.53.159.169:8009']
# Mail Server
- job_name: 'node_exporter_mailu'
static_configs:
- targets: ['159.195.49.220:8008']
- job_name: 'cadvisor_exporter_mailu'
static_configs:
- targets: ['159.195.49.220:8009']
# Game Server
- job_name: 'node_exporter_minecraft'
static_configs:
- targets: ['152.53.162.220:8008']
- job_name: 'cadvisor_exporter_minecraft'
static_configs:
- targets: ['152.53.162.220:8009']
+7 -1
View File
@@ -37,7 +37,7 @@ frontend https
acl valid_method method PUT DELETE GET POST HEAD PATCH acl valid_method method PUT DELETE GET POST HEAD PATCH
http-request deny if !valid_method http-request deny if !valid_method
acl is_trusted src 178.19.224.210 80.153.174.251 153.92.79.159 acl is_trusted src 178.19.224.210 80.153.174.251 153.92.79.159 152.53.159.169 159.195.49.220 152.53.162.220
stick-table type ip size 100k expire 30s store http_req_rate(60s) stick-table type ip size 100k expire 30s store http_req_rate(60s)
@@ -54,10 +54,12 @@ frontend https
acl is_portainer hdr(host) -i portainer.mrhossa.de acl is_portainer hdr(host) -i portainer.mrhossa.de
acl is_homarr hdr(host) -i homarr.mrhossa.de acl is_homarr hdr(host) -i homarr.mrhossa.de
acl is_vaultwarden hdr(host) -i vaultwarden.mrhossa.de acl is_vaultwarden hdr(host) -i vaultwarden.mrhossa.de
acl is_grafana hdr(host) -i grafana.mrhossa.de
http-request deny if is_jenkins !is_trusted http-request deny if is_jenkins !is_trusted
http-request deny if is_portainer !is_trusted http-request deny if is_portainer !is_trusted
http-request deny if is_homarr !is_trusted http-request deny if is_homarr !is_trusted
http-request deny if is_grafana !is_trusted
use_backend web_public if is_public use_backend web_public if is_public
use_backend web_backend if is_backend use_backend web_backend if is_backend
@@ -67,6 +69,7 @@ frontend https
use_backend web_vaultwarden if is_vaultwarden use_backend web_vaultwarden if is_vaultwarden
use_backend web_portainer if is_portainer use_backend web_portainer if is_portainer
use_backend web_homarr if is_homarr use_backend web_homarr if is_homarr
use_backend web_grafana if is_grafana
use_backend stats if is_stats use_backend stats if is_stats
default_backend web_public default_backend web_public
@@ -97,6 +100,9 @@ backend web_portainer
backend web_homarr backend web_homarr
server homarr 152.53.159.169:8006 check server homarr 152.53.159.169:8006 check
backend web_grafana
server grafana 152.53.159.169:8007 check
backend stats backend stats
stats enable stats enable
stats uri / stats uri /
+51
View File
@@ -115,6 +115,52 @@ docker_remove() {
log_success "Loeschen abgeschlossen" log_success "Loeschen abgeschlossen"
} }
docker_list() {
local NAME_W=18
local IMAGE_W=20
local STATUS_W=10
local name image status ports
local short_image short_status short_ports host_ports
printf "%-${NAME_W}.${NAME_W}s %-${IMAGE_W}.${IMAGE_W}s %-${STATUS_W}.${STATUS_W}s %s\n" \
"NAME" "IMAGE" "STATUS" "PORTS"
docker ps --format '{{.Names}}'$'\x1f''{{.Image}}'$'\x1f''{{.Status}}'$'\x1f''{{.Ports}}' |
while IFS=$'\x1f' read -r name image status ports; do
short_image=$(sed -E 's#^.*/##' <<<"$image")
short_status=$(sed -E \
-e 's/^Up //' \
-e 's/^Exited \(([0-9]+)\)/exit \1,/' \
-e 's/ \(healthy\)/ ok/' \
-e 's/ \(unhealthy\)/ !!/' \
-e 's/ \(health: starting\)/ ../' \
-e 's/ seconds?/s/g' \
-e 's/ minutes?/m/g' \
-e 's/ hours?/h/g' \
-e 's/ days?/d/g' \
-e 's/ weeks?/w/g' \
-e 's/ months?/mo/g' \
-e 's/ ago//' <<<"$status")
host_ports=$( (grep -oE ':[0-9]+->' <<<"$ports" || true) | (grep -oE '[0-9]+' || true) | sort -un | paste -sd, - )
if [[ -n "$host_ports" ]]; then
short_ports="$host_ports"
elif [[ -n "$ports" ]]; then
short_ports="(intern)"
else
short_ports="-"
fi
printf "%-${NAME_W}.${NAME_W}s %-${IMAGE_W}.${IMAGE_W}s %-${STATUS_W}.${STATUS_W}s %s\n" \
"$name" "$short_image" "$short_status" "$short_ports"
done
}
######################################## ########################################
# CLI # CLI
######################################## ########################################
@@ -148,6 +194,10 @@ case "$ACTION" in
docker_recreate "$TARGET" docker_recreate "$TARGET"
;; ;;
list)
docker_list
;;
*) *)
echo "Usage:" echo "Usage:"
echo " $0 up <container|all>" echo " $0 up <container|all>"
@@ -156,6 +206,7 @@ case "$ACTION" in
echo " $0 remove <container|all>" echo " $0 remove <container|all>"
echo " $0 restart <container|all>" echo " $0 restart <container|all>"
echo " $0 recreate <container|all>" echo " $0 recreate <container|all>"
echo " $0 list"
exit 1 exit 1
;; ;;
esac esac
+70
View File
@@ -180,6 +180,76 @@ services:
- "50000:50000" - "50000:50000"
restart: always restart: always
prometheus:
image: prom/prometheus:latest
container_name: prometheus
volumes:
- ./CONFIGS/PROMETHEUS/:/etc/prometheus
- ./PROMETHEUS/:/prometheus
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--storage.tsdb.path=/prometheus'
- '--storage.tsdb.retention.time=30d'
networks:
docker-net:
ipv4_address: 172.30.0.20
ports:
- "127.0.0.1:9090:9090"
restart: always
node-exporter:
image: prom/node-exporter:latest
container_name: node_exporter
volumes:
- /proc:/host/proc:ro
- /sys:/host/sys:ro
- /:/rootfs:ro
command:
- '--path.procfs=/host/proc'
- '--path.sysfs=/host/sys'
- '--path.rootfs=/rootfs'
- '--collector.filesystem.mount-points-exclude=^/(sys|proc|dev|host|etc)($$|/)'
networks:
docker-net:
ipv4_address: 172.30.0.21
ports:
- "8008:9100"
restart: always
cadvisor:
image: gcr.io/cadvisor/cadvisor:latest
container_name: cadvisor
volumes:
- /:/rootfs:ro
- /var/run:/var/run:ro
- /sys:/sys:ro
- /var/lib/docker/:/var/lib/docker:ro
- /dev/disk/:/dev/disk:ro
networks:
docker-net:
ipv4_address: 172.30.0.22
ports:
- "8009:8080"
restart: always
# Falls auf dem Host cgroup v2 läuft und Metriken fehlen/leer sind,
# zusätzlich privileged: true setzen und /dev/kmsg:/dev/kmsg mounten.
grafana:
image: grafana/grafana:latest
container_name: grafana
environment:
- GF_SECURITY_ADMIN_USER=bruno
- GF_SECURITY_ADMIN_PASSWORD=svHBaMujp0c7ZE5065
- GF_USERS_ALLOW_SIGN_UP=false
volumes:
- ./GRAFANA/data:/var/lib/grafana
ports:
- "8007:3000"
networks:
docker-net:
ipv4_address: 172.30.0.23
restart: always
networks: networks:
docker-net: docker-net:
driver: bridge driver: bridge