84 lines
2.7 KiB
Ruby
84 lines
2.7 KiB
Ruby
class Zabbix < Formula
|
|
desc "Availability and monitoring solution"
|
|
homepage "https://www.zabbix.com/"
|
|
url "https://downloads.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/3.4.1/zabbix-3.4.1.tar.gz"
|
|
sha256 "faaf1a1569ec6b4674d80e707904197c8b568f2b4660f636c28d0c42af471fd4"
|
|
revision 1
|
|
|
|
bottle do
|
|
sha256 "f664c3d8c3c2261ae2bc9c88a77e67663b73ed71f9e5ada3ceb12bd1e9c6b95a" => :high_sierra
|
|
sha256 "9bb20f95f976c1958d2d030a781026f64c460fbbda4e4a362191bd3e3f3d1ac1" => :sierra
|
|
sha256 "993d194bb566b4d75c8c06847aab201428b20a6c83ed214acd7e3516e6d030d3" => :el_capitan
|
|
sha256 "ead5866cfdb01b73bf908f316a14ad8613b11db36de0025e7b3e4abf250cfa19" => :yosemite
|
|
end
|
|
|
|
option "with-mysql", "Use Zabbix Server with MySQL library instead PostgreSQL."
|
|
option "with-sqlite", "Use Zabbix Server with SQLite library instead PostgreSQL."
|
|
option "without-server-proxy", "Install only the Zabbix Agent without Server and Proxy."
|
|
|
|
deprecated_option "agent-only" => "without-server-proxy"
|
|
|
|
depends_on "openssl"
|
|
depends_on "pcre"
|
|
|
|
if build.with? "server-proxy"
|
|
depends_on :mysql => :optional
|
|
depends_on :postgresql if build.without? "mysql"
|
|
depends_on "fping"
|
|
depends_on "libevent"
|
|
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}
|
|
--sysconfdir=#{etc}/zabbix
|
|
--enable-agent
|
|
--with-iconv=#{MacOS.sdk_path}/usr
|
|
--with-libpcre=#{Formula["pcre"].opt_prefix}
|
|
--with-openssl=#{Formula["openssl"].opt_prefix}
|
|
]
|
|
|
|
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")}"
|
|
elsif build.with? "sqlite"
|
|
args << "--with-sqlite3"
|
|
else
|
|
args << "--with-postgresql=#{brewed_or_shipped("pg_config")}"
|
|
end
|
|
end
|
|
|
|
if MacOS.version == :el_capitan && MacOS::Xcode.installed? && MacOS::Xcode.version >= "8.0"
|
|
inreplace "configure", "clock_gettime(CLOCK_REALTIME, &tp);",
|
|
"undefinedgibberish(CLOCK_REALTIME, &tp);"
|
|
end
|
|
|
|
system "./configure", *args
|
|
system "make", "install"
|
|
|
|
if build.with? "server-proxy"
|
|
db = build.with?("mysql") ? "mysql" : "postgresql"
|
|
pkgshare.install "frontends/php", "database/#{db}"
|
|
end
|
|
end
|
|
|
|
test do
|
|
system sbin/"zabbix_agentd", "--print"
|
|
end
|
|
end
|