From 31d2593ced3658ced1a033aea67b52df510f3181 Mon Sep 17 00:00:00 2001 From: Jörg Thalheim Date: Sat, 17 Nov 2018 15:11:46 +0000 Subject: netdata: fix python plugins fixes #33366 --- nixos/modules/services/monitoring/netdata.nix | 29 ++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) (limited to 'nixos/modules/services/monitoring') diff --git a/nixos/modules/services/monitoring/netdata.nix b/nixos/modules/services/monitoring/netdata.nix index 7f21beeb133..7715e291d32 100644 --- a/nixos/modules/services/monitoring/netdata.nix +++ b/nixos/modules/services/monitoring/netdata.nix @@ -53,6 +53,31 @@ in { ''; }; + python = { + enable = mkOption { + type = types.bool; + default = true; + description = '' + Whether to enable python-based plugins + ''; + }; + extraPackages = mkOption { + default = ps: []; + defaultText = "ps: []"; + example = literalExample '' + ps: [ + ps.psycopg2 + ps.docker + ps.dnspython + ] + ''; + description = '' + Extra python packages available at runtime + to enable additional python plugins. + ''; + }; + }; + config = mkOption { type = types.attrsOf types.attrs; default = {}; @@ -75,10 +100,11 @@ in { } ]; systemd.services.netdata = { - path = with pkgs; [ gawk curl ]; description = "Real time performance monitoring"; after = [ "network.target" ]; wantedBy = [ "multi-user.target" ]; + path = (with pkgs; [ gawk curl ]) ++ lib.optional cfg.python.enable + (pkgs.python3.withPackages cfg.python.extraPackages); preStart = concatStringsSep "\n" (map (dir: '' mkdir -vp ${dir} chmod 750 ${dir} @@ -89,6 +115,7 @@ in { serviceConfig = { User = cfg.user; Group = cfg.group; + Environment="PYTHONPATH=${pkgs.netdata}/libexec/netdata/python.d/python_modules"; PermissionsStartOnly = true; ExecStart = "${pkgs.netdata}/bin/netdata -D -c ${configFile}"; TimeoutStopSec = 60; -- cgit 1.4.1