Skip to content

Commit

Permalink
netdata: fix python plugins
Browse files Browse the repository at this point in the history
(cherry picked from commit e08ee4971652b402888e2bc2ecec75a83ba661d8)
  • Loading branch information
Mic92 committed Nov 17, 2018
1 parent 656288f commit f0445db
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion nixos/modules/services/monitoring/netdata.nix
Expand Up @@ -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 = {};
Expand All @@ -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}
Expand All @@ -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;
Expand Down

0 comments on commit f0445db

Please sign in to comment.