99 lines
2.9 KiB
Ruby
99 lines
2.9 KiB
Ruby
class Collectd < Formula
|
|
desc "Statistics collection and monitoring daemon"
|
|
homepage "https://collectd.org/"
|
|
url "https://collectd.org/files/collectd-5.7.2.tar.bz2"
|
|
sha256 "9d20a0221569a8d6b80bbc52b86e5e84965f5bafdbf5dfc3790e0fed0763e592"
|
|
|
|
bottle do
|
|
sha256 "2e997eacb1907d2e4e565c3eaa04ea49a987f5b791caeb09ae936f0c15698b02" => :sierra
|
|
sha256 "a1409bee446cc876e7c0fb9732c1b83317c8b104c17a179dd11711bb4b84da2f" => :el_capitan
|
|
sha256 "64a759a6b2bb56345f4f8ad7db06ce4ef9e0dbe95469ebd1305f9ced0d54aecd" => :yosemite
|
|
end
|
|
|
|
head do
|
|
url "https://github.com/collectd/collectd.git"
|
|
|
|
depends_on "automake" => :build
|
|
depends_on "autoconf" => :build
|
|
end
|
|
|
|
option "with-java", "Enable Java support"
|
|
option "with-python", "Enable Python support"
|
|
option "with-riemann-client", "Enable write_riemann support"
|
|
option "with-debug", "Enable debug support"
|
|
|
|
deprecated_option "java" => "with-java"
|
|
deprecated_option "debug" => "with-debug"
|
|
|
|
depends_on "pkg-config" => :build
|
|
depends_on "libtool" => :build
|
|
depends_on "riemann-client" => :optional
|
|
depends_on :java => :optional
|
|
depends_on :python => :optional
|
|
depends_on "net-snmp"
|
|
|
|
fails_with :clang do
|
|
build 318
|
|
cause <<-EOS.undent
|
|
Clang interacts poorly with the collectd-bundled libltdl,
|
|
causing configure to fail.
|
|
EOS
|
|
end
|
|
|
|
def install
|
|
args = %W[
|
|
--disable-debug
|
|
--disable-dependency-tracking
|
|
--prefix=#{prefix}
|
|
--localstatedir=#{var}
|
|
]
|
|
|
|
args << "--disable-java" if build.without? "java"
|
|
args << "--enable-python" if build.with? "python"
|
|
args << "--enable-write_riemann" if build.with? "riemann-client"
|
|
args << "--enable-debug" if build.with? "debug"
|
|
|
|
system "./build.sh" if build.head?
|
|
system "./configure", *args
|
|
system "make", "install"
|
|
end
|
|
|
|
plist_options :manual => "#{HOMEBREW_PREFIX}/sbin/collectd -f -C #{HOMEBREW_PREFIX}/etc/collectd.conf"
|
|
|
|
def plist; <<-EOS.undent
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
<plist version="1.0">
|
|
<dict>
|
|
<key>KeepAlive</key>
|
|
<true/>
|
|
<key>Label</key>
|
|
<string>#{plist_name}</string>
|
|
<key>ProgramArguments</key>
|
|
<array>
|
|
<string>#{sbin}/collectd</string>
|
|
<string>-f</string>
|
|
<string>-C</string>
|
|
<string>#{etc}/collectd.conf</string>
|
|
</array>
|
|
<key>RunAtLoad</key>
|
|
<true/>
|
|
<key>StandardErrorPath</key>
|
|
<string>#{var}/log/collectd.log</string>
|
|
<key>StandardOutPath</key>
|
|
<string>#{var}/log/collectd.log</string>
|
|
</dict>
|
|
</plist>
|
|
EOS
|
|
end
|
|
|
|
test do
|
|
begin
|
|
pid = fork { exec sbin/"collectd", "-f" }
|
|
assert shell_output("nc -u -w 2 127.0.0.1 25826", 0)
|
|
ensure
|
|
Process.kill("SIGINT", pid)
|
|
Process.wait(pid)
|
|
end
|
|
end
|
|
end
|