Add example launchctl-file for MacOS (#856)
* Add example LaunchCtl-file for MacOS Signed-off-by: Morten Siebuhr <sbhr@sbhr.dk> * Rewrite program location in launctctl file This seem to be the way most plist files does it. Signed-off-by: Morten Siebuhr <sbhr@sbhr.dk> * Make launct-agent run as nobody/nobody Signed-off-by: Morten Siebuhr <sbhr@sbhr.dk> * Rename plist per general naming scheme Signed-off-by: Morten Siebuhr <sbhr@sbhr.dk> * Pass arguments-file when launched through launchctl Signed-off-by: Morten Siebuhr <sbhr@sbhr.dk>
This commit is contained in:
parent
a8fc71334b
commit
a310029890
|
@ -0,0 +1,26 @@
|
|||
# MacOS LaunchAgent
|
||||
|
||||
If you're installing through a package manager, you probably don't need to deal
|
||||
with this file.
|
||||
|
||||
The `plist` file should be put in `~/Library/LaunchAgents/` (user-install) or
|
||||
`/Library/LaunchAgents/` (global install), and the binary installed at
|
||||
`/usr/local/bin/node_exporter`.
|
||||
|
||||
Ex. install globally by
|
||||
|
||||
sudo cp -n node_exporter /usr/local/bin/
|
||||
sudo cp -n examples/launchctl/io.prometheus.node_exporter.plist /Library/LaunchAgents/
|
||||
sudo launchctl bootstrap system/ /Library/LaunchAgents/io.prometheus.node_exporter.plist
|
||||
|
||||
# Optionally configure by dropping CLI arguments in a file
|
||||
echo -- '--web.listen-address=:9101' | sudo tee /usr/local/etc/node_exporter.args
|
||||
|
||||
# Check it's running
|
||||
sudo launchctl list | grep node_exporter
|
||||
|
||||
# See full process state
|
||||
sudo launchctl print system/io.prometheus.node_exporter
|
||||
|
||||
# View logs
|
||||
sudo tail /tmp/node_exporter.log
|
|
@ -0,0 +1,38 @@
|
|||
<?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>io.prometheus.node_exporter</string>
|
||||
<key>ProgramArguments</key>
|
||||
<array>
|
||||
<string>sh</string>
|
||||
<string>-c</string>
|
||||
<string>/usr/local/bin/node_exporter $(< /usr/local/etc/node_exporter.args)</string>
|
||||
</array>
|
||||
<key>UserName</key>
|
||||
<string>nobody</string>
|
||||
<key>GroupName</key>
|
||||
<string>nobody</string>
|
||||
<key>RunAtLoad</key>
|
||||
<true/>
|
||||
<key>KeepAlive</key>
|
||||
<false/>
|
||||
<key>WorkingDirectory</key>
|
||||
<string>/usr/local</string>
|
||||
<key>StandardErrorPath</key>
|
||||
<string>/tmp/node_exporter.log</string>
|
||||
<key>StandardOutPath</key>
|
||||
<string>/tmp/node_exporter.log</string>
|
||||
<key>HardResourceLimits</key>
|
||||
<dict>
|
||||
<key>NumberOfFiles</key>
|
||||
<integer>4096</integer>
|
||||
</dict>
|
||||
<key>SoftResourceLimits</key>
|
||||
<dict>
|
||||
<key>NumberOfFiles</key>
|
||||
<integer>4096</integer>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
Loading…
Reference in New Issue