From 60758b448ad1e1ea2cde3f245c856f7bc84934ba Mon Sep 17 00:00:00 2001 From: Astro Date: Sun, 25 Apr 2021 23:53:38 +0200 Subject: [PATCH] nix/pkgs: add ap_install_collectd.sh --- nix/pkgs/ap_install_collectd.sh | 34 +++++++++++++++++++++++++++++++++ nix/pkgs/device-templates.nix | 3 +++ 2 files changed, 37 insertions(+) create mode 100755 nix/pkgs/ap_install_collectd.sh diff --git a/nix/pkgs/ap_install_collectd.sh b/nix/pkgs/ap_install_collectd.sh new file mode 100755 index 000000000..1c19d54 --- /dev/null +++ b/nix/pkgs/ap_install_collectd.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +for HOST in $@ ; do + ssh root@$HOST \ + "ash -e -x" <<__SSH__ +opkg update +opkg install collectd collectd-mod-interface collectd-mod-load collectd-mod-cpu collectd-mod-iwinfo collectd-mod-network +cat > /etc/collectd.conf < + Server "{{STATS}}" "25826" + + +EOF + +/etc/init.d/collectd restart +/etc/init.d/collectd enable + +__SSH__ +done diff --git a/nix/pkgs/device-templates.nix b/nix/pkgs/device-templates.nix index d41b2e0..58136ce 100644 --- a/nix/pkgs/device-templates.nix +++ b/nix/pkgs/device-templates.nix @@ -37,6 +37,9 @@ let pkgs.runCommandLocal "all-device-scripts" {} ( '' mkdir -p $out/bin + + substitute ${./ap_install_collectd.sh} $out/bin/ap_install_collectd.sh \ + --replace "{{STATS}}" "${config.site.net.serv.hosts6.dn42.stats}" '' + builtins.concatStringsSep "\n" ( map (hostname: