tools: node_exporter

This commit is contained in:
zhengyi59 2024-02-21 15:05:54 +08:00
parent 3a38665695
commit 2109f609b3
2 changed files with 39 additions and 0 deletions

7
node_exporter/README.md Normal file
View File

@ -0,0 +1,7 @@
# 自动安装 node_exporter 脚本
你可以使用下面命令直接执行
```shell
wget https://git.mczhengyi.top/zhengyi/tools/raw/branch/main/node_exporter/install.sh | sudo bash
```

32
node_exporter/install.sh Normal file
View File

@ -0,0 +1,32 @@
#!/bin/bash
# AUTO INSTALL NODE EXPORTER
# AUTHOR: zhengyi59
echo -e "\033[32mDownloading Node Exporter...... \033[0m"
wget https://github.com/prometheus/node_exporter/releases/download/v1.7.0/node_exporter-1.7.0.linux-amd64.tar.gz
tar -xzvf node_exporter-1.7.0.linux-amd64.tar.gz
echo -e "\033[32mInstalling Node Exporter...... \033[0m"
mv node_exporter-1.7.0.linux-amd64/node_exporter /usr/bin
rm -rf node_exporter-1.7.0.linux-amd64*
echo -e "\033[32mCreating Services...... \033[0m"
echo '[Unit]
Description=Node Exporter
After=network.target
[Service]
Type=simple
ExecStart=/usr/bin/node_exporter --collector.textfile.directory=/tmp/metrics --web.listen-address=:9100
Restart=on-failure
[Install]
WantedBy=multi-user.target' > /etc/systemd/system/node_exporter.service
systemctl start node_exporter
systemctl enable node_exporter
echo -e '\033[32mYour Node Exporter Was Configured
You can get metrics in http://<your_ip>:9100/metrics
\033[0m'