diff options
author | Morten Siebuhr <sbhr@sbhr.dk> | 2018-03-22 15:31:53 +0100 |
---|---|---|
committer | Ben Kochie <superq@gmail.com> | 2018-03-22 15:31:53 +0100 |
commit | a310029890df6d558a8daa6d89c37ee144b482ef (patch) | |
tree | c8e5de82160a9a3cfdff4105e12e4c6c2222e22f /examples | |
parent | a8fc71334b8c515327ddb91bd2e77bc479edfeae (diff) | |
download | prometheus_node_collector-a310029890df6d558a8daa6d89c37ee144b482ef.tar.bz2 prometheus_node_collector-a310029890df6d558a8daa6d89c37ee144b482ef.tar.xz prometheus_node_collector-a310029890df6d558a8daa6d89c37ee144b482ef.zip |
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>
Diffstat (limited to 'examples')
-rw-r--r-- | examples/launchctl/README.md | 26 | ||||
-rw-r--r-- | examples/launchctl/io.prometheus.node_exporter.plist | 38 |
2 files changed, 64 insertions, 0 deletions
diff --git a/examples/launchctl/README.md b/examples/launchctl/README.md new file mode 100644 index 0000000..39e440c --- /dev/null +++ b/examples/launchctl/README.md | |||
@@ -0,0 +1,26 @@ | |||
1 | # MacOS LaunchAgent | ||
2 | |||
3 | If you're installing through a package manager, you probably don't need to deal | ||
4 | with this file. | ||
5 | |||
6 | The `plist` file should be put in `~/Library/LaunchAgents/` (user-install) or | ||
7 | `/Library/LaunchAgents/` (global install), and the binary installed at | ||
8 | `/usr/local/bin/node_exporter`. | ||
9 | |||
10 | Ex. install globally by | ||
11 | |||
12 | sudo cp -n node_exporter /usr/local/bin/ | ||
13 | sudo cp -n examples/launchctl/io.prometheus.node_exporter.plist /Library/LaunchAgents/ | ||
14 | sudo launchctl bootstrap system/ /Library/LaunchAgents/io.prometheus.node_exporter.plist | ||
15 | |||
16 | # Optionally configure by dropping CLI arguments in a file | ||
17 | echo -- '--web.listen-address=:9101' | sudo tee /usr/local/etc/node_exporter.args | ||
18 | |||
19 | # Check it's running | ||
20 | sudo launchctl list | grep node_exporter | ||
21 | |||
22 | # See full process state | ||
23 | sudo launchctl print system/io.prometheus.node_exporter | ||
24 | |||
25 | # View logs | ||
26 | sudo tail /tmp/node_exporter.log | ||
diff --git a/examples/launchctl/io.prometheus.node_exporter.plist b/examples/launchctl/io.prometheus.node_exporter.plist new file mode 100644 index 0000000..f32ffb8 --- /dev/null +++ b/examples/launchctl/io.prometheus.node_exporter.plist | |||
@@ -0,0 +1,38 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8"?> | ||
2 | <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
3 | <plist version="1.0"> | ||
4 | <dict> | ||
5 | <key>Label</key> | ||
6 | <string>io.prometheus.node_exporter</string> | ||
7 | <key>ProgramArguments</key> | ||
8 | <array> | ||
9 | <string>sh</string> | ||
10 | <string>-c</string> | ||
11 | <string>/usr/local/bin/node_exporter $(< /usr/local/etc/node_exporter.args)</string> | ||
12 | </array> | ||
13 | <key>UserName</key> | ||
14 | <string>nobody</string> | ||
15 | <key>GroupName</key> | ||
16 | <string>nobody</string> | ||
17 | <key>RunAtLoad</key> | ||
18 | <true/> | ||
19 | <key>KeepAlive</key> | ||
20 | <false/> | ||
21 | <key>WorkingDirectory</key> | ||
22 | <string>/usr/local</string> | ||
23 | <key>StandardErrorPath</key> | ||
24 | <string>/tmp/node_exporter.log</string> | ||
25 | <key>StandardOutPath</key> | ||
26 | <string>/tmp/node_exporter.log</string> | ||
27 | <key>HardResourceLimits</key> | ||
28 | <dict> | ||
29 | <key>NumberOfFiles</key> | ||
30 | <integer>4096</integer> | ||
31 | </dict> | ||
32 | <key>SoftResourceLimits</key> | ||
33 | <dict> | ||
34 | <key>NumberOfFiles</key> | ||
35 | <integer>4096</integer> | ||
36 | </dict> | ||
37 | </dict> | ||
38 | </plist> | ||