77 lines
2.4 KiB
Ruby
77 lines
2.4 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.2.5/zabbix-3.2.5.tar.gz"
|
|
mirror "https://fossies.org/linux/misc/zabbix-3.2.5.tar.gz"
|
|
sha256 "2f25d4622f85f9faa9626c9d5b3dbd9bf098f494fae007fecd52c8dc5545504e"
|
|
|
|
bottle do
|
|
sha256 "416888eb64629e71246febb7f0348fab22080d59933e81a7a14476b97e877ce2" => :sierra
|
|
sha256 "0b91e38f7057e528ec0710ab6beb28f83a3e7237bbdf01972ead181edadce479" => :el_capitan
|
|
sha256 "61b35e6dd3eaf9c62318b9b5cf93301a3bd00229b3a5335803259b12dcecc140" => :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"
|
|
|
|
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}
|
|
--sysconfdir=#{etc}/zabbix
|
|
--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")}"
|
|
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
|