File tree Expand file tree Collapse file tree 4 files changed +54
-0
lines changed Expand file tree Collapse file tree 4 files changed +54
-0
lines changed Original file line number Diff line number Diff line change 1
1
# machine-metrics
2
2
Script to install and run Prometheus Node Exporter (https://github.com/prometheus/node_exporter )
3
+
4
+ Usage:
5
+
6
+ ```
7
+ sudo -H ./install.sh
8
+ ```
9
+
10
+ You can then control the service as per a normal systemd service, i.e.
11
+
12
+ * ` sudo systemctl [start|stop|enable|disable] machine-metrics.service `
13
+ * ` systemctl status machine-metrics.service `
14
+ * ` sudo journalctl --unit montagu-staging `
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+ set -e
3
+
4
+ HERE=$( dirname $( realpath $0 ) )
5
+ TARGET=/etc/systemd/system/machine-metrics.service
6
+
7
+ if [[ " $HOME " != /root ]]; then
8
+ echo " Run with sudo -H ./install.sh"
9
+ exit 1;
10
+ fi
11
+
12
+ set -x
13
+ sudo snap install --classic go
14
+ go get github.com/prometheus/node_exporter
15
+ cd ${GOPATH-$HOME / go} /src/github.com/prometheus/node_exporter
16
+ make
17
+
18
+ cp $HERE /machine-metrics.service $TARGET
19
+ sed -i " s:__PATH__:$HERE :g" $TARGET
20
+ systemctl enable machine-metrics
21
+
22
+ set +x
23
+ echo " "
24
+ echo " Prometheus node exporter is installed at a service and is running at:"
25
+ echo " "
26
+ echo " http://localhost:9100/metrics"
27
+ echo " "
Original file line number Diff line number Diff line change
1
+ [Unit]
2
+ Description =Prometheus Node Metrics Exporter
3
+ Wants =network-online.target
4
+ After =network-online.target
5
+
6
+ [Install]
7
+ WantedBy =multi-user.target
8
+
9
+ [Service]
10
+ WorkingDirectory =__PATH__
11
+ ExecStart =__PATH__/run.sh
12
+ Type =simple
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+ set -x
3
+ /root/go/src/github.com/prometheus/node_exporter/node_exporter
You can’t perform that action at this time.
0 commit comments