homebrew-core/Formula/netdata.rb

107 lines
3.2 KiB
Ruby

class Netdata < Formula
desc "Diagnose infrastructure problems with metrics, visualizations & alarms"
homepage "https://netdata.cloud/"
url "https://github.com/netdata/netdata/releases/download/v1.35.1/netdata-v1.35.1.tar.gz"
sha256 "587f6cce421015f8e0a527e3964a4de8cc17085c354498150bc3ade21606bbf9"
license "GPL-3.0-or-later"
livecheck do
url :stable
regex(/^v?(\d+(?:\.\d+)+)$/i)
end
bottle do
sha256 arm64_monterey: "b453a9a214be03bd782fd5e5e405e4bb1cb33fbe45d1ed5b665717c74ad287c1"
sha256 arm64_big_sur: "9e3ccea3115802299c8fec5742acb89a893f52369265eaf331586789c9c5b6d8"
sha256 monterey: "b8bcea223e3e6d3d38e5308ab7a7046abe494ab4b2ea994a0cf86431d2b7f147"
sha256 big_sur: "32dbfce916b9214d3f269b7a90ac1c346d4c0162b3902552e1d3f9a3489918c0"
sha256 catalina: "e79b608cda465dc40823cbbf3b12256c4fa54e82ac51116909dde86d82980748"
sha256 x86_64_linux: "6cc6cb7ae6e33c338d07877b12008bd88d34dca6b8e3c96fd7bc2969cd29c283"
end
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "pkg-config" => :build
depends_on "json-c"
depends_on "libuv"
depends_on "lz4"
depends_on "openssl@1.1"
depends_on "protobuf-c"
uses_from_macos "zlib"
on_linux do
depends_on "util-linux"
end
resource "judy" do
url "https://downloads.sourceforge.net/project/judy/judy/Judy-1.0.5/Judy-1.0.5.tar.gz"
sha256 "d2704089f85fdb6f2cd7e77be21170ced4b4375c03ef1ad4cf1075bd414a63eb"
end
def install
# We build judy as static library, so we don't need to install it
# into the real prefix
judyprefix = "#{buildpath}/resources/judy"
resource("judy").stage do
system "./configure", "--disable-debug", "--disable-dependency-tracking",
"--disable-shared", "--prefix=#{judyprefix}"
# Parallel build is broken
ENV.deparallelize do
system "make", "-j1", "install"
end
end
ENV["PREFIX"] = prefix
ENV.append "CFLAGS", "-I#{judyprefix}/include"
ENV.append "LDFLAGS", "-L#{judyprefix}/lib"
system "autoreconf", "-ivf"
args = %W[
--disable-dependency-tracking
--disable-silent-rules
--prefix=#{prefix}
--sysconfdir=#{etc}
--localstatedir=#{var}
--libexecdir=#{libexec}
--with-math
--with-zlib
--enable-dbengine
--with-user=netdata
]
if OS.mac?
args << "UUID_LIBS=-lc"
args << "UUID_CFLAGS=-I/usr/include"
else
args << "UUID_LIBS=-luuid"
args << "UUID_CFLAGS=-I#{Formula["util-linux"].opt_include}"
end
system "./configure", *args
system "make", "clean"
system "make", "install"
(etc/"netdata").install "system/netdata.conf"
end
def post_install
(var/"cache/netdata/unittest-dbengine/dbengine").mkpath
(var/"lib/netdata/registry").mkpath
(var/"log/netdata").mkpath
(var/"netdata").mkpath
end
service do
run [opt_sbin/"netdata", "-D"]
working_dir var
end
test do
system "#{sbin}/netdata", "-W", "set", "registry", "netdata unique id file",
"#{testpath}/netdata.unittest.unique.id",
"-W", "set", "registry", "netdata management api key file",
"#{testpath}/netdata.api.key"
end
end