···
nodeCfg = config.services.munin-node;
cronCfg = config.services.munin-cron;
20
-
muninPlugins = pkgs.stdenv.mkDerivation {
21
-
name = "munin-available-plugins";
25
-
cp --preserve=mode ${pkgs.munin}/lib/plugins/* $out/
27
-
for file in $out/*; do
29
-
*/plugin.sh|*/plugins.history)
34
-
# read magic makers from the file
35
-
family=$(sed -nr 's/.*#%#\s+family\s*=\s*(\S+)\s*/\1/p' $file)
36
-
cap=$(sed -nr 's/.*#%#\s+capabilities\s*=\s*(.+)/\1/p' $file)
39
-
--set PATH "/run/wrappers/bin:/run/current-system/sw/bin" \
40
-
--set MUNIN_LIBDIR "${pkgs.munin}/lib" \
41
-
--set MUNIN_PLUGSTATE "/var/run/munin"
43
-
# munin uses markers to tell munin-node-configure what a plugin can do
44
-
echo "#%# family=$family" >> $file
45
-
echo "#%# capabilities=$cap" >> $file
48
-
# NOTE: we disable disktstats because plugin seems to fail and it hangs html generation (100% CPU + memory leak)
49
-
rm -f $out/diskstats
51
-
buildInputs = [ pkgs.makeWrapper ];
muninConf = pkgs.writeText "munin.conf"
···
53
+
pluginConf = pkgs.writeText "munin-plugin-conf"
68
+
pluginConfDir = pkgs.stdenv.mkDerivation {
69
+
name = "munin-plugin-conf.d";
72
+
ln -s ${pluginConf} $out/nixos-config
···
description = "Munin Node";
after = [ "network.target" ];
wantedBy = [ "multi-user.target" ];
182
-
path = [ pkgs.munin ];
171
+
path = with pkgs; [ munin smartmontools "/run/current-system/sw" "/run/wrappers" ];
172
+
environment.MUNIN_LIBDIR = "${pkgs.munin}/lib";
environment.MUNIN_PLUGSTATE = "/var/run/munin";
174
+
environment.MUNIN_LOGDIR = "/var/log/munin";
echo "updating munin plugins..."
mkdir -p /etc/munin/plugins
rm -rf /etc/munin/plugins/*
189
-
PATH="/run/wrappers/bin:/run/current-system/sw/bin" ${pkgs.munin}/sbin/munin-node-configure --shell --families contrib,auto,manual --config ${nodeConf} --libdir=${muninPlugins} --servicedir=/etc/munin/plugins 2>/dev/null | ${pkgs.bash}/bin/bash
180
+
${pkgs.munin}/bin/munin-node-configure --suggest --shell --families contrib,auto,manual --config ${nodeConf} --libdir=${pkgs.munin}/lib/plugins --servicedir=/etc/munin/plugins --sconfdir=${pluginConfDir} 2>/dev/null | ${pkgs.bash}/bin/bash
182
+
# NOTE: we disable disktstats because plugin seems to fail and it hangs html generation (100% CPU + memory leak)
183
+
rm /etc/munin/plugins/diskstats || true
192
-
ExecStart = "${pkgs.munin}/sbin/munin-node --config ${nodeConf} --servicedir /etc/munin/plugins/";
186
+
ExecStart = "${pkgs.munin}/sbin/munin-node --config ${nodeConf} --servicedir /etc/munin/plugins/ --sconfdir=${pluginConfDir}";