nixos-module/collectd: init
This commit is contained in:
parent
d5f7aecba6
commit
aba9251f80
|
@ -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 = "";
|
||||||
|
}) ];
|
||||||
|
};
|
||||||
|
}
|
|
@ -11,6 +11,7 @@ in {
|
||||||
../lib/config/options.nix
|
../lib/config/options.nix
|
||||||
./defaults.nix
|
./defaults.nix
|
||||||
./network.nix
|
./network.nix
|
||||||
|
./collectd.nix
|
||||||
]
|
]
|
||||||
++ optionals (hostConfig.role == "server") [
|
++ optionals (hostConfig.role == "server") [
|
||||||
./server/lxc-containers.nix
|
./server/lxc-containers.nix
|
||||||
|
|
Loading…
Reference in New Issue