From b89c6a14ccf56bf9cf0139ca3e729ed93aa85ca4 Mon Sep 17 00:00:00 2001 From: blake Date: Sun, 12 Oct 2025 15:35:14 -0500 Subject: [PATCH] add uptime kuma integration --- flake.nix | 2 +- modules/homelab/services/glance/default.nix | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/flake.nix b/flake.nix index 62d5e7e..2015db0 100644 --- a/flake.nix +++ b/flake.nix @@ -1,6 +1,6 @@ # flake for blakes nixos config # define new devices in outputs -# generation: 366, timestamp: 2025-10-12 15:30:09 +# generation: 367, timestamp: 2025-10-12 15:34:36 { description = "blakes nix config"; inputs = { diff --git a/modules/homelab/services/glance/default.nix b/modules/homelab/services/glance/default.nix index ebb457b..ca5941d 100644 --- a/modules/homelab/services/glance/default.nix +++ b/modules/homelab/services/glance/default.nix @@ -21,6 +21,9 @@ let cfg = config.modules.services.${service}; sec = config.sops.secrets; homelab = config.modules.homelab; + + uptimekuma_url = "localhost:7901"; + uptimekuma_page = "glance"; in { options.modules.services.${service} = { @@ -165,11 +168,11 @@ in { type = "custom-api"; title = "uptime"; - title-url = "127.0.0.1:7901"; - url = "127.0.0.1:7901/api/status-page/glance"; - subrequests = {heartbeats = {url = "127.0.0.1:7901/api/status-page/heartbeat/glance";};}; + title-url = "\${uptimekuma_url}"; + url = "\${uptimekuma_url}/api/status-page/\${uptimekuma_page}"; + subrequests = {heartbeats = {url = "\${uptimekuma_url}/api/status-page/heartbeat/\${uptimekuma_page}";};}; cache = "10m"; - template = "{{ $hb := .Subrequest \"heartbeats\" }}\n\n{{ if not (.JSON.Exists \"publicGroupList\") }}\n

Error reading response

\n{{ else if eq (len (.JSON.Array \"publicGroupList\")) 0 }}\n

No monitors found

\n{{ else }}\n\n\n{{ end }}\n"; + template = "{{ $hb := .Subrequest \"heartbeats\" }}\n\n{{ if not (.JSON.Exists \"publicGroupList\") }}\n

Error reading response

\n{{ else if eq (len (.JSON.Array \"publicGroupList\")) 0 }}\n

No monitors found

\n{{ else }}\n\n\n{{ end }}\n"; } { type = "markets";