Don't ntfy for logrotate failures and add container names to ntfy alerts
This commit is contained in:
@@ -26,6 +26,12 @@
|
||||
default = [ ];
|
||||
description = "Unit names to skip failure notifications for.";
|
||||
};
|
||||
|
||||
hostLabel = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = config.networking.hostName;
|
||||
description = "Label used in ntfy alert titles to identify this host/container.";
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf config.thisMachine.hasRole."ntfy" {
|
||||
|
||||
@@ -32,7 +32,7 @@ in
|
||||
--max-time 30 --retry 3 \
|
||||
${cfg.curlExtraArgs} \
|
||||
-H "Authorization: Bearer $NTFY_TOKEN" \
|
||||
-H "Title: Service failure on ${config.networking.hostName}" \
|
||||
-H "Title: Service failure on ${cfg.hostLabel}" \
|
||||
-H "Priority: high" \
|
||||
-H "Tags: rotating_light" \
|
||||
-H "Message: Unit $unit failed at $(date +%c)" \
|
||||
|
||||
Reference in New Issue
Block a user