class Zabbix < Formula desc "Availability and monitoring solution" homepage "https://www.zabbix.com/" url "https://downloads.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/2.4.4/zabbix-2.4.4.tar.gz" sha256 "e9f31b96104681b050fd27b4a669736dea9c5d4efc8444effb2bff1eab6cc34c" bottle do revision 1 sha256 "da258ee3875028433d61757fa6025aab5af1cd22b397f3bb470f826e69464878" => :yosemite sha256 "429ed618c9b1be7546595b4a227e440037f0b5322cb4f35b42d5720cee22edf4" => :mavericks sha256 "63acb31c04f4d4e9edbe5cc4e3016df4712466de42efc7c1c9c1c9874cd246f4" => :mountain_lion end option "with-mysql", "Use Zabbix Server with MySQL library instead PostgreSQL." option "without-server-proxy", "Install only the Zabbix Agent without Server and Proxy." deprecated_option "agent-only" => "without-server-proxy" if build.with? "server-proxy" depends_on :mysql => :optional depends_on :postgresql if build.without? "mysql" depends_on "fping" depends_on "libssh2" end def brewed_or_shipped(db_config) brewed_db_config = "#{HOMEBREW_PREFIX}/bin/#{db_config}" (File.exist?(brewed_db_config) && brewed_db_config) || which(db_config) end def install args = %W[ --disable-dependency-tracking --prefix=#{prefix} --enable-agent --with-iconv=#{MacOS.sdk_path}/usr ] if build.with? "server-proxy" args += %W[ --enable-server --enable-proxy --enable-ipv6 --with-net-snmp --with-libcurl --with-ssh2 ] if build.with? "mysql" args << "--with-mysql=#{brewed_or_shipped("mysql_config")}" else args << "--with-postgresql=#{brewed_or_shipped("pg_config")}" end end system "./configure", *args system "make", "install" if build.with? "server-proxy" db = build.with?("mysql") ? "mysql" : "postgresql" (share/"zabbix").install "frontends/php", "database/#{db}" end end test do system "#{sbin}/zabbix_agentd", "--print" end end