nixos-config/modules/zabbix-agent.nix

41 lines
960 B
Nix
Raw Normal View History

2022-09-21 21:38:36 +02:00
{ pkgs, config, ... }:
let
version = "latest";
in
2021-12-08 10:58:46 +01:00
{
2022-09-21 21:38:36 +02:00
2021-12-08 10:58:46 +01:00
services.zabbixAgent = {
enable = true;
2023-11-19 01:40:39 +01:00
server = "mc7,10.88.1.0";
2025-11-27 13:14:59 +01:00
package = pkgs.zabbix74.agent2;
#package = (pkgs.callPackages ../packages/zabbix/agent2.nix {}).${version};
settings = {
2022-02-19 11:47:17 +01:00
UserParameter = [
"systemd.exitstatus[*],systemctl show --value -p ExecMainStatus '$1'"
"borg.check[*],borg_check.sh '$1' '$2' '$3'"
];
};
2021-12-08 10:58:46 +01:00
};
2022-02-19 11:47:17 +01:00
systemd.services.zabbix-agent.path = [
(pkgs.writeShellScriptBin "borg_check.sh" (builtins.readFile ./borg_check.sh))
pkgs.gawk
pkgs.smartmontools
2022-02-19 11:47:17 +01:00
];
users.users.zabbix-agent.extraGroups = [ "systemd-journal" ];
#allow zabbix-agent to run smartctl
security.sudo.extraRules = [
{
users = [ "zabbix-agent" ];
commands = [
{
command = "${pkgs.smartmontools}/bin/smartctl";
options = [ "NOPASSWD" ];
}
];
}
];
2021-12-08 10:58:46 +01:00
}
# vim: set et ts=2 sw=2 ai: