~sumner/nixos-configuration

0743dfde9ffadcda388bc355eead5392845e2af4 — Sumner Evans a month ago 55bd733
healthcheck: improve reliability of check

* Run it every 30 seconds to reduce false-positive notifications
* Enforce using IPv4 since I've disabled IPv6 on servers
* Use a 5 second timeout in curl
1 files changed, 11 insertions(+), 2 deletions(-)

M modules/services/healthcheck.nix
M modules/services/healthcheck.nix => modules/services/healthcheck.nix +11 -2
@@ 14,9 14,18 @@ in
  config = mkIf healthcheckCfg.enable {
    systemd.services.healthcheck = {
      description = "Healthcheck service";
      startAt = "*:0/1"; # Run a ping every minute to ensure that the server is up.
      startAt = "*:*:0/30"; # Send a healthcheck ping every 30 seconds.
      serviceConfig = {
        ExecStart = "${pkgs.curl}/bin/curl -fsS --retry 10 https://hc-ping.com/${healthcheckCfg.checkId}";
        ExecStart = ''
          ${pkgs.curl}/bin/curl \
            --verbose \
            -fsS \
            --retry 2 \
            --max-time 5 \
            --ipv4 \
            https://hc-ping.com/${healthcheckCfg.checkId}
        '';
        TimeoutSec = 10;
      };
    };
  };