diff --git a/nixos/flake.nix b/nixos/flake.nix index d0a2fe31..97bc8bf9 100644 --- a/nixos/flake.nix +++ b/nixos/flake.nix @@ -33,6 +33,7 @@ modules = [ ({ config, pkgs, ... }: { nixpkgs.overlays = [ overlay-unstable ]; }) ./hosts/chewbacca + (import "${nixpkgs-unstable}/nixos/modules/services/monitoring/gatus.nix") home-manager.nixosModules.home-manager { home-manager.useGlobalPkgs = true; diff --git a/nixos/hosts/chewbacca/default.nix b/nixos/hosts/chewbacca/default.nix index 04377204..367874ad 100644 --- a/nixos/hosts/chewbacca/default.nix +++ b/nixos/hosts/chewbacca/default.nix @@ -4,6 +4,7 @@ imports = [ ./hardware-configuration.nix + ./../../services/gatus.nix ./../../services/glances.nix ./../../services/jellyfin.nix ./../../services/music-assistant.nix diff --git a/nixos/services/gatus.nix b/nixos/services/gatus.nix new file mode 100644 index 00000000..d96805f6 --- /dev/null +++ b/nixos/services/gatus.nix @@ -0,0 +1,28 @@ +{ config, pkgs, ... }: + +let + tailscaleDevices = [ + { hostname = "chewbacca"; address = "100.110.122.14"; } + { hostname = "luffy"; address = "100.118.93.10"; } + ]; +in +{ + services.gatus = { + enable = true; + openFirewall = true; + settings = { + endpoints = map (device: + { + name = device.hostname; + url = "icmp://${device.address}"; + interval = "5m"; + conditions = [ + "[CONNECTED] == true" + ]; + } + ) tailscaleDevices; + }; + }; + + systemd.services.gatus.serviceConfig.AmbientCapabilities = "CAP_NET_RAW"; +} diff --git a/nixos/services/traefik/dynamic.yaml b/nixos/services/traefik/dynamic.yaml index 1abe26d0..5a121d35 100644 --- a/nixos/services/traefik/dynamic.yaml +++ b/nixos/services/traefik/dynamic.yaml @@ -36,6 +36,10 @@ http: - adminprefix service: pihole + gatus: + rule: "Host(`gatus.hallstrom.duckdns.org`)" + service: gatus + middlewares: sslheader: headers: @@ -81,3 +85,8 @@ http: loadBalancer: servers: - url: "http://192.168.1.24" + + gatus: + loadBalancer: + servers: + - url: "http://192.168.1.49:8080"