-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnode_exporter_installer.sh
More file actions
33 lines (26 loc) · 993 Bytes
/
node_exporter_installer.sh
File metadata and controls
33 lines (26 loc) · 993 Bytes
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
#!/bin/bash
wget https://github.com/prometheus/node_exporter/releases/download/v1.8.2/node_exporter-1.8.2.linux-amd64.tar.gz
tar xzvf node_exporter-1.8.2.linux-amd64.tar.gz
mv node_exporter-1.8.2.linux-amd64 /usr/local/bin/node_exporter
groupadd prometheus
useradd -g prometheus -m -d /var/lib/prometheus -s /sbin/nologin prometheus
mkdir /usr/local/prometheus
chown prometheus:prometheus -R /usr/local/prometheus
cat > /etc/systemd/system/node_exporter.service << EOF
[Unit]
Description=node_exporter-1.8.2
Documentation=https://prometheus.io/
After=network.target
[Service]
Type=simple
User=prometheus
ExecStart=/usr/local/bin/node_exporter/node_exporter --collector.processes --collector.filesystem.ignored-mount-points=^/(sys|proc|dev|host|etc)($|/)
Restart=on-failure
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
systemctl restart node_exporter.service
systemctl enable node_exporter.service
systemctl start node_exporter.service
systemctl status node_exporter