From a010b652a32fd27dcb0a5fa6a7b1d5fc4c419c54 Mon Sep 17 00:00:00 2001 From: willemserruys Date: Mon, 21 Nov 2022 21:58:47 +0100 Subject: [PATCH] added grafana and prometheus --- configurations/prometheus/prometheus.yml | 15 +++++++++ home-server/.env | 6 ++++ home-server/docker-compose.yml | 40 ++++++++++++++++++++++++ 3 files changed, 61 insertions(+) create mode 100644 configurations/prometheus/prometheus.yml diff --git a/configurations/prometheus/prometheus.yml b/configurations/prometheus/prometheus.yml new file mode 100644 index 0000000..4be0808 --- /dev/null +++ b/configurations/prometheus/prometheus.yml @@ -0,0 +1,15 @@ +global: + scrape_interval: 1m + +scrape_configs: + - job_name: "prometheus" + scrape_interval: 1m + static_configs: + - targets: ["prometheus:9090"] + + - job_name: "node" + static_configs: + - targets: ["node-exporter:9100"] + - job_name: "pi_node" + static_configs: + - targets: ["10.55.8.1:9100"] diff --git a/home-server/.env b/home-server/.env index 62502c9..29cf304 100644 --- a/home-server/.env +++ b/home-server/.env @@ -8,3 +8,9 @@ MARIADB_ROOT_PASSWORD=testing MARIADB_DATABASE=homeassistant MARIADB_USER=homeassistant_user MARIADB_PASSWORD=homeassistant_pw + + +# Grafana settings +GF_SECURITY_ADMIN_USER=test +GF_SECURITY_ADMIN_PASSWORD=test +GF_USERS_ALLOW_SIGN_UP=false diff --git a/home-server/docker-compose.yml b/home-server/docker-compose.yml index 9a675a0..b6f8c60 100644 --- a/home-server/docker-compose.yml +++ b/home-server/docker-compose.yml @@ -36,3 +36,43 @@ services: - ${INTERNAL_IP}:22000:22000/udp - ${INTERNAL_IP}:21027:21027/udp restart: unless-stopped + node-exporter: + image: prom/node-exporter:latest + container_name: node-exporter + restart: unless-stopped + volumes: + - /proc:/host/proc:ro + - /sys:/host/sys:ro + - /:/rootfs:ro + command: + - '--path.procfs=/host/proc' + - '--path.rootfs=/rootfs' + - '--path.sysfs=/host/sys' + - '--collector.filesystem.mount-points-exclude=^/(sys|proc|dev|host|etc)($$|/)' + ports: + - 9100:9100 + prometheus: + image: prom/prometheus:latest + container_name: prometheus + restart: unless-stopped + volumes: + - /home/willem/repos/homeAutomation/configurations/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml + - /home/willem/prometheus:/prometheus + command: + - '--config.file=/etc/prometheus/prometheus.yml' + - '--storage.tsdb.path=/prometheus' + - '--web.console.libraries=/etc/prometheus/console_libraries' + - '--web.console.templates=/etc/prometheus/consoles' + - '--web.enable-lifecycle' + ports: + - 9090:9090 + grafana: + image: grafana/grafana:latest + environment: + env_file: + - .env + - .env.production + ports: + - 3000:3000 + volumes: + - /home/willem/grafana:/var/lib/grafana