mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2025-01-04 01:42:53 +03:00
nixos/zabbix-agent: Make the Zabbix package user-configurable
This commit is contained in:
parent
5bb9ebce4c
commit
69b4f427b6
@ -7,6 +7,8 @@ let
|
|||||||
|
|
||||||
cfg = config.services.zabbixAgent;
|
cfg = config.services.zabbixAgent;
|
||||||
|
|
||||||
|
zabbix = cfg.package;
|
||||||
|
|
||||||
stateDir = "/var/run/zabbix";
|
stateDir = "/var/run/zabbix";
|
||||||
|
|
||||||
logDir = "/var/log/zabbix";
|
logDir = "/var/log/zabbix";
|
||||||
@ -44,6 +46,16 @@ in
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
package = mkOption {
|
||||||
|
type = types.attrs; # Note: pkgs.zabbixXY isn't a derivation, but an attrset of { server = ...; agent = ...; }.
|
||||||
|
default = pkgs.zabbix;
|
||||||
|
defaultText = "pkgs.zabbix";
|
||||||
|
example = literalExample "pkgs.zabbix34";
|
||||||
|
description = ''
|
||||||
|
The Zabbix package to use.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
server = mkOption {
|
server = mkOption {
|
||||||
default = "127.0.0.1";
|
default = "127.0.0.1";
|
||||||
description = ''
|
description = ''
|
||||||
@ -87,14 +99,14 @@ in
|
|||||||
chown zabbix ${stateDir} ${logDir}
|
chown zabbix ${stateDir} ${logDir}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
serviceConfig.ExecStart = "@${pkgs.zabbix.agent}/sbin/zabbix_agentd zabbix_agentd --config ${configFile}";
|
serviceConfig.ExecStart = "@${zabbix.agent}/sbin/zabbix_agentd zabbix_agentd --config ${configFile}";
|
||||||
serviceConfig.Type = "forking";
|
serviceConfig.Type = "forking";
|
||||||
serviceConfig.RemainAfterExit = true;
|
serviceConfig.RemainAfterExit = true;
|
||||||
serviceConfig.Restart = "always";
|
serviceConfig.Restart = "always";
|
||||||
serviceConfig.RestartSec = 2;
|
serviceConfig.RestartSec = 2;
|
||||||
};
|
};
|
||||||
|
|
||||||
environment.systemPackages = [ pkgs.zabbix.agent ];
|
environment.systemPackages = [ zabbix.agent ];
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user