73 lines
2.2 KiB
Ruby
73 lines
2.2 KiB
Ruby
class Prometheus < Formula
|
|
desc "Service monitoring system and time series database"
|
|
homepage "https://prometheus.io/"
|
|
url "https://github.com/prometheus/prometheus/archive/v2.6.0.tar.gz"
|
|
sha256 "e0d3e77e45466fd055726268354a02834968a3275791be6cbd17513ec7860c1d"
|
|
|
|
bottle do
|
|
cellar :any_skip_relocation
|
|
sha256 "c924ac72e5fe7c20efe65a9873737e6082ef335b8673fcdfd2ab306afb365a96" => :mojave
|
|
sha256 "5e12d0d8235fe1200fd48fa624dbb9276bd955c4b080a5fb3ca054d7a626e76f" => :high_sierra
|
|
sha256 "ad1c08a415f2233b442157ef8f0f3d0ab3f3008036556e6c81b65ae65a7eb731" => :sierra
|
|
end
|
|
|
|
depends_on "go" => :build
|
|
|
|
def install
|
|
mkdir_p buildpath/"src/github.com/prometheus"
|
|
ln_sf buildpath, buildpath/"src/github.com/prometheus/prometheus"
|
|
|
|
system "make", "build"
|
|
bin.install %w[promtool prometheus]
|
|
libexec.install %w[consoles console_libraries]
|
|
end
|
|
|
|
def caveats; <<~EOS
|
|
When used with `brew services`, prometheus' configuration is stored as command line flags in
|
|
#{etc}/prometheus.args
|
|
|
|
Example configuration:
|
|
echo "--config.file ~/.config/prometheus.yml" > #{etc}/prometheus.args
|
|
|
|
EOS
|
|
end
|
|
|
|
plist_options :manual => "prometheus"
|
|
|
|
def plist; <<~EOS
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
<plist version="1.0">
|
|
<dict>
|
|
<key>Label</key>
|
|
<string>#{plist_name}</string>
|
|
<key>ProgramArguments</key>
|
|
<array>
|
|
<string>sh</string>
|
|
<string>-c</string>
|
|
<string>#{opt_bin}/prometheus $(< #{etc}/prometheus.args)</string>
|
|
</array>
|
|
<key>RunAtLoad</key>
|
|
<true/>
|
|
<key>KeepAlive</key>
|
|
<false/>
|
|
<key>StandardErrorPath</key>
|
|
<string>#{var}/log/prometheus.err.log</string>
|
|
<key>StandardOutPath</key>
|
|
<string>#{var}/log/prometheus.log</string>
|
|
</dict>
|
|
</plist>
|
|
EOS
|
|
end
|
|
|
|
test do
|
|
(testpath/"rules.example").write <<~EOS
|
|
groups:
|
|
- name: http
|
|
rules:
|
|
- record: job:http_inprogress_requests:sum
|
|
expr: sum(http_inprogress_requests) by (job)
|
|
EOS
|
|
system "#{bin}/promtool", "check", "rules", testpath/"rules.example"
|
|
end
|
|
end
|