Prometheus builds a monitoring system (2)

After deployment Prometheus, it needs to be installed on the server to be detectedNode Exporter

Prometheus Node ExporterVarious hardware and kernel related metrics are exposed.

Usually Prometheusthrough Node Exporterto monitor various information of the system.

Installation

First you need to download the Node binary package from the downloads page

insert image description here

After getting the link address, connect to the Linux system, here we take it as Ubuntuan example.

# 可以在/opt 或者/usr/local/bin 目录安装,这了我们选择 /usr/local/bin 
# 复制刚才的连接
sudo wget  https://github.com/prometheus/node_exporter/releases/download/v1.5.0/node_exporter-1.5.0.linux-amd64.tar.gz
sudo tar xvfz node_exporter-*.*-amd64.tar.gz
cd node_exporter-*.*-amd64
# 运行 node
./node_exporter

insert image description here

If you see the running log, it means success

Service

Usually, it needs to Nodebe set to run permanently in the background. You can use screen or make it Nodeinto a service. Here we choose the service

  1. Will Nodemove to the /usr/local/bin directory.
sudo cp node_exporter-*.*-amd64/node_exporter /usr/local/bin/
cd /usr/local/bin
ls
# node_exporter ......
  1. Create a systemd serviceconfiguration file. /etc/systemd/system/A node_exporter.servicefile named
cd /etc/systemd/system/
sudo touch node_exporter.service
sudo vim node_exporter.service

and copy the following into that file:

[Unit]
Description=Node Exporter

[Service]
User=root
Group=root
Restart=always
ExecStart=/usr/local/bin/node_exporter

[Install]
WantedBy=default.target
  1. After saving the file, reload the daemon and start node_exporterthe service and enable it to start automatically on system boot
sudo systemctl daemon-reload
sudo systemctl enable node_exporter
sudo systemctl start node_exporter
  1. Check the service running log
journalctl -u node_exporter.service

insert image description here

As shown in the figure, it is normal startup.

open port

Node_ExporterThe port is used by default 9100, and its port needs to be opened for Prometheusaccess, which can be set in the security group

Guess you like

Origin blog.csdn.net/majiayu000/article/details/129679976