1 class Collectd < Formula
2 desc "Statistics collection and monitoring daemon"
3 homepage "https://collectd.org/"
8 url "https://storage.googleapis.com/collectd-tarballs/collectd-5.12.0.tar.bz2"
9 sha256 "5bae043042c19c31f77eb8464e56a01a5454e0b39fa07cf7ad0f1bfc9c3a09d6"
11 # Fix -flat_namespace being used on Big Sur and later.
13 url "https://raw.githubusercontent.com/Homebrew/formula-patches/03cf8088210822aa2c1ab544ed58ea04c897d9c4/libtool/configure-big_sur.diff"
14 sha256 "35acd6aebc19843f1a2b3a63e880baceb0f5278ab1ace661e57a502d9d78c93c"
19 url "https://www.collectd.org/download.html"
20 regex(/href=.*?collectd[._-]v?(\d+(?:\.\d+)+)\.t/i)
24 sha256 arm64_sequoia: "58f7a44814b1a467e4f68fcf719069fe352920ce6e800fc5d60e8ad2e6af1332"
25 sha256 arm64_sonoma: "ceb6cf730de48b1f6eadfc3784060f0b6ed437c3a4fcb7f991e75853eb0d8295"
26 sha256 arm64_ventura: "756fa1c1b080652bc6654718c11f5955b1a674b319eb848609e0416415a0cde1"
27 sha256 sonoma: "74e6ebaf66605da54399207a4f083833b39a90f6ff9edb92c82673f874af5e09"
28 sha256 ventura: "cea97da9e5ba92d5d02fb688cc72bf698f245e5d849f44f2d3419f64f1ed5000"
29 sha256 x86_64_linux: "5e73f288cbe0d9d1bd8e35b1782593ab8ef268d41bd05e34913bc63678d926d1"
33 url "https://github.com/collectd/collectd.git", branch: "main"
35 depends_on "autoconf" => :build
36 depends_on "automake" => :build
39 depends_on "pkgconf" => :build
40 depends_on "libgcrypt"
43 depends_on "protobuf-c"
44 depends_on "riemann-client"
46 uses_from_macos "bison" => :build
47 uses_from_macos "flex" => :build
48 uses_from_macos "perl"
51 depends_on "libgpg-error"
55 # Workaround for: Built-in generator --c_out specifies a maximum edition
56 # PROTO3 which is not the protoc maximum 2023.
57 # Remove when fixed in `protobuf-c`:
58 # https://github.com/protobuf-c/protobuf-c/pull/711
59 ENV["PROTOC_C"] = Formula["protobuf"].opt_bin/"protoc"
62 --localstatedir=#{var}
64 --enable-write_riemann
66 args << "--with-perl-bindings=PREFIX=#{prefix} INSTALLSITEMAN3DIR=#{man3}" if OS.linux?
68 system "./build.sh" if build.head?
69 system "./configure", *args, *std_configure_args
70 system "make", "install"
74 run [opt_sbin/"collectd", "-f", "-C", etc/"collectd.conf"]
76 error_log_path var/"log/collectd.log"
77 log_path var/"log/collectd.log"
81 log = testpath/"collectd.log"
82 (testpath/"collectd.conf").write <<~EOS
90 pid = fork { exec sbin/"collectd", "-f", "-C", "collectd.conf" }
92 assert_predicate log, :exist?, "Failed to create log file"
93 assert_match "plugin \"memory\" successfully loaded.", log.read
95 Process.kill("SIGINT", pid)