79 lines
2.4 KiB
Ruby
79 lines
2.4 KiB
Ruby
class Metricbeat < Formula
|
|
desc "Collect metrics from your systems and services"
|
|
homepage "https://www.elastic.co/beats/metricbeat"
|
|
url "https://github.com/elastic/beats.git",
|
|
tag: "v7.15.1",
|
|
revision: "5ae799cb1c3c490c9a27b14cb463dc23696bc7d3"
|
|
license "Apache-2.0"
|
|
head "https://github.com/elastic/beats.git"
|
|
|
|
bottle do
|
|
sha256 cellar: :any_skip_relocation, arm64_big_sur: "775a07cdd38b9ac92b05efe0dffd706e80d7bf2847f93063c1ef41a14e186342"
|
|
sha256 cellar: :any_skip_relocation, big_sur: "59558941a82ed2777b8d24442b4e90c892f39e4ec5a50c6aa35847688029891c"
|
|
sha256 cellar: :any_skip_relocation, catalina: "7e940562dee8f8eb6bdbf7ca1a3b28740841d00c941c55f970a58a60e95f70a6"
|
|
sha256 cellar: :any_skip_relocation, mojave: "f4638a94a4fa488e86b16131fe7ffdbc3481677b1f0937eb12e757e69542244c"
|
|
sha256 cellar: :any_skip_relocation, x86_64_linux: "9ed18d0ef174b1ef51a3de3b3ddf4528953ae52d56ab1333f3eba8e579189bf5"
|
|
end
|
|
|
|
depends_on "go" => :build
|
|
depends_on "mage" => :build
|
|
depends_on "python@3.9" => :build
|
|
|
|
def install
|
|
# remove non open source files
|
|
rm_rf "x-pack"
|
|
|
|
cd "metricbeat" do
|
|
# don't build docs because it would fail creating the combined OSS/x-pack
|
|
# docs and we aren't installing them anyway
|
|
inreplace "magefile.go", "mg.Deps(CollectDocs, FieldsDocs)", ""
|
|
|
|
system "mage", "-v", "build"
|
|
ENV.deparallelize
|
|
system "mage", "-v", "update"
|
|
|
|
(etc/"metricbeat").install Dir["metricbeat.*", "fields.yml", "modules.d"]
|
|
(libexec/"bin").install "metricbeat"
|
|
prefix.install "build/kibana"
|
|
end
|
|
|
|
(bin/"metricbeat").write <<~EOS
|
|
#!/bin/sh
|
|
exec #{libexec}/bin/metricbeat \
|
|
--path.config #{etc}/metricbeat \
|
|
--path.data #{var}/lib/metricbeat \
|
|
--path.home #{prefix} \
|
|
--path.logs #{var}/log/metricbeat \
|
|
"$@"
|
|
EOS
|
|
end
|
|
|
|
service do
|
|
run opt_bin/"metricbeat"
|
|
end
|
|
|
|
test do
|
|
(testpath/"config/metricbeat.yml").write <<~EOS
|
|
metricbeat.modules:
|
|
- module: system
|
|
metricsets: ["load"]
|
|
period: 1s
|
|
output.file:
|
|
enabled: true
|
|
path: #{testpath}/data
|
|
filename: metricbeat
|
|
EOS
|
|
|
|
(testpath/"logs").mkpath
|
|
(testpath/"data").mkpath
|
|
|
|
fork do
|
|
exec bin/"metricbeat", "-path.config", testpath/"config", "-path.data",
|
|
testpath/"data"
|
|
end
|
|
|
|
sleep 30
|
|
assert_predicate testpath/"data/metricbeat", :exist?
|
|
end
|
|
end
|