From 0da9489c6a4227b1a360626db13509ef4260798b Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Mon, 21 Jan 2019 13:27:46 -0700 Subject: [PATCH] nixos/netdata: Add option to include extra plugins New option `extraPluginPaths' that allows users to supply additional paths for netdata plugins. Very useful for when you want to use custom collection scripts. --- nixos/modules/services/monitoring/netdata.nix | 25 ++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/nixos/modules/services/monitoring/netdata.nix b/nixos/modules/services/monitoring/netdata.nix index 4873ab1fc608..1d86c5d893de 100644 --- a/nixos/modules/services/monitoring/netdata.nix +++ b/nixos/modules/services/monitoring/netdata.nix @@ -10,9 +10,14 @@ let ln -s /run/wrappers/bin/apps.plugin $out/libexec/netdata/plugins.d/apps.plugin ''; + plugins = [ + "${pkgs.netdata}/libexec/netdata/plugins.d" + "${wrappedPlugins}/libexec/netdata/plugins.d" + ] ++ cfg.extraPluginPaths; + localConfig = { global = { - "plugins directory" = "${pkgs.netdata}/libexec/netdata/plugins.d ${wrappedPlugins}/libexec/netdata/plugins.d"; + "plugins directory" = concatStringsSep " " plugins; }; web = { "web files owner" = "root"; @@ -78,6 +83,24 @@ in { }; }; + extraPluginPaths = mkOption { + type = types.listOf types.path; + default = [ ]; + example = literalExample '' + [ "/path/to/plugins.d" ] + ''; + description = '' + Extra paths to add to the netdata global "plugins directory" + option. Useful for when you want to include your own + collection scripts. + + Details about writing a custom netdata plugin are available at: + + + Cannot be combined with configText. + ''; + }; + config = mkOption { type = types.attrsOf types.attrs; default = {};