Skip to content

Commit

Permalink
healthchecks
Browse files Browse the repository at this point in the history
  • Loading branch information
Czichy committed Dec 1, 2024
1 parent 31d7395 commit 037bd3b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions hosts/HL-1-MRZ-HOST-02/guests/vaultwarden.nix
Original file line number Diff line number Diff line change
Expand Up @@ -150,22 +150,22 @@ in {
services.restic.backups = let
ntfy_pass = "$(cat ${config.age.secrets.ntfy-alert-pass.path})";
ntfy_url = "https://${globals.services.ntfy-sh.domain}/backups";
pingKey = "$(cat ${config.age.secrets.vaultwarden-hc-ping.path})";
slug = "https://health.czichy.com/ping/${pingKey}";
slug = "https://health.czichy.com/ping/";

script-post = host: site: ''
pingKey="$(cat ${config.age.secrets.vaultwarden-hc-ping.path})"
if [ $EXIT_STATUS -ne 0 ]; then
${pkgs.curl}/bin/curl -u alert:${ntfy_pass} \
-H 'Title: Backup (${site}) on ${host} failed!' \
-H 'Tags: backup,restic,${host},${site}' \
-d "Restic (${site}) backup error on ${host}!" '${ntfy_url}'
${pkgs.curl}/bin/curl -m 10 --retry 5 --retry-connrefused "${slug}/backup-${site}/fail"
${pkgs.curl}/bin/curl -m 10 --retry 5 --retry-connrefused "${slug}$pingKey/backup-${site}/fail"
else
${pkgs.curl}/bin/curl -u alert:${ntfy_pass} \
-H 'Title: Backup (${site}) on ${host} successful!' \
-H 'Tags: backup,restic,${host},${site}' \
-d "Restic (${site}) backup success on ${host}!" '${ntfy_url}'
${pkgs.curl}/bin/curl -m 10 --retry 5 --retry-connrefused "${slug}/backup-${site}"
${pkgs.curl}/bin/curl -m 10 --retry 5 --retry-connrefused "${slug}$pingKey/backup-${site}"
fi
'';
in {
Expand Down
8 changes: 4 additions & 4 deletions modules/nixos/services/monitoring/uptime-kuma.nix
Original file line number Diff line number Diff line change
Expand Up @@ -145,22 +145,22 @@ in {
services.restic.backups = let
ntfy_pass = "$(cat ${config.age.secrets.ntfy-alert-pass.path})";
ntfy_url = "https://${globals.services.ntfy-sh.domain}/backups";
pingKey = "$(cat ${config.age.secrets.uptime-hc-ping.path})";
slug = "https://health.czichy.com/ping/${pingKey}";
slug = "https://health.czichy.com/ping/";

script-post = host: site: ''
pingKey="$(cat ${config.age.secrets.uptime-hc-ping.path})";
if [ $EXIT_STATUS -ne 0 ]; then
${pkgs.curl}/bin/curl -u alert:${ntfy_pass} \
-H 'Title: Backup (${site}) on ${host} failed!' \
-H 'Tags: backup,restic,${host},${site}' \
-d "Restic (${site}) backup error on ${host}!" '${ntfy_url}'
${pkgs.curl}/bin/curl -m 10 --retry 5 --retry-connrefused "${slug}/backup-${site}/fail"
${pkgs.curl}/bin/curl -m 10 --retry 5 --retry-connrefused "${slug}$pingKey/backup-${site}/fail"
else
${pkgs.curl}/bin/curl -u alert:${ntfy_pass} \
-H 'Title: Backup (${site}) on ${host} successful!' \
-H 'Tags: backup,restic,${host},${site}' \
-d "Restic (${site}) backup success on ${host}!" '${ntfy_url}'
${pkgs.curl}/bin/curl -m 10 --retry 5 --retry-connrefused "${slug}/backup-${site}"
${pkgs.curl}/bin/curl -m 10 --retry 5 --retry-connrefused "${slug}$pingKey/backup-${site}"
fi
'';
in {
Expand Down

0 comments on commit 037bd3b

Please sign in to comment.