diff options
author | sterni <sternenseemann@systemli.org> | 2024-11-17T15·49+0100 |
---|---|---|
committer | clbot <clbot@tvl.fyi> | 2024-11-18T11·21+0000 |
commit | bbfffa3fdd1f508d204d89b5b69d29c82143f2f8 (patch) | |
tree | 717316d13ecbafd06a6066d0e01247376968ce09 /users | |
parent | a2848751bda46ba409b91591a57cf88e90276f95 (diff) |
refactor(sterni/ingeborg/monitoring): simplify mkIrcMessager r/8935
I want to add a warpper script to the mdmonitor program anyways, so there's not really a point in this. Change-Id: I92166bd44b54507b782a8d19b9676d91d8fa0f99 Reviewed-on: https://cl.tvl.fyi/c/depot/+/12802 Tested-by: BuildkiteCI Reviewed-by: sterni <sternenseemann@systemli.org> Autosubmit: sterni <sternenseemann@systemli.org>
Diffstat (limited to 'users')
-rw-r--r-- | users/sterni/machines/ingeborg/monitoring.nix | 29 |
1 files changed, 9 insertions, 20 deletions
diff --git a/users/sterni/machines/ingeborg/monitoring.nix b/users/sterni/machines/ingeborg/monitoring.nix index 6244bc5e88ce..f4a347047130 100644 --- a/users/sterni/machines/ingeborg/monitoring.nix +++ b/users/sterni/machines/ingeborg/monitoring.nix @@ -6,15 +6,11 @@ let builtins.replaceStrings [ ":" ] [ "" ] config.services.depot.irccat.config.tcp.listen; - mkIrcMessager = - { name - , msgExpr - }: - pkgs.writeShellScript name '' - set -euo pipefail - printf '%s %s\n' ${lib.escapeShellArg ircChannel} ${msgExpr} | \ - ${lib.getBin pkgs.netcat-openbsd}/bin/nc -N localhost ${irccatPort} - ''; + send-irc-msg = pkgs.writeShellScript "send-irc-msg" '' + set -euo pipefail + printf '%s %s\n' ${lib.escapeShellArg ircChannel} "$1" | \ + ${lib.getBin pkgs.netcat-openbsd}/bin/nc -N localhost ${irccatPort} + ''; netdataPort = 19999; in @@ -32,11 +28,9 @@ in # Since we have irccat we can wire up mdadm --monitor boot.swraid.mdadmConf = '' PROGRAM ${ - mkIrcMessager { - name = "mdmonitor-to-irc"; - # prog EVENT MD_DEVICE COMPONENT_DEVICE - msgExpr = ''"mdmonitor: $1($2''${3:+, $3})"''; - } + pkgs.writeShellScript "mdmonitor-to-irc" '' + ${send-irc-msg} "mdmonitor: $1($2''${3:+, $3})" + '' } ''; @@ -137,12 +131,7 @@ in esac echo "$0: INFO: sending message: $MSG" >&2 - ${ - mkIrcMessager { - name = "trivial-send-to-irc"; - msgExpr = "\"$1\""; - } - } "$MSG" + ${send-irc-msg} "$MSG" ''; }; }; |