From 879b700e3e8dc6713ea1543e9003013ed3eb05b7 Mon Sep 17 00:00:00 2001 From: BhasherBEL Date: Wed, 17 May 2023 11:33:08 +0200 Subject: [PATCH] Monitoring optimization --- bxl-rpi/apps/docker-compose.smarthome.yaml | 19 ++++++++++++++ bxl-rpi/config/dashy/config.yml | 26 +++++++++++++++++-- bxl-rpi/config/monitoring/prometheus.yaml | 7 +---- bxl-rpi/system/docker-compose.monitoring.yaml | 13 +++++++++- 4 files changed, 56 insertions(+), 9 deletions(-) diff --git a/bxl-rpi/apps/docker-compose.smarthome.yaml b/bxl-rpi/apps/docker-compose.smarthome.yaml index 0824aaa..9e78724 100644 --- a/bxl-rpi/apps/docker-compose.smarthome.yaml +++ b/bxl-rpi/apps/docker-compose.smarthome.yaml @@ -46,6 +46,25 @@ services: networks: - smarthome + nodered: + container_name: nodered + restart: on-failure + image: nodered/node-red:latest + volumes: + - $DATA/nodered:/data + networks: + - smarthome + - external + labels: + - "traefik.enable=true" + - "traefik.http.routers.nodered.rule=Host(`nodered.bhasher.com`)" + - "traefik.http.routers.nodered.entrypoints=internalsecure" + - "traefik.http.services.nodered.loadbalancer.server.port=1880" + - "traefik.http.routers.nodered.tls=true" + - "traefik.http.routers.nodered.tls.certresolver=http" + - "traefik.http.routers.nodered.middlewares=authelia@docker" + + networks: smarthome: external: diff --git a/bxl-rpi/config/dashy/config.yml b/bxl-rpi/config/dashy/config.yml index 929fd74..7b391e2 100644 --- a/bxl-rpi/config/dashy/config.yml +++ b/bxl-rpi/config/dashy/config.yml @@ -26,11 +26,11 @@ sections: url: https://jellyfin.bhasher.com statusCheckUrl: http://jellyfin:8096 id: 0_1507_jellyfin - - title: Autheli + - title: Authelia icon: hl-authelia url: https://idp.bhasher.com statusCheckUrl: http://authelia:9091 - id: 1_1507_autheli + id: 1_1507_authelia - title: Mealie icon: hl-mealie url: https://mealie.bhasher.com @@ -122,6 +122,16 @@ sections: icon: hl-portainer url: https://portainer.lln.bhasher.com id: 12_1631_portainerlln + - title: Home assistant + icon: hl-home-assistant + url: https://hass.bhasher.com + statusCheckUrl: http://hass:8123 + id: 13_1631_homeassistant + - title: Node-red + icon: hl-node-red + url: https://nodered.bhasher.com + statusCheckUrl: http://nodered:1880 + id: 14_1631_nodered - name: System services displayData: sortBy: most-used @@ -199,6 +209,12 @@ sections: hostname: http://pihole apiKey: '' id: 0_1062_piholestats + displayData: + sortBy: default + rows: 1 + cols: 2 + collapsed: false + hideForGuests: false - name: Random widgets: - type: joke @@ -210,3 +226,9 @@ sections: options: comic: random id: 1_609_xkcdcomic + displayData: + sortBy: default + rows: 1 + cols: 2 + collapsed: false + hideForGuests: false diff --git a/bxl-rpi/config/monitoring/prometheus.yaml b/bxl-rpi/config/monitoring/prometheus.yaml index 1ad847e..0150e83 100644 --- a/bxl-rpi/config/monitoring/prometheus.yaml +++ b/bxl-rpi/config/monitoring/prometheus.yaml @@ -1,5 +1,5 @@ global: - scrape_interval: 15s # By default, scrape targets every 15 seconds. + scrape_interval: 30s # By default, scrape targets every 15 seconds. # Attach these labels to any time series or alerts when communicating with # external systems (federation, remote storage, Alertmanager). @@ -11,7 +11,6 @@ global: scrape_configs: # The job name is added as a label `job=` to any timeseries scraped from this config. - job_name: 'prometheus' - scrape_interval: 5s static_configs: - targets: ['localhost:9090'] @@ -20,21 +19,17 @@ scrape_configs: - targets: ["host.docker.internal:9323"] - job_name: 'cadvisor' - scrape_interval: 15s static_configs: - targets: ['cadvisor:8080'] - job_name: 'node-exporter' - scrape_interval: 15s static_configs: - targets: ['node-exporter:9100'] - job_name: 'treafik' - scrape_interval: 15s static_configs: - targets: ['traefik:8080'] - job_name: 'authelia' - scrape_interval: 15s static_configs: - targets: ['authelia:9959'] diff --git a/bxl-rpi/system/docker-compose.monitoring.yaml b/bxl-rpi/system/docker-compose.monitoring.yaml index bc70391..7e7ce96 100644 --- a/bxl-rpi/system/docker-compose.monitoring.yaml +++ b/bxl-rpi/system/docker-compose.monitoring.yaml @@ -3,6 +3,7 @@ services: container_name: prometheus image: prom/prometheus:latest restart: unless-stopped + user: root labels: - "traefik.enable=true" - "traefik.http.routers.prom.rule=Host(`prometheus.bhasher.com`)" @@ -66,15 +67,25 @@ services: cadvisor: container_name: cadvisor - image: gcr.io/cadvisor/cadvisor:v0.47.1 + image: gcr.io/cadvisor/cadvisor:v0.47.0 #v0.47.1 volumes: - /:/rootfs:ro - /var/run:/var/run:rw - /sys:/sys:ro - /var/lib/docker/:/var/lib/docker:ro restart: always + command: + - "--housekeeping_interval=30s" + - "--docker_only=true" + - "--disable_metrics=percpu,sched,tcp,udp,disk,diskIO,hugetlb,referenced_memory,cpu_topology,resctrl" networks: - monitoring + healthcheck: + test: wget --quiet --tries=1 --spider http://localhost:8080/healthz || exit 1 + interval: 15s + timeout: 15s + retries: 5 + start_period: 30s node-exporter: container_name: node-exporter