homebrew-core/Formula/ganglia.rb
2017-10-06 17:38:33 -07:00

76 lines
2.4 KiB
Ruby

class Ganglia < Formula
desc "Scalable distributed monitoring system"
homepage "https://ganglia.sourceforge.io/"
url "https://downloads.sourceforge.net/project/ganglia/ganglia%20monitoring%20core/3.7.2/ganglia-3.7.2.tar.gz"
sha256 "042dbcaf580a661b55ae4d9f9b3566230b2232169a0898e91a797a4c61888409"
revision 2
bottle do
sha256 "b0f3d07ba10af68520ccf09bc79d812d0ea138303311872803a6d02f2a3c84ab" => :high_sierra
sha256 "8dc0a8e78b4cb5c9ca44aea68f17dac3404c2c3895cf6388455b982f48d73179" => :sierra
sha256 "2f6bee65172ee23fb74c58b1a8f31071db89ec81458fd34332012546e08d4696" => :el_capitan
sha256 "66bfda4ca0ce32bb91c18fa06f664fc15960580325f61cb47385c563da1d3995" => :yosemite
end
head do
url "https://github.com/ganglia/monitor-core.git"
depends_on "automake" => :build
depends_on "autoconf" => :build
depends_on "libtool" => :build
end
depends_on "pkg-config" => :build
depends_on "apr"
depends_on "confuse"
depends_on "pcre"
depends_on "rrdtool"
conflicts_with "coreutils", :because => "both install `gstat` binaries"
def install
if build.head?
inreplace "bootstrap", "libtoolize", "glibtoolize"
inreplace "libmetrics/bootstrap", "libtoolize", "glibtoolize"
system "./bootstrap"
end
inreplace "configure", 'varstatedir="/var/lib"', %Q(varstatedir="#{var}/lib")
system "./configure", "--disable-debug",
"--disable-dependency-tracking",
"--prefix=#{prefix}",
"--sbindir=#{bin}",
"--sysconfdir=#{etc}",
"--mandir=#{man}",
"--with-gmetad",
"--with-libapr=#{Formula["apr"].opt_bin}/apr-1-config",
"--with-libpcre=#{Formula["pcre"].opt_prefix}"
system "make", "install"
# Generate the default config file
system "#{bin}/gmond -t > #{etc}/gmond.conf" unless File.exist? "#{etc}/gmond.conf"
end
def post_install
(var/"lib/ganglia/rrds").mkpath
end
def caveats; <<-EOS.undent
If you didn't have a default config file, one was created here:
#{etc}/gmond.conf
EOS
end
test do
begin
pid = fork do
exec bin/"gmetad", "--pid-file=#{testpath}/pid"
end
sleep 2
assert_predicate testpath/"pid", :exist?
ensure
Process.kill "TERM", pid
Process.wait pid
end
end
end