about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--pkgs/servers/monitoring/zabbix/3.4.nix41
-rw-r--r--pkgs/servers/monitoring/zabbix/agent.nix38
-rw-r--r--pkgs/servers/monitoring/zabbix/default.nix76
-rw-r--r--pkgs/servers/monitoring/zabbix/proxy.nix79
-rw-r--r--pkgs/servers/monitoring/zabbix/server.nix86
-rw-r--r--pkgs/servers/monitoring/zabbix/versions.nix16
-rw-r--r--pkgs/servers/monitoring/zabbix/web.nix32
-rw-r--r--pkgs/top-level/all-packages.nix19
8 files changed, 268 insertions, 119 deletions
diff --git a/pkgs/servers/monitoring/zabbix/3.4.nix b/pkgs/servers/monitoring/zabbix/3.4.nix
deleted file mode 100644
index 72e6fa55b003..000000000000
--- a/pkgs/servers/monitoring/zabbix/3.4.nix
+++ /dev/null
@@ -1,41 +0,0 @@
-{ stdenv, fetchurl, pcre, libiconv, openssl }:
-
-
-let
-
-  version = "3.4.8";
-  branch = "3.4";
-
-  src = fetchurl {
-    url = "https://netix.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/${version}/zabbix-${version}.tar.gz";
-    sha256 = "cec14993d1ec2c9d8c51f6608c9408620f27174db92edc2347bafa7b841ccc07";
-  };
-
-in
-
-{
-  agent = stdenv.mkDerivation {
-    name = "zabbix-agent-${version}";
-
-    inherit src;
-
-     configureFlags = [
-      "--enable-agent"
-      "--with-libpcre=${pcre.dev}"
-      "--with-iconv=${libiconv}"
-      "--with-openssl=${openssl.dev}"
-    ];
-    buildInputs = [ pcre libiconv openssl ];
-
-    meta = with stdenv.lib; {
-      inherit branch;
-      description = "An enterprise-class open source distributed monitoring solution (client-side agent)";
-      homepage = https://www.zabbix.com/;
-      license = licenses.gpl2;
-      maintainers = [ maintainers.eelco ];
-      platforms = platforms.linux;
-    };
-  };
-
-}
-
diff --git a/pkgs/servers/monitoring/zabbix/agent.nix b/pkgs/servers/monitoring/zabbix/agent.nix
new file mode 100644
index 000000000000..09f43c755f16
--- /dev/null
+++ b/pkgs/servers/monitoring/zabbix/agent.nix
@@ -0,0 +1,38 @@
+{ stdenv, fetchurl, pkgconfig, libiconv, openssl, pcre }:
+
+import ./versions.nix ({ version, sha256 }:
+  stdenv.mkDerivation {
+    pname = "zabbix-agent";
+    inherit version;
+
+    src = fetchurl {
+      url = "mirror://sourceforge/zabbix/ZABBIX%20Latest%20Stable/${version}/zabbix-${version}.tar.gz";
+      inherit sha256;
+    };
+
+    nativeBuildInputs = [ pkgconfig ];
+    buildInputs = [
+      libiconv
+      openssl
+      pcre
+    ];
+
+    configureFlags = [
+      "--enable-agent"
+      "--with-iconv"
+      "--with-libpcre"
+      "--with-openssl=${openssl.dev}"
+    ];
+
+    postInstall = ''
+      cp conf/zabbix_agentd/*.conf $out/etc/zabbix_agentd.conf.d/
+    '';
+
+    meta = with stdenv.lib; {
+      description = "An enterprise-class open source distributed monitoring solution (client-side agent)";
+      homepage = "https://www.zabbix.com/";
+      license = licenses.gpl2;
+      maintainers = with maintainers; [ mmahut psyanticy ];
+      platforms = platforms.linux;
+    };
+  })
diff --git a/pkgs/servers/monitoring/zabbix/default.nix b/pkgs/servers/monitoring/zabbix/default.nix
deleted file mode 100644
index 47db4a15023c..000000000000
--- a/pkgs/servers/monitoring/zabbix/default.nix
+++ /dev/null
@@ -1,76 +0,0 @@
-{ stdenv, fetchurl, pkgconfig, curl, openssl, zlib, pcre, libevent, mysql, libiconv, libxml2 }:
-
-let
-  version = "4.0.9";
-
-  src = fetchurl {
-    url = "https://netix.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/${version}/zabbix-${version}.tar.gz";
-    sha256 = "aa0bc9b5e5ca8e1b49b7551e2c5d86e0342c8630cba3a0b0e0e5d9c846e784d1";
-  };
-
-in
-
-{
-
-  server = stdenv.mkDerivation {
-    name = "zabbix-${version}";
-
-    inherit src;
-    NIX_CFLAGS_COMPILE = "-L${mysql.connector-c}/lib/mysql -I${mysql.connector-c}/include/mysql";
-    configureFlags = [
-      "--enable-server"
-      "--with-mysql"
-      "--with-libcurl"
-      "--with-libxml2"
-      "--with-zlib"
-      "--with-libpcre=${pcre.dev}"
-      "--with-libevent=${libevent.dev}"
-      "--with-iconv=${libiconv}"
-      "--with-openssl=${openssl.dev}"
-    ];
-
-    nativeBuildInputs = [ pkgconfig ];
-    buildInputs = [ mysql curl openssl zlib pcre libxml2 libevent ] ;
-
-    postInstall =
-      ''
-        mkdir -p $out/share/zabbix
-        cp -prvd frontends/php $out/share/zabbix/php
-        mkdir -p $out/share/zabbix/db/data
-        cp -prvd database/mysql/data.sql $out/share/zabbix/db/data/data.sql
-        cp -prvd database/mysql/images.sql $out/share/zabbix/db/data/images.sql
-        mkdir -p $out/share/zabbix/db/schema
-        cp -prvd database/mysql/schema.sql $out/share/zabbix/db/schema/mysql.sql
-      '';
-
-    meta = with stdenv.lib; {
-      description = "An enterprise-class open source distributed monitoring solution (server)";
-      homepage = http://www.zabbix.com/;
-      license = licenses.gpl2;
-      maintainers = [ maintainers.psyanticy ];
-      platforms = platforms.linux;
-    };
-  };
-
-  agent = stdenv.mkDerivation {
-    name = "zabbix-agent-${version}";
-
-    inherit src;
-
-    configureFlags = [
-      "--enable-agent"
-      "--with-libpcre=${pcre.dev}"
-      "--with-iconv=${libiconv}"
-      "--with-openssl=${openssl.dev}"
-    ];
-    buildInputs = [ pcre libiconv openssl ];
-
-    meta = with stdenv.lib; {
-      description = "An enterprise-class open source distributed monitoring solution (client-side agent)";
-      homepage = http://www.zabbix.com/;
-      license = licenses.gpl2;
-      maintainers = [ maintainers.psyanticy ];
-      platforms = platforms.linux;
-    };
-  };
-}
\ No newline at end of file
diff --git a/pkgs/servers/monitoring/zabbix/proxy.nix b/pkgs/servers/monitoring/zabbix/proxy.nix
new file mode 100644
index 000000000000..2062dc6659f8
--- /dev/null
+++ b/pkgs/servers/monitoring/zabbix/proxy.nix
@@ -0,0 +1,79 @@
+{ stdenv, fetchurl, pkgconfig, libevent, libiconv, openssl, pcre, zlib
+, odbcSupport ? true, unixODBC
+, snmpSupport ? true, net_snmp
+, sshSupport ? true, libssh2
+, sqliteSupport ? false, sqlite
+, mysqlSupport ? false, mysql
+, postgresqlSupport ? false, postgresql
+}:
+
+# ensure exactly one database type is selected
+assert mysqlSupport -> !postgresqlSupport && !sqliteSupport;
+assert postgresqlSupport -> !mysqlSupport && !sqliteSupport;
+assert sqliteSupport -> !mysqlSupport && !postgresqlSupport;
+
+let
+  inherit (stdenv.lib) optional optionalString;
+in
+  import ./versions.nix ({ version, sha256 }:
+    stdenv.mkDerivation {
+      pname = "zabbix-proxy";
+      inherit version;
+
+      src = fetchurl {
+        url = "mirror://sourceforge/zabbix/ZABBIX%20Latest%20Stable/${version}/zabbix-${version}.tar.gz";
+        inherit sha256;
+      };
+
+      nativeBuildInputs = [ pkgconfig ];
+      buildInputs = [
+        libevent
+        libiconv
+        openssl
+        pcre
+        zlib
+      ]
+      ++ optional odbcSupport unixODBC
+      ++ optional snmpSupport net_snmp
+      ++ optional sqliteSupport sqlite
+      ++ optional sshSupport libssh2
+      ++ optional mysqlSupport mysql.connector-c
+      ++ optional postgresqlSupport postgresql;
+
+      configureFlags = [
+        "--enable-proxy"
+        "--with-iconv"
+        "--with-libevent"
+        "--with-libpcre"
+        "--with-openssl=${openssl.dev}"
+        "--with-zlib=${zlib}"
+      ]
+      ++ optional odbcSupport "--with-unixodbc"
+      ++ optional snmpSupport "--with-net-snmp"
+      ++ optional sqliteSupport "--with-sqlite3=${sqlite.dev}"
+      ++ optional sshSupport "--with-ssh2=${libssh2.dev}"
+      ++ optional mysqlSupport "--with-mysql"
+      ++ optional postgresqlSupport "--with-postgresql";
+
+      prePatch = ''
+        find database -name data.sql -exec sed -i 's|/usr/bin/||g' {} +
+      '';
+
+      postInstall = ''
+        mkdir -p $out/share/zabbix/database/
+      '' + optionalString sqliteSupport ''
+        mkdir -p $out/share/zabbix/database/sqlite3
+        cp -prvd database/sqlite3/*.sql $out/share/zabbix/database/sqlite3/
+      '' + optionalString postgresqlSupport ''
+        mkdir -p $out/share/zabbix/database/postgresql
+        cp -prvd database/postgresql/schema.sql $out/share/zabbix/database/postgresql/
+      '';
+
+      meta = with stdenv.lib; {
+        description = "An enterprise-class open source distributed monitoring solution (client-server proxy)";
+        homepage = "https://www.zabbix.com/";
+        license = licenses.gpl2;
+        maintainers = [ maintainers.mmahut ];
+        platforms = platforms.linux;
+      };
+    })
diff --git a/pkgs/servers/monitoring/zabbix/server.nix b/pkgs/servers/monitoring/zabbix/server.nix
new file mode 100644
index 000000000000..51ca38e8cfc8
--- /dev/null
+++ b/pkgs/servers/monitoring/zabbix/server.nix
@@ -0,0 +1,86 @@
+{ stdenv, fetchurl, pkgconfig, curl, libevent, libiconv, libxml2, openssl, pcre, zlib
+, jabberSupport ? true, iksemel
+, ldapSupport ? true, openldap
+, odbcSupport ? true, unixODBC
+, snmpSupport ? true, net_snmp
+, sshSupport ? true, libssh2
+, mysqlSupport ? false, mysql
+, postgresqlSupport ? false, postgresql
+}:
+
+# ensure exactly one primary database type is selected
+assert mysqlSupport -> !postgresqlSupport;
+assert postgresqlSupport -> !mysqlSupport;
+
+let
+  inherit (stdenv.lib) optional optionalString;
+in
+  import ./versions.nix ({ version, sha256 }:
+    stdenv.mkDerivation {
+      pname = "zabbix-server";
+      inherit version;
+
+      src = fetchurl {
+        url = "mirror://sourceforge/zabbix/ZABBIX%20Latest%20Stable/${version}/zabbix-${version}.tar.gz";
+        inherit sha256;
+      };
+
+      nativeBuildInputs = [ pkgconfig ];
+      buildInputs = [
+        curl
+        libevent
+        libiconv
+        libxml2
+        openssl
+        pcre
+        zlib
+      ]
+      ++ optional odbcSupport unixODBC
+      ++ optional jabberSupport iksemel
+      ++ optional ldapSupport openldap
+      ++ optional snmpSupport net_snmp
+      ++ optional sshSupport libssh2
+      ++ optional mysqlSupport mysql.connector-c
+      ++ optional postgresqlSupport postgresql;
+
+      configureFlags = [
+        "--enable-server"
+        "--with-iconv"
+        "--with-libcurl"
+        "--with-libevent"
+        "--with-libpcre"
+        "--with-libxml2"
+        "--with-openssl=${openssl.dev}"
+        "--with-zlib=${zlib}"
+      ]
+      ++ optional odbcSupport "--with-unixodbc"
+      ++ optional jabberSupport "--with-jabber"
+      ++ optional ldapSupport "--with-ldap=${openldap.dev}"
+      ++ optional snmpSupport "--with-net-snmp"
+      ++ optional sshSupport "--with-ssh2=${libssh2.dev}"
+      ++ optional mysqlSupport "--with-mysql"
+      ++ optional postgresqlSupport "--with-postgresql";
+
+      prePatch = ''
+        find database -name data.sql -exec sed -i 's|/usr/bin/||g' {} +
+      '';
+
+      postInstall = ''
+        mkdir -p $out/share/zabbix/database/
+        cp -r include $out/
+      '' + optionalString mysqlSupport ''
+        mkdir -p $out/share/zabbix/database/mysql
+        cp -prvd database/mysql/*.sql $out/share/zabbix/database/mysql/
+      '' + optionalString postgresqlSupport ''
+        mkdir -p $out/share/zabbix/database/postgresql
+        cp -prvd database/postgresql/*.sql $out/share/zabbix/database/postgresql/
+      '';
+
+      meta = with stdenv.lib; {
+        description = "An enterprise-class open source distributed monitoring solution";
+        homepage = "https://www.zabbix.com/";
+        license = licenses.gpl2;
+        maintainers = with maintainers; [ mmahut psyanticy ];
+        platforms = platforms.linux;
+      };
+    })
diff --git a/pkgs/servers/monitoring/zabbix/versions.nix b/pkgs/servers/monitoring/zabbix/versions.nix
new file mode 100644
index 000000000000..7b6b5d8fcccb
--- /dev/null
+++ b/pkgs/servers/monitoring/zabbix/versions.nix
@@ -0,0 +1,16 @@
+generic: {
+  v42 = generic {
+    version = "4.2.3";
+    sha256 = "0865c1a9vcgg4syhp5133rw9v1h65lp0g1y2f758jb9x9ybrr01s";
+  };
+
+  v40 = generic {
+    version = "4.0.9";
+    sha256 = "1lc4wx3cing5w2qa18yb6232qd70hrfjq7jmnx4ip3nawnswj2xa";
+  };
+
+  v30 = generic {
+    version = "3.0.28";
+    sha256 = "16966danf5ww4lhjg5gx5bnpid8abxh2ymdg6k5mymrman5bcdjj";
+  };
+}
diff --git a/pkgs/servers/monitoring/zabbix/web.nix b/pkgs/servers/monitoring/zabbix/web.nix
new file mode 100644
index 000000000000..c4cf5d044dae
--- /dev/null
+++ b/pkgs/servers/monitoring/zabbix/web.nix
@@ -0,0 +1,32 @@
+{ stdenv, fetchurl, writeText }:
+
+import ./versions.nix ({ version, sha256 }:
+  stdenv.mkDerivation rec {
+    pname = "zabbix-web";
+    inherit version;
+
+    src = fetchurl {
+      url = "mirror://sourceforge/zabbix/ZABBIX%20Latest%20Stable/${version}/zabbix-${version}.tar.gz";
+      inherit sha256;
+    };
+
+    phpConfig = writeText "zabbix.conf.php" ''
+    <?php
+      return require(getenv('ZABBIX_CONFIG'));
+    ?>
+    '';
+
+    installPhase = ''
+      mkdir -p $out/share/zabbix/
+      cp -a frontends/php/. $out/share/zabbix/
+      cp ${phpConfig} $out/share/zabbix/conf/zabbix.conf.php
+    '';
+
+    meta = with stdenv.lib; {
+      description = "An enterprise-class open source distributed monitoring solution (web frontend)";
+      homepage = "https://www.zabbix.com/";
+      license = licenses.gpl2;
+      maintainers = [ maintainers.mmahut ];
+      platforms = platforms.linux;
+    };
+  })
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 28769eb60ea7..7aaf91bec5a4 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -14953,9 +14953,24 @@ in
 
   youtrack = callPackage ../servers/jetbrains/youtrack.nix { };
 
-  zabbix = recurseIntoAttrs (callPackages ../servers/monitoring/zabbix {});
+  zabbixFor = version: rec {
+    agent = (callPackages ../servers/monitoring/zabbix/agent.nix {}).${version};
+    proxy-mysql = (callPackages ../servers/monitoring/zabbix/proxy.nix { mysqlSupport = true; }).${version};
+    proxy-pgsql = (callPackages ../servers/monitoring/zabbix/proxy.nix { postgresqlSupport = true; }).${version};
+    proxy-sqlite = (callPackages ../servers/monitoring/zabbix/proxy.nix { sqliteSupport = true; }).${version};
+    server-mysql = (callPackages ../servers/monitoring/zabbix/server.nix { mysqlSupport = true; }).${version};
+    server-pgsql = (callPackages ../servers/monitoring/zabbix/server.nix { postgresqlSupport = true; }).${version};
+    web = (callPackages ../servers/monitoring/zabbix/web.nix {}).${version};
 
-  zabbix34 = callPackage ../servers/monitoring/zabbix/3.4.nix { };
+    # backwards compatibility
+    server = server-pgsql;
+  };
+
+  zabbix42 = zabbixFor "v42";
+  zabbix40 = zabbixFor "v40";
+  zabbix30 = zabbixFor "v30";
+
+  zabbix = zabbix42;
 
   zipkin = callPackage ../servers/monitoring/zipkin { };