[Monitoring system] Prometheus monitoring component Node-Exporter configuration actual combat

In this section, let's configure Node-Exporter, so let's first understand what is Prometheus Exporter?

Any program that provides monitoring sample data to Prometheus can be called an Exporter, which is a tool for providing indicators from different data sources to Prometheus for collection and monitoring. Code running on an application, computer, network device, or other system that exposes system metrics in a standard format. Expose metrics data as HTTP endpoints or specified formats (such as Redis, JMX, etc.), which Prometheus can then poll or specify crawlers.

Exporter is the indicator data collection component of Prometheus, which is responsible for collecting data from target Jobs. And convert the collected data into the time series data format supported by Prometheus. It is only responsible for collecting, and does not send data to the server, but waits for the Prometheus Server to actively grab it.

insert image description here

The Prometheus community and other teams have developed a large number of Exporters, covering many different types of systems and services. Node Exporter, MySQL Exporter, Redis Exporter, MongoDB Exporter, Nginx Exporter…

How to use : Install an Exporter program on the host, which exposes an HTTP access address for obtaining current monitoring sample data. Prometheus regularly obtains monitoring data samples from these Targets through polling and stores them in the database.

Case combat - installation and deployment **node_exporter **

node_exporter is used to collect hardware and system indicators of UNIX-like kernels, including CPU, memory and disk.

Download the node_exporter component

https://prometheus.io/download/
https://github.com/prometheus/node_exporter/releases/download/v1.5.0/node_exporter-1.5.0.linux-amd64.tar.gz

Download the installation package to the Linux server

#解压
tar -zxvf node_exporter-1.6.0.linux-amd64.tar.gz

insert image description here

Configure startup files and set self-startup: vi /usr/lib/systemd/system/node_exporter.service

Note: ExecStart configures the node_exporter launcher under the node_exporter directory

insert image description here

[Unit]
Description=node_exporter
Documentation=https://prometheus.io/
After=network.target
 
[Service]
Type=simple
ExecStart=/usr/local/software/node_exporter/node_exporter \
--collector.ntp \
--collector.mountstats \
--collector.systemd \
--collector.tcpstat
 
ExecReload=/bin/kill -HUP $MAINPID
Restart=on-failure
 
[Install]
WantedBy=multi-user.target

Start node_exporter, set boot self-start, check service startup

systemctl start node_exporter
 
systemctl enable node_exporter
 
netstat -natp | grep :9100

[root@localhost /]# netstat -natp | grep :9100
tcp6       0      0 :::9100                 :::*                    LISTEN      1390/node_exporter  

You can view monitoring information by visiting http://IP+9100/metrics through a browser

insert image description here

Add the configuration of the monitored machine to the Prometheus server vim prometheus.yml, and the target can also write ip

  - job_name: 'agent-1'
    static_configs:
      - targets: ['ip:9100']

insert image description here

Dynamic update configurationcurl -X POST http://localhost:9090/-/reload

Check whether the target and configuration of the Web UI interface have corresponding data

insert image description here

insert image description here

insert image description here

Ok, the practical operation of the Prometheus monitoring component Node-Exporter is over, remember to pay attention!

insert image description here

Guess you like

Origin blog.csdn.net/weixin_47533244/article/details/131712609