blob: 5444969e3ed8576ff5925f4c9d1d4b419e1baf63 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
From 9bb1bda466013dda3bf50d5fc4a9967b20555f07 Mon Sep 17 00:00:00 2001
From: Alexys Jacob <ultrabug@gentoo.org>
Date: Wed, 17 May 2017 18:06:34 +0200
Subject: [PATCH 8/9] prometheus node_exporter install: add support for gentoo
linux
Signed-off-by: Alexys Jacob <ultrabug@gentoo.org>
---
dist/common/scripts/node_exporter_install | 44 ++++++++++++++++++++-----------
1 file changed, 28 insertions(+), 16 deletions(-)
diff --git a/dist/common/scripts/node_exporter_install b/dist/common/scripts/node_exporter_install
index c796b393..8083eb08 100755
--- a/dist/common/scripts/node_exporter_install
+++ b/dist/common/scripts/node_exporter_install
@@ -22,26 +22,37 @@ if [ "`id -u`" -ne 0 ]; then
exit 1
fi
-if [ -f /usr/bin/node_exporter ]; then
+if [ -f /usr/bin/node_exporter ] || [ -f /usr/bin/prometheus-node_exporter ]; then
echo "node_exporter already installed"
exit 1
fi
-version=0.12.0
-dir=/usr/lib/scylla/Prometheus/node_exporter
-mkdir -p $dir
-cd $dir
-curl -L https://github.com/prometheus/node_exporter/releases/download/$version/node_exporter-$version.linux-amd64.tar.gz -o $dir/node_exporter-$version.linux-amd64.tar.gz
-tar -xvzf $dir/node_exporter-$version.linux-amd64.tar.gz
-rm $dir/node_exporter-$version.linux-amd64.tar.gz
-ln -s $dir/node_exporter-$version.linux-amd64/node_exporter /usr/bin
-. /etc/os-release
-
- if [ "$(cat /proc/1/comm)" = "systemd" ]; then
- systemctl enable node-exporter
- systemctl start node-exporter
+. /usr/lib/scylla/scylla_lib.sh
+
+if is_gentoo_variant; then
+ emerge -uq net-analyzer/prometheus-node_exporter
+ if is_systemd; then
+ echo "net-analyzer/prometheus-node_exporter does not install systemd service files, please fill a bug if you need them."
+ else
+ rc-update add prometheus-node_exporter default
+ service prometheus-node_exporter start
+ fi
else
- cat <<EOT >> /etc/init/node_exporter.conf
+ version=0.12.0
+ dir=/usr/lib/scylla/Prometheus/node_exporter
+ mkdir -p $dir
+ cd $dir
+ curl -L https://github.com/prometheus/node_exporter/releases/download/$version/node_exporter-$version.linux-amd64.tar.gz -o $dir/node_exporter-$version.linux-amd64.tar.gz
+ tar -xvzf $dir/node_exporter-$version.linux-amd64.tar.gz
+ rm $dir/node_exporter-$version.linux-amd64.tar.gz
+ ln -s $dir/node_exporter-$version.linux-amd64/node_exporter /usr/bin
+ . /etc/os-release
+
+ if is_systemd; then
+ systemctl enable node-exporter
+ systemctl start node-exporter
+ else
+ cat <<EOT >> /etc/init/node_exporter.conf
# Run node_exporter
start on startup
@@ -50,7 +61,8 @@ script
/usr/bin/node_exporter
end script
EOT
- service node_exporter start
+ service node_exporter start
+ fi
fi
printf "node_exporter successfully installed\n"
--
2.12.2
|