Last active
May 22, 2019 08:07
-
-
Save dfang/e91eec834e995a9a9b72e1f95b3ae113 to your computer and use it in GitHub Desktop.
Enable brew service support for prometheus
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
``` | |
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>KeepAlive</key> | |
<dict> | |
<key>SuccessfulExit</key> | |
<false/> | |
</dict> | |
<key>Label</key> | |
<string>#{plist_name}</string> | |
<key>ProgramArguments</key> | |
<array> | |
<string>#{opt_bin}/prometheus</string> | |
<string>--config.file</string> | |
<string>#{etc}/prometheus.yml</string> | |
</array> | |
<key>RunAtLoad</key> | |
<true/> | |
<key>WorkingDirectory</key> | |
<string>#{var}</string> | |
<key>StandardErrorPath</key> | |
<string>#{var}/log/prometheus.log</string> | |
<key>StandardOutPath</key> | |
<string>#{var}/log/prometheus.log</string> | |
</dict> | |
</plist> | |
EOS | |
end | |
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
``` | |
<?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>KeepAlive</key> | |
<dict> | |
<key>SuccessfulExit</key> | |
<false/> | |
</dict> | |
<key>Label</key> | |
<string>homebrew.mxcl.prometheus</string> | |
<key>ProgramArguments</key> | |
<array> | |
<string>/usr/local/opt/prometheus/bin/prometheus</string> | |
<string>--config.file</string> | |
<string>/usr/local/etc/prometheus.yml</string> | |
</array> | |
<key>RunAtLoad</key> | |
<true/> | |
<key>WorkingDirectory</key> | |
<string>/usr/local/var</string> | |
<key>StandardErrorPath</key> | |
<string>/usr/local/var/log/prometheus.log</string> | |
<key>StandardOutPath</key> | |
<string>/usr/local/var/log/prometheus.log</string> | |
</dict> | |
</plist> | |
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
``` | |
global: | |
scrape_interval: 15s # By default, scrape targets every 15 seconds. | |
# Attach these labels to any time series or alerts when communicating with | |
# external systems (federation, remote storage, Alertmanager). | |
external_labels: | |
monitor: 'codelab-monitor' | |
# A scrape configuration containing exactly one endpoint to scrape: | |
# Here it's Prometheus itself. | |
scrape_configs: | |
# The job name is added as a label `job=<job_name>` to any timeseries scraped from this config. | |
- job_name: 'prometheus' | |
# Override the global default and scrape targets from this job every 5 seconds. | |
scrape_interval: 5s | |
static_configs: | |
- targets: ['localhost:9090'] | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How to use ?