diff --git a/lxc-metrics.nix b/lxc-metrics.nix index f5db0ef..207ec9e 100644 --- a/lxc-metrics.nix +++ b/lxc-metrics.nix @@ -28,8 +28,10 @@ 192.168.0.100 unifi ''; - networking.firewall.allowedTCPPorts = [ 3000 ]; - + networking.firewall.allowedTCPPorts = [ + 3000 # grafana + 3001 # uptime-kuma + ]; services.grafana = { enable = true; settings = { @@ -153,6 +155,13 @@ ]; }; + services.uptime-kuma = { + enable = true; + settings = { + HOST = "0.0.0.0"; + }; + }; + services.borgbackup.jobs.grafana = { paths = [ "/var/lib/grafana/data/grafana.db" ]; archiveBaseName = null; @@ -161,6 +170,11 @@ repo = "ssh://backup@xalicas/./grafana"; compression = "auto,zstd"; startAt = "daily"; + postHook = '' + if [ $exitStatus -eq 0 ]; then + curl -sSL http://metrics01:3001/api/push/LmyyAawLzw?status=up&msg=OK&ping= + fi + ''; }; }; } diff --git a/vm-homelab.nix b/vm-homelab.nix index 8810cbf..d2d900b 100644 --- a/vm-homelab.nix +++ b/vm-homelab.nix @@ -14,9 +14,9 @@ in ip4 = "192.168.0.5"; }; - # environment.systemPackages = with pkgs; [ - # - # ]; + environment.systemPackages = with pkgs; [ + curl + ]; networking.firewall.allowedTCPPorts = [ 80 @@ -47,6 +47,9 @@ in "metrics.dukeceph.xyz".extraConfig = '' reverse_proxy http://192.168.0.6:3000 ''; + "uptime.rperce.net".extraConfig = '' + reverse_proxy 192.168.0.6:3001 + ''; "jellyfin.rperce.net".extraConfig = '' reverse_proxy http://192.168.0.2:8096 ''; @@ -99,6 +102,12 @@ in repo = "ssh://backup@xalicas/./miniflux"; compression = "auto,zstd"; startAt = "daily"; + postHook = '' + echo "exit $exitStatus" + if [ $exitStatus -eq 0 ]; then + /run/current-system/sw/bin/curl -sSL http://192.168.0.6:3001/api/push/yTBTVZF8Bz?status=up&msg=OK&ping= + fi + ''; }; }; }