summary refs log tree commit diff
path: root/nixos/modules/services/monitoring
diff options
context:
space:
mode:
authorJörg Thalheim <joerg@thalheim.io>2018-11-17 15:11:46 +0000
committerJörg Thalheim <joerg@thalheim.io>2018-11-17 15:38:15 +0000
commit31d2593ced3658ced1a033aea67b52df510f3181 (patch)
treeabd54944b95888b71ce83af6c061f0402b3e5862 /nixos/modules/services/monitoring
parentc102306c1f4b75984bc9a78c8de77b4988991e42 (diff)
downloadnixpkgs-31d2593ced3658ced1a033aea67b52df510f3181.tar
nixpkgs-31d2593ced3658ced1a033aea67b52df510f3181.tar.gz
nixpkgs-31d2593ced3658ced1a033aea67b52df510f3181.tar.bz2
nixpkgs-31d2593ced3658ced1a033aea67b52df510f3181.tar.lz
nixpkgs-31d2593ced3658ced1a033aea67b52df510f3181.tar.xz
nixpkgs-31d2593ced3658ced1a033aea67b52df510f3181.tar.zst
nixpkgs-31d2593ced3658ced1a033aea67b52df510f3181.zip
netdata: fix python plugins
fixes #33366
Diffstat (limited to 'nixos/modules/services/monitoring')
-rw-r--r--nixos/modules/services/monitoring/netdata.nix29
1 files changed, 28 insertions, 1 deletions
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;