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: