feat(modules): add Netdata monitoring module
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
bb7f24ac4b
commit
da7a45c1c0
1 changed files with 55 additions and 0 deletions
55
modules/netdata.nix
Normal file
55
modules/netdata.nix
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
# Netdata Module
|
||||
# Provides: Real-time system monitoring dashboard
|
||||
#
|
||||
# Usage:
|
||||
# myModules.netdata = {
|
||||
# enable = true;
|
||||
# domain = "netdata.example.com";
|
||||
# };
|
||||
#
|
||||
# Access is restricted to Tailscale network only via nginx internalOnly.
|
||||
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.myModules.netdata;
|
||||
in
|
||||
{
|
||||
options.myModules.netdata = {
|
||||
enable = lib.mkEnableOption "Netdata real-time monitoring";
|
||||
|
||||
domain = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
example = "netdata.example.com";
|
||||
description = "Public domain name for Netdata dashboard";
|
||||
};
|
||||
|
||||
port = lib.mkOption {
|
||||
type = lib.types.port;
|
||||
default = 19999;
|
||||
description = "Internal port for Netdata to listen on";
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
services.netdata = {
|
||||
enable = true;
|
||||
config = {
|
||||
global = {
|
||||
"bind to" = "0.0.0.0:${toString cfg.port}";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# Nginx reverse proxy - restricted to Tailscale network
|
||||
myModules.nginx.domains.${cfg.domain} = {
|
||||
port = cfg.port;
|
||||
internalOnly = true;
|
||||
contentSecurityPolicy = null;
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue