nixos-module/collectd: init

This commit is contained in:
Astro 2021-04-07 00:01:21 +02:00
parent d5f7aecba6
commit aba9251f80
2 changed files with 43 additions and 0 deletions

View File

@ -0,0 +1,42 @@
{ hostName, config, lib, ... }:
let
hostRole = config.site.hosts.${hostName}.role;
networkPort = 25826;
in
{
services.collectd = {
enable = true;
buildMinimalPackage = true;
plugins = lib.mkMerge [ {
interface = "";
conntrack = "";
# TODO: dhcpcount
} (lib.optionalAttrs (hostName == "stats") {
network = ''
Listen "::" "${toString networkPort}"
Forward true
Server "${config.site.net.serv.hosts4.spaceapi}" "${toString networkPort}"
Server "${config.site.net.serv.hosts4.grafana}" "${toString networkPort}"
'';
}) (lib.optionalAttrs (hostName != "stats") {
network = ''
Server "${config.site.net.serv.hosts6.dn42.stats}" "${toString networkPort}"
'';
}) (lib.optionalAttrs (hostRole == "server") {
irq = "";
cpu = "";
load = "";
memory = "";
swap = "";
entropy = "";
disk = "";
df = "";
processes = "";
hddtemp = "";
sensors = "";
thermal = "";
}) ];
};
}

View File

@ -11,6 +11,7 @@ in {
../lib/config/options.nix
./defaults.nix
./network.nix
./collectd.nix
]
++ optionals (hostConfig.role == "server") [
./server/lxc-containers.nix