diff --git a/nixos/modules/services/monitoring/zabbix-server.nix b/nixos/modules/services/monitoring/zabbix-server.nix index ca283ea2a99f..acd1279ddf47 100644 --- a/nixos/modules/services/monitoring/zabbix-server.nix +++ b/nixos/modules/services/monitoring/zabbix-server.nix @@ -32,6 +32,8 @@ let ${optionalString (cfg.dbPassword != "") '' DBPassword = ${cfg.dbPassword} ''} + + ${config.services.zabbixServer.extraConfig} ''; useLocalPostgres = cfg.dbServer == "localhost" || cfg.dbServer == ""; @@ -46,6 +48,7 @@ in services.zabbixServer.enable = mkOption { default = false; + type = types.bool; description = '' Whether to run the Zabbix server on this machine. ''; @@ -53,6 +56,7 @@ in services.zabbixServer.dbServer = mkOption { default = "localhost"; + type = types.str; description = '' Hostname or IP address of the database server. Use an empty string ("") to use peer authentication. @@ -61,9 +65,18 @@ in services.zabbixServer.dbPassword = mkOption { default = ""; + type = types.str; description = "Password used to connect to the database server."; }; + services.zabbixServer.extraConfig = mkOption { + default = ""; + type = types.lines; + description = '' + Configuration that is injected verbatim into the configuration file. + ''; + }; + }; ###### implementation diff --git a/pkgs/servers/monitoring/zabbix/2.2.nix b/pkgs/servers/monitoring/zabbix/2.2.nix index 424001ea377b..df9da3c467b1 100644 --- a/pkgs/servers/monitoring/zabbix/2.2.nix +++ b/pkgs/servers/monitoring/zabbix/2.2.nix @@ -1,5 +1,10 @@ { stdenv, fetchurl, pkgconfig, postgresql, curl, openssl, zlib, gettext -, enableJabber ? false, minmay ? null }: +, net_snmp , libssh2, openldap +, enableJabber ? false, minmay ? null +, enableSnmp ? false +, enableSsh ? false +, enableLdap ? false +}: assert enableJabber -> minmay != null; @@ -38,7 +43,11 @@ in "--with-postgresql" "--with-libcurl" "--with-gettext" - ] ++ stdenv.lib.optional enableJabber "--with-jabber=${minmay}"; + ] + ++ stdenv.lib.optional enableJabber "--with-jabber=${minmay}" + ++ stdenv.lib.optional enableSnmp "--with-net-snmp" + ++ stdenv.lib.optional enableSsh "--with-ssh2=${libssh2}" + ++ stdenv.lib.optional enableLdap "--with-ldap=${openldap}"; postPatch = '' sed -i -e 's/iksemel/minmay/g' configure src/libs/zbxmedia/jabber.c @@ -48,7 +57,10 @@ in -e 's/iks/mmay/g' -e 's/IKS/MMAY/g' src/libs/zbxmedia/jabber.c ''; - buildInputs = [ pkgconfig postgresql curl openssl zlib ]; + buildInputs = [ pkgconfig postgresql curl openssl zlib ] + ++ stdenv.lib.optional enableSnmp net_snmp + ++ stdenv.lib.optional enableSsh libssh2 + ++ stdenv.lib.optional enableLdap openldap; postInstall = ''