mlaga97-nix/systems/fortress/gatus.nix
2025-08-10 15:29:23 -05:00

131 lines
4 KiB
Nix

{ ... } @ args: {
sops.secrets."dotspace/gatus.env".mode = "0664";
# TODO: https://github.com/NixOS/nixpkgs/issues/415877
disabledModules = [ "services/monitoring/gatus.nix" ];
imports = [ "${args.inputs.nixpkgs-unstable}/nixos/modules/services/monitoring/gatus.nix" ];
services.gatus = {
enable = true;
environmentFile = "/run/secrets/dotspace/gatus.env";
settings = {
web.port = 18255;
alerting = {
discord = {
webhook-url = "\${GATUS_DISCORD_WEBHOOK}";
default-alert = {
send-on-resolved = true;
description = "\${LAUREN_DISCORD_USERNAME}";
};
};
matrix = {
server-url = "https://matrix.mlaga97.space";
access-token = "\${GATUS_MATRIX_TOKEN}";
internal-room-id = "!hMdNLWZttBQomJhQOC:matrix.mlaga97.space";
default-alert = {
send-on-resolved = true;
description = "@mlaga97:matrix.mlaga97.space";
};
};
};
maintenance = {
start = "04:50";
duration = "30m";
timezone = "America/Chicago";
};
endpoints = [
{
name = "1 - Synapse";
group = "1 - Core Services";
url = "https://matrix.mlaga97.space/_matrix/federation/v1/version";
interval = "1m";
conditions = [
"[CONNECTED] == true"
"[STATUS] == 200"
"has([BODY].server.version) == true"
"[CERTIFICATE_EXPIRATION] > 48h"
];
alerts = [{ type = "discord"; }];
}
{
name = "2 - Home Assistant";
group = "1 - Core Services";
url = "https://homeassistant.mlaga97.space/api/webhook/-k9lg4u3J3_QLO6avhXNG4KZa";
interval = "1m";
conditions = [
"[CONNECTED] == true"
"[STATUS] == 200"
"[CERTIFICATE_EXPIRATION] > 48h"
];
alerts = [{ type = "matrix"; }];
}
{
name = "3 - Git";
group = "1 - Core Services";
url = "https://git.mlaga97.space/api/healthz";
interval = "1m";
conditions = [
"[CONNECTED] == true"
"[STATUS] == 200"
"[BODY].status == pass"
"[CERTIFICATE_EXPIRATION] > 48h"
];
alerts = [{ type = "matrix"; }];
}
{
name = "1 - redoubt.tinc.mlaga97.space";
group = "2 - Hosts";
url = "icmp://10.86.84.107";
interval = "1m";
conditions = [ "[CONNECTED] == true" ];
alerts = [{ type = "matrix"; }];
}
{
name = "2 - bastion.tinc.mlaga97.space";
group = "2 - Hosts";
url = "icmp://10.86.84.105";
interval = "1m";
conditions = [ "[CONNECTED] == true" ];
alerts = [{ type = "matrix"; }];
}
{
name = "3 - blockhouse.tinc.mlaga97.space";
group = "2 - Hosts";
url = "icmp://10.86.84.104";
interval = "1m";
conditions = [ "[CONNECTED] == true" ];
alerts = [{ type = "matrix"; }];
}
{
name = "2 - matrix.public.koshkee.com";
group = "3 - Federation";
url = "https://matrix.public.koshkee.com/_matrix/federation/v1/version";
interval = "1h";
conditions = [
"[CONNECTED] == true"
"[STATUS] == 200"
"has([BODY].server.version) == true"
"[CERTIFICATE_EXPIRATION] > 48h"
];
alerts = [{ type = "matrix"; }];
}
{
name = "1 - matrix.mlaga97.space";
group = "3 - Federation";
url = "https://federationtester.matrix.org/api/report?server_name=matrix.mlaga97.space";
interval = "1h";
conditions = [
"[CONNECTED] == true"
"[STATUS] == 200"
"[BODY].FederationOK == true"
"has([BODY].WellKnownResult.result) == false"
];
alerts = [{ type = "matrix"; }];
}
];
};
};
}