2024-03-05 21:51:26 +00:00
|
|
|
{ lib, config, machines, ... }:
|
2024-03-05 19:56:00 +00:00
|
|
|
let
|
2024-03-05 21:51:26 +00:00
|
|
|
cfg = config.lab.monitoring;
|
|
|
|
|
2024-03-05 19:56:00 +00:00
|
|
|
status = code: "[STATUS] == ${toString code}";
|
|
|
|
bodyContains = text: "[BODY] == pat(*${text}*)";
|
|
|
|
maxResponseTime = ms: "[RESPONSE_TIME] < ${toString ms}";
|
2024-03-05 21:51:26 +00:00
|
|
|
|
|
|
|
machineEndpoints = lib.attrsets.mapAttrsToList
|
2024-04-13 13:43:01 +00:00
|
|
|
(name: machine: {
|
|
|
|
name = "Host ${name}";
|
|
|
|
url = "icmp://${name}.dmz";
|
|
|
|
conditions = [ "[RESPONSE_TIME] < 10" ];
|
|
|
|
})
|
2024-03-05 21:51:26 +00:00
|
|
|
machines;
|
|
|
|
|
|
|
|
otherEndpoints = [
|
2024-03-05 19:56:00 +00:00
|
|
|
{
|
|
|
|
name = "Forgejo";
|
|
|
|
url = "https://git.kun.is";
|
|
|
|
conditions = [
|
|
|
|
(status 200)
|
|
|
|
(bodyContains "Forgejo: Beyond coding. We forge.")
|
|
|
|
(maxResponseTime 750)
|
|
|
|
];
|
|
|
|
}
|
|
|
|
{
|
|
|
|
name = "Nextcloud";
|
|
|
|
url = "https://cloud.kun.is/status.php";
|
|
|
|
conditions = [
|
|
|
|
(status 200)
|
|
|
|
"[BODY].installed == true"
|
|
|
|
"[BODY].maintenance == false"
|
|
|
|
"[BODY].needsDbUpgrade == false"
|
2024-03-06 20:29:23 +00:00
|
|
|
(maxResponseTime 2000)
|
2024-03-05 19:56:00 +00:00
|
|
|
];
|
|
|
|
}
|
|
|
|
{
|
|
|
|
name = "Paperless-ngx";
|
|
|
|
url = "https://paperless.kun.is/accounts/login/";
|
|
|
|
conditions = [
|
|
|
|
(status 200)
|
|
|
|
(bodyContains "Please sign in.")
|
|
|
|
(maxResponseTime 750)
|
|
|
|
];
|
|
|
|
}
|
|
|
|
{
|
|
|
|
name = "Radicale";
|
|
|
|
url = "https://dav.kun.is/.web/";
|
|
|
|
conditions = [
|
|
|
|
(status 200)
|
|
|
|
(bodyContains "Login")
|
|
|
|
(maxResponseTime 750)
|
|
|
|
];
|
|
|
|
}
|
|
|
|
{
|
|
|
|
name = "FreshRSS";
|
|
|
|
url = "https://rss.kun.is/i/";
|
|
|
|
conditions = [
|
|
|
|
(status 200)
|
|
|
|
(bodyContains "Login")
|
|
|
|
(maxResponseTime 750)
|
|
|
|
];
|
|
|
|
}
|
|
|
|
{
|
|
|
|
name = "KitchenOwl";
|
|
|
|
url = "https://boodschappen.kun.is/signin";
|
|
|
|
conditions = [
|
|
|
|
(status 200)
|
|
|
|
(bodyContains "<title>KitchenOwl</title>")
|
|
|
|
(maxResponseTime 750)
|
|
|
|
];
|
|
|
|
}
|
|
|
|
{
|
|
|
|
name = "HedgeDoc";
|
|
|
|
url = "https://md.kun.is/";
|
|
|
|
conditions = [
|
|
|
|
(status 200)
|
|
|
|
(bodyContains "The best platform to write and share markdown.")
|
|
|
|
(maxResponseTime 750)
|
|
|
|
];
|
|
|
|
}
|
|
|
|
{
|
|
|
|
name = "Cyberchef";
|
|
|
|
url = "https://cyberchef.kun.is/";
|
|
|
|
conditions = [
|
|
|
|
(status 200)
|
|
|
|
(bodyContains "CyberChef - The Cyber Swiss Army Knife")
|
|
|
|
(maxResponseTime 750)
|
|
|
|
];
|
|
|
|
}
|
|
|
|
{
|
|
|
|
name = "Pi-hole";
|
|
|
|
url = "https://pihole.kun.is:444/admin/login.php";
|
|
|
|
conditions = [
|
|
|
|
(status 200)
|
|
|
|
(bodyContains "Log in")
|
|
|
|
(maxResponseTime 750)
|
|
|
|
];
|
|
|
|
}
|
|
|
|
{
|
|
|
|
name = "Inbucket";
|
|
|
|
url = "https://inbucket.kun.is:444/";
|
|
|
|
conditions = [
|
|
|
|
(status 200)
|
|
|
|
(bodyContains "<title>Inbucket</title>")
|
|
|
|
(maxResponseTime 750)
|
|
|
|
];
|
|
|
|
}
|
|
|
|
{
|
|
|
|
name = "kms";
|
|
|
|
url = "tcp://kms.kun.is:1688";
|
|
|
|
conditions = [
|
|
|
|
"[CONNECTED] == true"
|
|
|
|
];
|
|
|
|
}
|
|
|
|
{
|
|
|
|
name = "Bazarr";
|
|
|
|
url = "https://bazarr.kun.is:444/system/status";
|
|
|
|
conditions = [
|
|
|
|
(status 200)
|
|
|
|
(bodyContains "<title>Bazarr</title>")
|
|
|
|
(maxResponseTime 750)
|
|
|
|
];
|
|
|
|
}
|
|
|
|
{
|
|
|
|
name = "Sonarr";
|
|
|
|
url = "https://sonarr.kun.is:444/system/status";
|
|
|
|
conditions = [
|
|
|
|
(status 200)
|
|
|
|
(bodyContains "<title>Sonarr</title>")
|
|
|
|
(maxResponseTime 750)
|
|
|
|
];
|
|
|
|
}
|
|
|
|
{
|
|
|
|
name = "Radarr";
|
|
|
|
url = "https://radarr.kun.is:444/system/status";
|
|
|
|
conditions = [
|
|
|
|
(status 200)
|
|
|
|
(bodyContains "<title>Radarr</title>")
|
|
|
|
(maxResponseTime 750)
|
|
|
|
];
|
|
|
|
}
|
|
|
|
{
|
|
|
|
name = "Jellyfin";
|
|
|
|
url = "https://media.kun.is/web/index.html#!/login.html?";
|
|
|
|
conditions = [
|
|
|
|
(status 200)
|
|
|
|
(bodyContains "<title>Jellyfin</title>")
|
|
|
|
(maxResponseTime 750)
|
|
|
|
];
|
|
|
|
}
|
|
|
|
{
|
|
|
|
name = "Jellyseerr";
|
|
|
|
url = "https://jellyseerr.kun.is:444/login";
|
|
|
|
conditions = [
|
|
|
|
(status 200)
|
|
|
|
(bodyContains "Sign in to continue")
|
|
|
|
(maxResponseTime 750)
|
|
|
|
];
|
|
|
|
}
|
|
|
|
{
|
|
|
|
name = "Prowlarr";
|
|
|
|
url = "https://prowlarr.kun.is:444/system/status";
|
|
|
|
conditions = [
|
|
|
|
(status 200)
|
|
|
|
(bodyContains "<title>Prowlarr</title>")
|
|
|
|
(maxResponseTime 750)
|
|
|
|
];
|
|
|
|
}
|
|
|
|
{
|
|
|
|
name = "Transmission";
|
|
|
|
url = "https://transmission.kun.is:444/transmission/web/";
|
|
|
|
conditions = [
|
|
|
|
(status 200)
|
|
|
|
(bodyContains "Transmission Web Interface")
|
|
|
|
(maxResponseTime 750)
|
|
|
|
];
|
|
|
|
}
|
|
|
|
{
|
|
|
|
name = "Syncthing";
|
|
|
|
url = "https://sync.kun.is:444/";
|
|
|
|
conditions = [
|
|
|
|
(status 401)
|
|
|
|
(maxResponseTime 750)
|
|
|
|
];
|
|
|
|
}
|
|
|
|
{
|
|
|
|
name = "Traefik";
|
|
|
|
url = "https://traefik.kun.is:444/dashboard/#/";
|
|
|
|
conditions = [
|
|
|
|
(status 200)
|
|
|
|
(bodyContains "<title>Traefik</title>")
|
|
|
|
(maxResponseTime 750)
|
|
|
|
];
|
|
|
|
}
|
2024-03-05 21:51:26 +00:00
|
|
|
{
|
|
|
|
name = "BIND";
|
|
|
|
url = "192.168.30.7";
|
|
|
|
dns = {
|
|
|
|
query-type = "SOA";
|
|
|
|
query-name = "kun.is";
|
|
|
|
};
|
|
|
|
conditions = [
|
|
|
|
"[DNS_RCODE] == NOERROR"
|
|
|
|
];
|
|
|
|
}
|
|
|
|
{
|
|
|
|
name = "Pi-hole DNS";
|
|
|
|
url = "192.168.30.8";
|
|
|
|
dns = {
|
|
|
|
query-type = "SOA";
|
|
|
|
query-name = "kun.is";
|
|
|
|
};
|
|
|
|
conditions = [
|
|
|
|
"[DNS_RCODE] == NOERROR"
|
|
|
|
];
|
|
|
|
}
|
2024-03-05 19:56:00 +00:00
|
|
|
];
|
|
|
|
in
|
2024-03-05 21:51:26 +00:00
|
|
|
{
|
|
|
|
config = lib.mkIf cfg.server.enable {
|
|
|
|
services.gatus.settings.endpoints = map
|
|
|
|
(endpoint: endpoint // {
|
|
|
|
interval = "5m";
|
|
|
|
alerts = [{ type = "email"; }];
|
|
|
|
})
|
|
|
|
(machineEndpoints ++ otherEndpoints);
|
|
|
|
};
|
|
|
|
}
|