-
Notifications
You must be signed in to change notification settings - Fork 37
/
Copy pathinstall.prometheus_node_exporter_linux.sh
executable file
·86 lines (65 loc) · 3.27 KB
/
install.prometheus_node_exporter_linux.sh
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
82
83
84
85
86
#!/bin/bash
[ $(id -u) -eq 0 ] && echo "LANCEMENT root INTERDIT. Utilisez un simple utilisateur du groupe \"sudo\" SVP" && exit 1
## INSTALL NODE MONITORING TOOLS
#~ prometheus & grafana
mkdir -p ~/.zen/tmp
cd ~/.zen/tmp
# Check processor architecture
architecture=$(uname -m)
##############################################################
## "GRAFANA" NODE + PROMETHEUS GATEWAY (CONSUME DISK SPACE !)
##############################################################
if [[ "$1" == "GRAFANA" && ! -d ~/.zen/prometheus ]]; then
# Grafana
sudo apt-get install -y adduser libfontconfig1 musl
[ "$architecture" == "x86_64" ] \
&& wget https://dl.grafana.com/oss/release/grafana_10.4.2_amd64.deb \
&& sudo dpkg -i grafana_10.4.2_amd64.deb
[ "$architecture" == "aarch64" ] \
&& wget https://dl.grafana.com/oss/release/grafana_10.4.2_arm64.deb \
&& sudo dpkg -i grafana_10.4.2_arm64.deb
### NOT starting on installation, please execute the following statements to configure grafana to start automatically using systemd
sudo systemctl daemon-reload
sudo systemctl enable grafana-server
### You can start grafana-server by executing
sudo systemctl start grafana-server
echo "MONITORING : grafana : http://localhost:3000 (admin/admin)"
## PROMETHEUS GATEWAY
[ "$architecture" == "x86_64" ] \
&& wget -O prometheus.tar.gz https://github.com/prometheus/prometheus/releases/download/v2.45.4/prometheus-2.45.4.linux-amd64.tar.gz
[ "$architecture" == "aarch64" ] \
&& wget -O prometheus.tar.gz https://github.com/prometheus/prometheus/releases/download/v2.45.4/prometheus-2.45.4.linux-arm64.tar.gz
tar -xvzf prometheus.tar.gz
mv $(ls -d prometheus-*) ~/.zen/prometheus
## prometheus.
echo "PROBE ENGINE : prometheus : http://localhost:9090"
fi
######################################################
## PROMETHEUS node_exporter
######################################################
# Download appropriate version of node_exporter
if [ "$architecture" == "x86_64" ]; then
wget --no-check-certificate -O node_exporter.tar.gz https://github.com/prometheus/node_exporter/releases/download/v1.7.0/node_exporter-1.7.0.linux-amd64.tar.gz
# /ipfs/QmRDwRWPpfK1XmXQew8HgoqJgC9X5WXR2Qr82sg4MqJ4M7
elif [ "$architecture" == "aarch64" ]; then
wget --no-check-certificate -O node_exporter.tar.gz https://github.com/prometheus/node_exporter/releases/download/v1.7.0/node_exporter-1.7.0.linux-arm64.tar.gz
# /ipfs/QmQ8YukwTjUrTbibAWq8sR4c29ye33GX8v4T4GW1C1vDCk
elif [ "$architecture" == "armv7l" ]; then
wget --no-check-certificate -O node_exporter.tar.gz https://github.com/prometheus/node_exporter/releases/download/v1.7.0/node_exporter-1.7.0.linux-armv7.tar.gz
elif [ "$architecture" == "armv6l" ]; then
wget --no-check-certificate -O node_exporter.tar.gz https://github.com/prometheus/node_exporter/releases/download/v1.7.0/node_exporter-1.7.0.linux-armv6.tar.gz
else
echo "Error: Unknown architecture"
exit 1
fi
tar -xvzf node_exporter.tar.gz
cd $(ls -d node_exporter-*)
# Install
sudo cp node_exporter /usr/local/bin/
cd ..
# Test
[[ ! $(ls /usr/local/bin/node_exporter) ]] \
&& echo "node_exporter NOT installed" && exit 1 \
|| echo "node_exporter installed"
echo "New prometheus PROBE node_exporter : https://grafana.com/dashboards/1860"
exit 0