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