summary refs log tree commit diff
diff options
context:
space:
mode:
authorAaron Andersen <aaron@fosslib.net>2021-03-24 19:55:00 -0400
committertomberek <tomberek@users.noreply.github.com>2021-03-28 13:35:21 -0400
commitd6fd7c661365638c576c2885068b459c67684e7b (patch)
tree6f410a9c33a33f3f01d1675360dca03abf9fe147
parentdebbd843330393dbf9f1abdccf20255cf33712bf (diff)
downloadnixpkgs-d6fd7c661365638c576c2885068b459c67684e7b.tar
nixpkgs-d6fd7c661365638c576c2885068b459c67684e7b.tar.gz
nixpkgs-d6fd7c661365638c576c2885068b459c67684e7b.tar.bz2
nixpkgs-d6fd7c661365638c576c2885068b459c67684e7b.tar.lz
nixpkgs-d6fd7c661365638c576c2885068b459c67684e7b.tar.xz
nixpkgs-d6fd7c661365638c576c2885068b459c67684e7b.tar.zst
nixpkgs-d6fd7c661365638c576c2885068b459c67684e7b.zip
nixos/zabbixAgent: add a few minor tweaks to make configuration file compatible with both zabbix agent 1 and 2
-rw-r--r--nixos/modules/services/monitoring/zabbix-agent.nix11
1 files changed, 8 insertions, 3 deletions
diff --git a/nixos/modules/services/monitoring/zabbix-agent.nix b/nixos/modules/services/monitoring/zabbix-agent.nix
index 73eed7aa66a..e7dd9e3393d 100644
--- a/nixos/modules/services/monitoring/zabbix-agent.nix
+++ b/nixos/modules/services/monitoring/zabbix-agent.nix
@@ -128,11 +128,16 @@ in
       {
         LogType = "console";
         Server = cfg.server;
-        ListenIP = cfg.listen.ip;
         ListenPort = cfg.listen.port;
-        LoadModule = builtins.attrNames cfg.modules;
       }
-      (mkIf (cfg.modules != {}) { LoadModulePath = "${moduleEnv}/lib"; })
+      (mkIf (cfg.modules != {}) {
+        LoadModule = builtins.attrNames cfg.modules;
+        LoadModulePath = "${moduleEnv}/lib";
+      })
+
+      # the default value for "ListenIP" is 0.0.0.0 but zabbix agent 2 cannot accept configuration files which
+      # explicitly set "ListenIP" to the default value...
+      (mkIf (cfg.listen.ip != "0.0.0.0") { ListenIP = cfg.listen.ip; })
     ];
 
     networking.firewall = mkIf cfg.openFirewall {