2012-08-31 04:40:16 +00:00
|
|
|
require 'formula'
|
|
|
|
|
|
|
|
class Zabbix < Formula
|
|
|
|
homepage 'http://www.zabbix.com/'
|
2013-09-17 17:13:02 +00:00
|
|
|
url 'http://downloads.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/2.0.8/zabbix-2.0.8.tar.gz'
|
|
|
|
sha1 '5481354f848416c6c3daa100a3b9cda1d17010df'
|
2012-08-31 04:40:16 +00:00
|
|
|
|
2012-11-27 07:05:27 +00:00
|
|
|
option 'with-mysql', 'Use Zabbix Server with MySQL library instead PostgreSQL.'
|
|
|
|
option 'agent-only', 'Install only the Zabbix Agent without Server and Proxy.'
|
|
|
|
|
2013-07-23 03:39:33 +00:00
|
|
|
unless build.include? 'agent-only'
|
|
|
|
depends_on :mysql => :optional
|
|
|
|
depends_on :postgresql unless build.with? 'mysql'
|
2012-11-27 07:05:27 +00:00
|
|
|
depends_on 'fping'
|
|
|
|
depends_on 'libssh2'
|
|
|
|
end
|
|
|
|
|
|
|
|
def brewed_or_shipped(db_config)
|
|
|
|
brewed_db_config = "#{HOMEBREW_PREFIX}/bin/#{db_config}"
|
|
|
|
(File.exists?(brewed_db_config) && brewed_db_config) || which(db_config)
|
|
|
|
end
|
2012-08-31 04:40:16 +00:00
|
|
|
|
|
|
|
def install
|
2012-11-27 07:05:27 +00:00
|
|
|
args = %W{
|
|
|
|
--disable-dependency-tracking
|
|
|
|
--prefix=#{prefix}
|
|
|
|
--enable-agent
|
|
|
|
}
|
|
|
|
|
2013-07-23 03:39:33 +00:00
|
|
|
unless build.include? 'agent-only'
|
2012-11-27 07:05:27 +00:00
|
|
|
args += %W{
|
|
|
|
--enable-server
|
|
|
|
--enable-proxy
|
|
|
|
--enable-ipv6
|
|
|
|
--with-net-snmp
|
|
|
|
--with-libcurl
|
|
|
|
--with-ssh2
|
|
|
|
}
|
2013-07-23 03:39:33 +00:00
|
|
|
if build.with? 'mysql'
|
|
|
|
args << "--with-mysql=#{brewed_or_shipped('mysql_config')}"
|
|
|
|
else
|
|
|
|
args << "--with-postgresql=#{brewed_or_shipped('pg_config')}"
|
|
|
|
end
|
2012-11-27 07:05:27 +00:00
|
|
|
end
|
2012-08-31 04:40:16 +00:00
|
|
|
|
2012-11-27 07:05:27 +00:00
|
|
|
system "./configure", *args
|
2012-08-31 04:40:16 +00:00
|
|
|
system "make install"
|
2012-11-27 07:05:27 +00:00
|
|
|
|
2013-07-23 03:39:33 +00:00
|
|
|
unless build.include? 'agent-only'
|
|
|
|
db = build.with?('mysql') ? 'mysql' : 'postgresql'
|
|
|
|
(share/'zabbix').install 'frontends/php', "database/#{db}"
|
2012-11-27 07:05:27 +00:00
|
|
|
end
|
2012-08-31 04:40:16 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def test
|
2012-11-27 07:05:27 +00:00
|
|
|
system "#{sbin}/zabbix_agentd", "--print"
|
2012-08-31 04:40:16 +00:00
|
|
|
end
|
|
|
|
end
|