2014-04-14 14:26:48 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
2013-10-15 01:16:10 +00:00
|
|
|
|
|
|
|
# TODO: support munin-async
|
|
|
|
# TODO: LWP/Pg perl libs aren't recognized
|
|
|
|
|
|
|
|
# TODO: support fastcgi
|
2018-12-13 23:08:56 +00:00
|
|
|
# http://guide.munin-monitoring.org/en/latest/example/webserver/apache-cgi.html
|
2018-10-03 15:36:37 +00:00
|
|
|
# spawn-fcgi -s /run/munin/fastcgi-graph.sock -U www-data -u munin -g munin /usr/lib/munin/cgi/munin-cgi-graph
|
|
|
|
# spawn-fcgi -s /run/munin/fastcgi-html.sock -U www-data -u munin -g munin /usr/lib/munin/cgi/munin-cgi-html
|
2013-10-15 01:16:10 +00:00
|
|
|
# https://paste.sh/vofcctHP#-KbDSXVeWoifYncZmLfZzgum
|
2019-04-22 08:24:21 +00:00
|
|
|
# nginx https://munin.readthedocs.org/en/latest/example/webserver/nginx.html
|
2013-10-15 01:16:10 +00:00
|
|
|
|
|
|
|
|
2014-04-14 14:26:48 +00:00
|
|
|
with lib;
|
2013-10-15 01:16:10 +00:00
|
|
|
|
|
|
|
let
|
|
|
|
nodeCfg = config.services.munin-node;
|
|
|
|
cronCfg = config.services.munin-cron;
|
|
|
|
|
|
|
|
muninConf = pkgs.writeText "munin.conf"
|
|
|
|
''
|
|
|
|
dbdir /var/lib/munin
|
|
|
|
htmldir /var/www/munin
|
|
|
|
logdir /var/log/munin
|
2018-10-03 15:36:37 +00:00
|
|
|
rundir /run/munin
|
2013-10-15 01:16:10 +00:00
|
|
|
|
2018-12-14 02:55:41 +00:00
|
|
|
${lib.optionalString (cronCfg.extraCSS != "") "staticdir ${customStaticDir}"}
|
|
|
|
|
2013-10-15 01:16:10 +00:00
|
|
|
${cronCfg.extraGlobalConfig}
|
2014-09-05 13:50:55 +00:00
|
|
|
|
2013-10-15 01:16:10 +00:00
|
|
|
${cronCfg.hosts}
|
|
|
|
'';
|
|
|
|
|
|
|
|
nodeConf = pkgs.writeText "munin-node.conf"
|
|
|
|
''
|
|
|
|
log_level 3
|
|
|
|
log_file Sys::Syslog
|
|
|
|
port 4949
|
|
|
|
host *
|
|
|
|
background 0
|
|
|
|
user root
|
|
|
|
group root
|
|
|
|
host_name ${config.networking.hostName}
|
|
|
|
setsid 0
|
2014-09-05 13:50:55 +00:00
|
|
|
|
2013-10-15 01:16:10 +00:00
|
|
|
# wrapped plugins by makeWrapper being with dots
|
|
|
|
ignore_file ^\.
|
2014-09-05 13:50:55 +00:00
|
|
|
|
2017-02-20 05:13:48 +00:00
|
|
|
allow ^::1$
|
2013-10-15 01:16:10 +00:00
|
|
|
allow ^127\.0\.0\.1$
|
|
|
|
|
|
|
|
${nodeCfg.extraConfig}
|
|
|
|
'';
|
2017-11-21 17:40:40 +00:00
|
|
|
|
|
|
|
pluginConf = pkgs.writeText "munin-plugin-conf"
|
|
|
|
''
|
|
|
|
[hddtemp_smartctl]
|
|
|
|
user root
|
|
|
|
group root
|
|
|
|
|
|
|
|
[meminfo]
|
|
|
|
user root
|
|
|
|
group root
|
|
|
|
|
|
|
|
[ipmi*]
|
|
|
|
user root
|
|
|
|
group root
|
2018-12-13 23:14:21 +00:00
|
|
|
|
2018-12-15 00:26:02 +00:00
|
|
|
[munin*]
|
|
|
|
env.UPDATE_STATSFILE /var/lib/munin/munin-update.stats
|
|
|
|
|
2018-12-13 23:14:21 +00:00
|
|
|
${nodeCfg.extraPluginConfig}
|
2017-11-21 17:40:40 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
pluginConfDir = pkgs.stdenv.mkDerivation {
|
|
|
|
name = "munin-plugin-conf.d";
|
|
|
|
buildCommand = ''
|
|
|
|
mkdir $out
|
|
|
|
ln -s ${pluginConf} $out/nixos-config
|
|
|
|
'';
|
|
|
|
};
|
2018-12-14 00:58:12 +00:00
|
|
|
|
|
|
|
# Copy one Munin plugin into the Nix store with a specific name.
|
|
|
|
# This is suitable for use with plugins going directly into /etc/munin/plugins,
|
|
|
|
# i.e. munin.extraPlugins.
|
|
|
|
internOnePlugin = name: path:
|
|
|
|
"cp -a '${path}' '${name}'";
|
|
|
|
|
|
|
|
# Copy an entire tree of Munin plugins into a single directory in the Nix
|
|
|
|
# store, with no renaming.
|
|
|
|
# This is suitable for use with munin-node-configure --suggest, i.e.
|
|
|
|
# munin.extraAutoPlugins.
|
|
|
|
internManyPlugins = name: path:
|
|
|
|
"find '${path}' -type f -perm /a+x -exec cp -a -t . '{}' '+'";
|
|
|
|
|
|
|
|
# Use the appropriate intern-fn to copy the plugins into the store and patch
|
|
|
|
# them afterwards in an attempt to get them to run on NixOS.
|
|
|
|
internAndFixPlugins = name: intern-fn: paths:
|
|
|
|
pkgs.runCommand name {} ''
|
|
|
|
mkdir -p "$out"
|
|
|
|
cd "$out"
|
|
|
|
${lib.concatStringsSep "\n"
|
|
|
|
(lib.attrsets.mapAttrsToList intern-fn paths)}
|
|
|
|
chmod -R u+w .
|
|
|
|
find . -type f -exec sed -E -i '
|
|
|
|
s,(/usr)?/s?bin/,/run/current-system/sw/bin/,g
|
|
|
|
' '{}' '+'
|
|
|
|
'';
|
|
|
|
|
|
|
|
# TODO: write a derivation for munin-contrib, so that for contrib plugins
|
|
|
|
# you can just refer to them by name rather than needing to include a copy
|
|
|
|
# of munin-contrib in your nixos configuration.
|
|
|
|
extraPluginDir = internAndFixPlugins "munin-extra-plugins.d"
|
|
|
|
internOnePlugin nodeCfg.extraPlugins;
|
|
|
|
|
|
|
|
extraAutoPluginDir = internAndFixPlugins "munin-extra-auto-plugins.d"
|
|
|
|
internManyPlugins
|
|
|
|
(builtins.listToAttrs
|
|
|
|
(map
|
|
|
|
(path: { name = baseNameOf path; value = path; })
|
|
|
|
nodeCfg.extraAutoPlugins));
|
2018-12-14 02:55:41 +00:00
|
|
|
|
|
|
|
customStaticDir = pkgs.runCommand "munin-custom-static-data" {} ''
|
|
|
|
cp -a "${pkgs.munin}/etc/opt/munin/static" "$out"
|
|
|
|
cd "$out"
|
|
|
|
chmod -R u+w .
|
|
|
|
echo "${cronCfg.extraCSS}" >> style.css
|
|
|
|
echo "${cronCfg.extraCSS}" >> style-new.css
|
|
|
|
'';
|
2013-10-15 01:16:10 +00:00
|
|
|
in
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
options = {
|
|
|
|
|
|
|
|
services.munin-node = {
|
|
|
|
|
|
|
|
enable = mkOption {
|
|
|
|
default = false;
|
2018-12-15 00:24:00 +00:00
|
|
|
type = types.bool;
|
2022-08-03 20:46:41 +00:00
|
|
|
description = lib.mdDoc ''
|
2013-10-15 01:16:10 +00:00
|
|
|
Enable Munin Node agent. Munin node listens on 0.0.0.0 and
|
|
|
|
by default accepts connections only from 127.0.0.1 for security reasons.
|
|
|
|
|
2022-08-03 20:46:41 +00:00
|
|
|
See <http://guide.munin-monitoring.org/en/latest/architecture/index.html>.
|
2013-10-15 01:16:10 +00:00
|
|
|
'';
|
|
|
|
};
|
2014-09-05 13:50:55 +00:00
|
|
|
|
2013-10-15 01:16:10 +00:00
|
|
|
extraConfig = mkOption {
|
|
|
|
default = "";
|
2016-10-23 17:33:41 +00:00
|
|
|
type = types.lines;
|
2022-08-03 20:46:41 +00:00
|
|
|
description = lib.mdDoc ''
|
|
|
|
{file}`munin-node.conf` extra configuration. See
|
|
|
|
<http://guide.munin-monitoring.org/en/latest/reference/munin-node.conf.html>
|
2013-10-15 01:16:10 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2018-12-13 23:14:21 +00:00
|
|
|
extraPluginConfig = mkOption {
|
|
|
|
default = "";
|
|
|
|
type = types.lines;
|
2022-08-03 20:46:41 +00:00
|
|
|
description = lib.mdDoc ''
|
|
|
|
{file}`plugin-conf.d` extra plugin configuration. See
|
|
|
|
<http://guide.munin-monitoring.org/en/latest/plugin/use.html>
|
2018-12-13 23:14:21 +00:00
|
|
|
'';
|
|
|
|
example = ''
|
|
|
|
[fail2ban_*]
|
|
|
|
user root
|
|
|
|
'';
|
|
|
|
};
|
2013-10-15 01:16:10 +00:00
|
|
|
|
2018-12-14 00:58:12 +00:00
|
|
|
extraPlugins = mkOption {
|
|
|
|
default = {};
|
|
|
|
type = with types; attrsOf path;
|
2022-07-28 21:19:15 +00:00
|
|
|
description = lib.mdDoc ''
|
2018-12-14 00:58:12 +00:00
|
|
|
Additional Munin plugins to activate. Keys are the name of the plugin
|
|
|
|
symlink, values are the path to the underlying plugin script. You
|
|
|
|
can use the same plugin script multiple times (e.g. for wildcard
|
|
|
|
plugins).
|
|
|
|
|
|
|
|
Note that these plugins do not participate in autoconfiguration. If
|
|
|
|
you want to autoconfigure additional plugins, use
|
2022-07-28 21:19:15 +00:00
|
|
|
{option}`services.munin-node.extraAutoPlugins`.
|
2018-12-14 00:58:12 +00:00
|
|
|
|
|
|
|
Plugins enabled in this manner take precedence over autoconfigured
|
|
|
|
plugins.
|
|
|
|
|
|
|
|
Plugins will be copied into the Nix store, and it will attempt to
|
|
|
|
modify them to run properly by fixing hardcoded references to
|
2022-07-28 21:19:15 +00:00
|
|
|
`/bin`, `/usr/bin`,
|
|
|
|
`/sbin`, and `/usr/sbin`.
|
2018-12-14 00:58:12 +00:00
|
|
|
'';
|
2021-10-03 16:06:03 +00:00
|
|
|
example = literalExpression ''
|
2018-12-14 00:58:12 +00:00
|
|
|
{
|
|
|
|
zfs_usage_bigpool = /src/munin-contrib/plugins/zfs/zfs_usage_;
|
|
|
|
zfs_usage_smallpool = /src/munin-contrib/plugins/zfs/zfs_usage_;
|
|
|
|
zfs_list = /src/munin-contrib/plugins/zfs/zfs_list;
|
|
|
|
};
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
extraAutoPlugins = mkOption {
|
|
|
|
default = [];
|
|
|
|
type = with types; listOf path;
|
2022-07-28 21:19:15 +00:00
|
|
|
description = lib.mdDoc ''
|
2018-12-14 00:58:12 +00:00
|
|
|
Additional Munin plugins to autoconfigure, using
|
2022-07-28 21:19:15 +00:00
|
|
|
`munin-node-configure --suggest`. These should be
|
2018-12-14 00:58:12 +00:00
|
|
|
the actual paths to the plugin files (or directories containing them),
|
|
|
|
not just their names.
|
|
|
|
|
|
|
|
If you want to manually enable individual plugins instead, use
|
2022-07-28 21:19:15 +00:00
|
|
|
{option}`services.munin-node.extraPlugins`.
|
2018-12-14 00:58:12 +00:00
|
|
|
|
|
|
|
Note that only plugins that have the 'autoconfig' capability will do
|
|
|
|
anything if listed here, since plugins that cannot autoconfigure
|
|
|
|
won't be automatically enabled by
|
2022-07-28 21:19:15 +00:00
|
|
|
`munin-node-configure`.
|
2018-12-14 00:58:12 +00:00
|
|
|
|
|
|
|
Plugins will be copied into the Nix store, and it will attempt to
|
|
|
|
modify them to run properly by fixing hardcoded references to
|
2022-07-28 21:19:15 +00:00
|
|
|
`/bin`, `/usr/bin`,
|
|
|
|
`/sbin`, and `/usr/sbin`.
|
2018-12-14 00:58:12 +00:00
|
|
|
'';
|
2021-10-03 16:06:03 +00:00
|
|
|
example = literalExpression ''
|
2018-12-14 00:58:12 +00:00
|
|
|
[
|
|
|
|
/src/munin-contrib/plugins/zfs
|
|
|
|
/src/munin-contrib/plugins/ssh
|
|
|
|
];
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2018-12-13 23:16:07 +00:00
|
|
|
disabledPlugins = mkOption {
|
2018-12-15 00:26:02 +00:00
|
|
|
# TODO: figure out why Munin isn't writing the log file and fix it.
|
|
|
|
# In the meantime this at least suppresses a useless graph full of
|
|
|
|
# NaNs in the output.
|
|
|
|
default = [ "munin_stats" ];
|
2019-08-08 20:48:27 +00:00
|
|
|
type = with types; listOf str;
|
2022-07-28 21:19:15 +00:00
|
|
|
description = lib.mdDoc ''
|
2018-12-13 23:16:07 +00:00
|
|
|
Munin plugins to disable, even if
|
2022-07-28 21:19:15 +00:00
|
|
|
`munin-node-configure --suggest` tries to enable
|
2018-12-13 23:16:07 +00:00
|
|
|
them. To disable a wildcard plugin, use an actual wildcard, as in
|
|
|
|
the example.
|
2018-12-15 00:26:02 +00:00
|
|
|
|
|
|
|
munin_stats is disabled by default as it tries to read
|
2022-07-28 21:19:15 +00:00
|
|
|
`/var/log/munin/munin-update.log` for timing
|
2018-12-15 00:26:02 +00:00
|
|
|
information, and the NixOS build of Munin does not write this file.
|
2018-12-13 23:16:07 +00:00
|
|
|
'';
|
|
|
|
example = [ "diskstats" "zfs_usage_*" ];
|
|
|
|
};
|
2013-10-15 01:16:10 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
services.munin-cron = {
|
|
|
|
|
|
|
|
enable = mkOption {
|
|
|
|
default = false;
|
2018-12-15 00:24:00 +00:00
|
|
|
type = types.bool;
|
2022-07-28 21:19:15 +00:00
|
|
|
description = lib.mdDoc ''
|
2013-10-15 01:16:10 +00:00
|
|
|
Enable munin-cron. Takes care of all heavy lifting to collect data from
|
|
|
|
nodes and draws graphs to html. Runs munin-update, munin-limits,
|
|
|
|
munin-graphs and munin-html in that order.
|
2014-09-05 13:50:55 +00:00
|
|
|
|
2022-07-28 21:19:15 +00:00
|
|
|
HTML output is in {file}`/var/www/munin/`, configure your
|
2013-10-15 01:16:10 +00:00
|
|
|
favourite webserver to serve static files.
|
|
|
|
'';
|
|
|
|
};
|
2014-09-05 13:50:55 +00:00
|
|
|
|
2013-10-15 01:16:10 +00:00
|
|
|
extraGlobalConfig = mkOption {
|
|
|
|
default = "";
|
2018-12-15 00:24:00 +00:00
|
|
|
type = types.lines;
|
2022-08-03 20:46:41 +00:00
|
|
|
description = lib.mdDoc ''
|
|
|
|
{file}`munin.conf` extra global configuration.
|
|
|
|
See <http://guide.munin-monitoring.org/en/latest/reference/munin.conf.html>.
|
2013-10-15 01:16:10 +00:00
|
|
|
Useful to setup notifications, see
|
2022-08-03 20:46:41 +00:00
|
|
|
<http://guide.munin-monitoring.org/en/latest/tutorial/alert.html>
|
2013-10-15 01:16:10 +00:00
|
|
|
'';
|
2016-01-17 18:34:55 +00:00
|
|
|
example = ''
|
|
|
|
contact.email.command mail -s "Munin notification for ''${var:host}" someone@example.com
|
|
|
|
'';
|
2013-10-15 01:16:10 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
hosts = mkOption {
|
2018-12-15 00:24:00 +00:00
|
|
|
default = "";
|
|
|
|
type = types.lines;
|
2022-08-03 20:46:41 +00:00
|
|
|
description = lib.mdDoc ''
|
2013-10-15 01:16:10 +00:00
|
|
|
Definitions of hosts of nodes to collect data from. Needs at least one
|
2018-12-13 23:08:56 +00:00
|
|
|
host for cron to succeed. See
|
2022-08-03 20:46:41 +00:00
|
|
|
<http://guide.munin-monitoring.org/en/latest/reference/munin.conf.html>
|
2013-10-15 01:16:10 +00:00
|
|
|
'';
|
2021-10-03 16:06:03 +00:00
|
|
|
example = literalExpression ''
|
|
|
|
'''
|
|
|
|
[''${config.networking.hostName}]
|
|
|
|
address localhost
|
|
|
|
'''
|
2018-12-15 00:24:00 +00:00
|
|
|
'';
|
2013-10-15 01:16:10 +00:00
|
|
|
};
|
2014-09-05 13:50:55 +00:00
|
|
|
|
2018-12-14 02:55:41 +00:00
|
|
|
extraCSS = mkOption {
|
|
|
|
default = "";
|
|
|
|
type = types.lines;
|
2022-07-28 21:19:15 +00:00
|
|
|
description = lib.mdDoc ''
|
2018-12-14 02:55:41 +00:00
|
|
|
Custom styling for the HTML that munin-cron generates. This will be
|
|
|
|
appended to the CSS files used by munin-cron and will thus take
|
|
|
|
precedence over the builtin styles.
|
|
|
|
'';
|
|
|
|
example = ''
|
|
|
|
/* A simple dark theme. */
|
|
|
|
html, body { background: #222222; }
|
|
|
|
#header, #footer { background: #333333; }
|
|
|
|
img.i, img.iwarn, img.icrit, img.iunkn {
|
|
|
|
filter: invert(100%) hue-rotate(-30deg);
|
|
|
|
}
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2013-10-15 01:16:10 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkMerge [ (mkIf (nodeCfg.enable || cronCfg.enable) {
|
|
|
|
|
|
|
|
environment.systemPackages = [ pkgs.munin ];
|
|
|
|
|
2019-09-14 17:51:29 +00:00
|
|
|
users.users.munin = {
|
2013-10-15 01:16:10 +00:00
|
|
|
description = "Munin monitoring user";
|
|
|
|
group = "munin";
|
2014-02-07 22:08:15 +00:00
|
|
|
uid = config.ids.uids.munin;
|
2018-12-15 00:26:02 +00:00
|
|
|
home = "/var/lib/munin";
|
2019-09-14 17:51:29 +00:00
|
|
|
};
|
2013-10-15 01:16:10 +00:00
|
|
|
|
2019-09-14 17:51:29 +00:00
|
|
|
users.groups.munin = {
|
2014-02-07 22:08:15 +00:00
|
|
|
gid = config.ids.gids.munin;
|
2019-09-14 17:51:29 +00:00
|
|
|
};
|
2013-10-15 01:16:10 +00:00
|
|
|
|
|
|
|
}) (mkIf nodeCfg.enable {
|
|
|
|
|
|
|
|
systemd.services.munin-node = {
|
2013-11-09 19:06:01 +00:00
|
|
|
description = "Munin Node";
|
2013-10-15 01:16:10 +00:00
|
|
|
after = [ "network.target" ];
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
2017-11-21 17:40:40 +00:00
|
|
|
path = with pkgs; [ munin smartmontools "/run/current-system/sw" "/run/wrappers" ];
|
|
|
|
environment.MUNIN_LIBDIR = "${pkgs.munin}/lib";
|
2018-10-03 15:36:37 +00:00
|
|
|
environment.MUNIN_PLUGSTATE = "/run/munin";
|
2017-11-21 17:40:40 +00:00
|
|
|
environment.MUNIN_LOGDIR = "/var/log/munin";
|
2014-07-24 09:45:07 +00:00
|
|
|
preStart = ''
|
2018-12-13 23:08:56 +00:00
|
|
|
echo "Updating munin plugins..."
|
2014-07-24 09:45:07 +00:00
|
|
|
|
|
|
|
mkdir -p /etc/munin/plugins
|
|
|
|
rm -rf /etc/munin/plugins/*
|
2018-12-13 23:16:07 +00:00
|
|
|
|
|
|
|
# Autoconfigure builtin plugins
|
2017-11-21 17:40:40 +00:00
|
|
|
${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
|
|
|
|
|
2018-12-14 00:58:12 +00:00
|
|
|
# Autoconfigure extra plugins
|
|
|
|
${pkgs.munin}/bin/munin-node-configure --suggest --shell --families contrib,auto,manual --config ${nodeConf} --libdir=${extraAutoPluginDir} --servicedir=/etc/munin/plugins --sconfdir=${pluginConfDir} 2>/dev/null | ${pkgs.bash}/bin/bash
|
|
|
|
|
|
|
|
${lib.optionalString (nodeCfg.extraPlugins != {}) ''
|
|
|
|
# Link in manually enabled plugins
|
|
|
|
ln -f -s -t /etc/munin/plugins ${extraPluginDir}/*
|
|
|
|
''}
|
2018-12-13 23:16:07 +00:00
|
|
|
|
|
|
|
${lib.optionalString (nodeCfg.disabledPlugins != []) ''
|
|
|
|
# Disable plugins
|
|
|
|
cd /etc/munin/plugins
|
|
|
|
rm -f ${toString nodeCfg.disabledPlugins}
|
|
|
|
''}
|
2014-07-24 09:45:07 +00:00
|
|
|
'';
|
2013-10-15 01:16:10 +00:00
|
|
|
serviceConfig = {
|
2017-11-21 17:40:40 +00:00
|
|
|
ExecStart = "${pkgs.munin}/sbin/munin-node --config ${nodeConf} --servicedir /etc/munin/plugins/ --sconfdir=${pluginConfDir}";
|
2013-10-15 01:16:10 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2017-10-13 22:28:39 +00:00
|
|
|
# munin_stats plugin breaks as of 2.0.33 when this doesn't exist
|
2018-10-03 15:36:37 +00:00
|
|
|
systemd.tmpfiles.rules = [ "d /run/munin 0755 munin munin -" ];
|
2017-10-13 22:28:39 +00:00
|
|
|
|
2013-10-15 01:16:10 +00:00
|
|
|
}) (mkIf cronCfg.enable {
|
|
|
|
|
2018-12-13 23:17:21 +00:00
|
|
|
# Munin is hardcoded to use DejaVu Mono and the graphs come out wrong if
|
|
|
|
# it's not available.
|
|
|
|
fonts.fonts = [ pkgs.dejavu_fonts ];
|
|
|
|
|
2017-03-21 23:08:41 +00:00
|
|
|
systemd.timers.munin-cron = {
|
|
|
|
description = "batch Munin master programs";
|
|
|
|
wantedBy = [ "timers.target" ];
|
|
|
|
timerConfig.OnCalendar = "*:0/5";
|
|
|
|
};
|
|
|
|
|
|
|
|
systemd.services.munin-cron = {
|
|
|
|
description = "batch Munin master programs";
|
|
|
|
unitConfig.Documentation = "man:munin-cron(8)";
|
|
|
|
|
|
|
|
serviceConfig = {
|
|
|
|
Type = "oneshot";
|
|
|
|
User = "munin";
|
|
|
|
ExecStart = "${pkgs.munin}/bin/munin-cron --config ${muninConf}";
|
|
|
|
};
|
|
|
|
};
|
2013-10-15 01:16:10 +00:00
|
|
|
|
2017-10-13 22:38:32 +00:00
|
|
|
systemd.tmpfiles.rules = [
|
2018-10-03 15:36:37 +00:00
|
|
|
"d /run/munin 0755 munin munin -"
|
2017-10-13 22:38:32 +00:00
|
|
|
"d /var/log/munin 0755 munin munin -"
|
|
|
|
"d /var/www/munin 0755 munin munin -"
|
|
|
|
"d /var/lib/munin 0755 munin munin -"
|
|
|
|
];
|
2013-10-15 01:16:10 +00:00
|
|
|
})];
|
|
|
|
}
|