forked from zentralwerk/network
nix/pkgs: add ap_install_collectd.sh
This commit is contained in:
parent
d57496701d
commit
60758b448a
|
@ -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 <<EOF
|
||||||
|
Hostname "\$HOSTNAME"
|
||||||
|
FQDNLookup false
|
||||||
|
Interval 10
|
||||||
|
|
||||||
|
BaseDir "/var/run/collectd"
|
||||||
|
Include "/etc/collectd/conf.d"
|
||||||
|
PIDFile "/var/run/collectd.pid"
|
||||||
|
PluginDir "/usr/lib/collectd"
|
||||||
|
TypesDB "/usr/share/collectd/types.db"
|
||||||
|
|
||||||
|
LoadPlugin cpu
|
||||||
|
LoadPlugin load
|
||||||
|
LoadPlugin interface
|
||||||
|
LoadPlugin iwinfo
|
||||||
|
LoadPlugin network
|
||||||
|
<Plugin network>
|
||||||
|
Server "{{STATS}}" "25826"
|
||||||
|
</Plugin>
|
||||||
|
|
||||||
|
EOF
|
||||||
|
|
||||||
|
/etc/init.d/collectd restart
|
||||||
|
/etc/init.d/collectd enable
|
||||||
|
|
||||||
|
__SSH__
|
||||||
|
done
|
|
@ -37,6 +37,9 @@ let
|
||||||
pkgs.runCommandLocal "all-device-scripts" {} (
|
pkgs.runCommandLocal "all-device-scripts" {} (
|
||||||
''
|
''
|
||||||
mkdir -p $out/bin
|
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" (
|
builtins.concatStringsSep "\n" (
|
||||||
map (hostname:
|
map (hostname:
|
||||||
|
|
Loading…
Reference in New Issue