From b1d7d64030f4301007bae24e7c2fa77d25f4ab7e Mon Sep 17 00:00:00 2001 From: Ingolf Wagner Date: Tue, 17 Mar 2020 15:00:57 +0800 Subject: [PATCH] on-failure: on all machines now --- configs/sterni/configuration.nix | 16 ---------------- configs/workhorse/configuration.nix | 12 ++++++++++++ modules/system/on-failure.nix | 2 +- system/all/default.nix | 1 + system/all/on-failure.nix | 17 +++++++++++++++++ 5 files changed, 31 insertions(+), 17 deletions(-) create mode 100644 system/all/on-failure.nix diff --git a/configs/sterni/configuration.nix b/configs/sterni/configuration.nix index 0018434..dc0e739 100644 --- a/configs/sterni/configuration.nix +++ b/configs/sterni/configuration.nix @@ -18,22 +18,6 @@ system.custom.wifi.interfaces = [ "wlp3s0" ]; - on-failure = { - url = lib.fileContents ; - enable = true; - plans = { - tinc_private.name = "tinc.private"; - tinc_retiolum.name = "tinc.retiolum"; - sshd.name = "sshd"; - tor.name = "tor"; - dnsmasq.name = "dnsmasq"; - backup_on_workhorse.name = "backup.on-workhorse.private"; - backup_on_workout.name = "backup.on-workout.private"; - backup_on_porani.name = "backup.on-porani.private"; - syncthing.name = "syncthing"; - }; - }; - security.wrappers = { pmount.source = "${pkgs.pmount}/bin/pmount"; pumount.source = "${pkgs.pmount}/bin/pumount"; diff --git a/configs/workhorse/configuration.nix b/configs/workhorse/configuration.nix index 4125635..cf501ec 100644 --- a/configs/workhorse/configuration.nix +++ b/configs/workhorse/configuration.nix @@ -27,6 +27,18 @@ ./mattermost.nix ]; + # todo: add this to each file instead summing that here + on-failure.plans = { + gogs.name = "gogs"; + jenkins.name = "jenkins"; + graylog.name = "graylog"; + prometheus.name = "prometheus"; + taskserver.name = "taskserver"; + weechat.name = "weechat"; + transmission.name = "transmission"; + mail-fetcher.name = "fetchmail"; + }; + networking.hostName = "workhorse"; # enable initrd ssh diff --git a/modules/system/on-failure.nix b/modules/system/on-failure.nix index b2c546b..91800da 100644 --- a/modules/system/on-failure.nix +++ b/modules/system/on-failure.nix @@ -51,7 +51,7 @@ let --include \ --request POST \ --data-urlencode \ - 'payload={"text": "Service Failed ${plan.name} on ${config.networking.hostName}"}' \ + 'payload={"text": " :fire: Service Failed ${plan.name} on ${config.networking.hostName}"}' \ ${cfg.url} ''; diff --git a/system/all/default.nix b/system/all/default.nix index 75b2abe..22af533 100644 --- a/system/all/default.nix +++ b/system/all/default.nix @@ -25,6 +25,7 @@ ./sshd.nix ./syncthing.nix ./tinc.nix + ./on-failure.nix ]; diff --git a/system/all/on-failure.nix b/system/all/on-failure.nix new file mode 100644 index 0000000..ca1f626 --- /dev/null +++ b/system/all/on-failure.nix @@ -0,0 +1,17 @@ +{ lib, ... }: { + on-failure = { + url = lib.fileContents ; + enable = true; + plans = { + tinc_private.name = "tinc.private"; + tinc_retiolum.name = "tinc.retiolum"; + sshd.name = "sshd"; + tor.name = "tor"; + dnsmasq.name = "dnsmasq"; + backup_on_workhorse.name = "backup.on-workhorse.private"; + backup_on_workout.name = "backup.on-workout.private"; + backup_on_porani.name = "backup.on-porani.private"; + syncthing.name = "syncthing"; + }; + }; +}