3
0
Fork 0
forked from mirrors/nixpkgs

Merge pull request #50509 from Mic92/netdata

netdata: fix python plugins
This commit is contained in:
Jörg Thalheim 2018-11-17 20:33:54 +00:00 committed by GitHub
commit 9ba5ad5d0b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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 { config = mkOption {
type = types.attrsOf types.attrs; type = types.attrsOf types.attrs;
default = {}; default = {};
@ -75,10 +100,11 @@ in {
} }
]; ];
systemd.services.netdata = { systemd.services.netdata = {
path = with pkgs; [ gawk curl ];
description = "Real time performance monitoring"; description = "Real time performance monitoring";
after = [ "network.target" ]; after = [ "network.target" ];
wantedBy = [ "multi-user.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: '' preStart = concatStringsSep "\n" (map (dir: ''
mkdir -vp ${dir} mkdir -vp ${dir}
chmod 750 ${dir} chmod 750 ${dir}
@ -89,6 +115,7 @@ in {
serviceConfig = { serviceConfig = {
User = cfg.user; User = cfg.user;
Group = cfg.group; Group = cfg.group;
Environment="PYTHONPATH=${pkgs.netdata}/libexec/netdata/python.d/python_modules";
PermissionsStartOnly = true; PermissionsStartOnly = true;
ExecStart = "${pkgs.netdata}/bin/netdata -D -c ${configFile}"; ExecStart = "${pkgs.netdata}/bin/netdata -D -c ${configFile}";
TimeoutStopSec = 60; TimeoutStopSec = 60;