forked from adv4000/prometheus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install_prometheus_node_exporter.sh
42 lines (34 loc) · 1.23 KB
/
install_prometheus_node_exporter.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
#!/bin/bash
#--------------------------------------------------------------------
# Script to Install Prometheus Node_Exporter on Linux
# Tested on Ubuntu 22.04, Amazon Linux 2023
# Developed by Denis Astahov in 2024
#--------------------------------------------------------------------
# https://github.com/prometheus/node_exporter/releases
NODE_EXPORTER_VERSION="1.7.0"
cd /tmp
wget https://github.com/prometheus/node_exporter/releases/download/v$NODE_EXPORTER_VERSION/node_exporter-$NODE_EXPORTER_VERSION.linux-amd64.tar.gz
tar xvfz node_exporter-$NODE_EXPORTER_VERSION.linux-amd64.tar.gz
cd node_exporter-$NODE_EXPORTER_VERSION.linux-amd64
mv node_exporter /usr/bin/
rm -rf /tmp/node_exporter*
useradd -rs /bin/false node_exporter
chown node_exporter:node_exporter /usr/bin/node_exporter
cat <<EOF> /etc/systemd/system/node_exporter.service
[Unit]
Description=Prometheus Node Exporter
After=network.target
[Service]
User=node_exporter
Group=node_exporter
Type=simple
Restart=on-failure
ExecStart=/usr/bin/node_exporter
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
systemctl start node_exporter
systemctl enable node_exporter
systemctl status node_exporter
node_exporter --version