
automagically. more security will be nice for IP allowlists using their exact IPv4 in the future. Signed-off-by: Ryan Lahfa <federez-infra@lahfa.xyz>
43 lines
1.1 KiB
Nix
43 lines
1.1 KiB
Nix
{ config, pkgs, lib, ... }:
|
|
let
|
|
inherit (lib) mkEnableOption mkIf types mkOption;
|
|
cfg = config.federez.monitoring;
|
|
in
|
|
{
|
|
options.federez.monitoring = {
|
|
enableChild = mkEnableOption ''child mode.
|
|
This makes the current instance of netdata, headless, memoryless and minimal.
|
|
Don't use it on the central node.
|
|
'' // { default = false; };
|
|
|
|
apiKey = mkOption {
|
|
type = types.nullOr types.str;
|
|
default = null;
|
|
};
|
|
};
|
|
|
|
config = mkIf cfg.enableChild {
|
|
assertions = [{
|
|
assertion = cfg.apiKey != null;
|
|
message = "API key must be set if this node is a child to some netdata dashboard.";
|
|
}];
|
|
services.netdata = {
|
|
enable = true;
|
|
config = {
|
|
global = {
|
|
"memory mode" = "none";
|
|
};
|
|
web = {
|
|
mode = "none";
|
|
"accept a streaming request every seconds" = 0;
|
|
};
|
|
};
|
|
configDir."stream.conf" = pkgs.writeText "stream.conf" ''
|
|
[stream]
|
|
enabled = yes
|
|
destination = klingon.federez.net:19999
|
|
api key = ${cfg.apiKey}
|
|
'';
|
|
};
|
|
};
|
|
}
|