Merge pull request #50509 from Mic92/netdata
netdata: fix python plugins
This commit is contained in:
commit
9ba5ad5d0b
1 changed files with 28 additions and 1 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue