class Netdata < Formula desc "Distributed real-time performance and health monitoring" homepage "https://my-netdata.io/" url "https://github.com/netdata/netdata/releases/download/v1.16.0/netdata-v1.16.0.tar.gz" sha256 "d62ae89c7b9e93d40feca6edd26b77c6e27e17caa2f90a50a1a7a677f6cc8b4f" bottle do sha256 "1e8fc22559158962bfc684cf3f8e4b7d2c3f8fd2582baebe148620d42d690a9a" => :mojave sha256 "2407cdd97bbe1c266a750c38f6630a4959ebce1b99cd2425de37595e08783c04" => :high_sierra sha256 "c0ab969974f586c5132b847d0e7fea6d563cf889962755bb2da9164bad8c119f" => :sierra end depends_on "autoconf" => :build depends_on "automake" => :build depends_on "pkg-config" => :build depends_on "openssl" if MacOS.version <= :sierra def install system "./configure", "--disable-dependency-tracking", "--disable-silent-rules", "--prefix=#{prefix}", "--sysconfdir=#{etc}", "--localstatedir=#{var}", "UUID_CFLAGS=-I/usr/include", "UUID_LIBS=-lc" system "make", "install" (etc/"netdata").install "system/netdata.conf" end def post_install config = etc/"netdata/netdata.conf" inreplace config do |s| s.gsub!(/web files owner = .*/, "web files owner = #{ENV["USER"]}") s.gsub!(/web files group = .*/, "web files group = #{Etc.getgrgid(prefix.stat.gid).name}") end (var/"netdata").mkpath end plist_options :manual => "#{HOMEBREW_PREFIX}/sbin/netdata -D" def plist; <<~EOS Label #{plist_name} RunAtLoad ProgramArguments #{opt_sbin}/netdata -D WorkingDirectory #{var} EOS 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", "-W", "unittest" end end