The cart is empty

Prometheus is an open-source monitoring and alerting system commonly used for monitoring hardware and system metrics. One of the key tools for collecting these metrics is Node Exporter, which is designed to gather information about the operating system and hardware, which can then be utilized by the Prometheus server. In this article, we will focus on how to install, configure, and use Node Exporter on CentOS for effective monitoring.

Installation of Node Exporter

The first step is to install Node Exporter on CentOS. This can be achieved by downloading the latest version of Node Exporter from the official Prometheus project website. You can use the following command in the terminal:

wget https://github.com/prometheus/node_exporter/releases/download/v*/node_exporter-*.*-amd64.tar.gz

Replace the asterisks with the current version of Node Exporter. After downloading the file, unpack it and move it to a suitable directory:

tar xvfz node_exporter-*.*-amd64.tar.gz
sudo mv node_exporter-*.*-amd64 /usr/local/bin/node_exporter

Creating a systemd Service

To ensure automatic startup of Node Exporter when the system boots, it is recommended to create a systemd service for it. Create a systemd service file using a text editor, such as nano:

sudo nano /etc/systemd/system/node_exporter.service

Insert the following configuration into this file:

[Unit]
Description=Node Exporter

[Service]
User=node_exporter
ExecStart=/usr/local/bin/node_exporter

[Install]
WantedBy=default.target

Save the file and enable the service to start on boot:

sudo systemctl daemon-reload
sudo systemctl enable node_exporter
sudo systemctl start node_exporter

Configuration of Prometheus Server

To allow Prometheus to collect metrics from Node Exporter, you need to add configuration for this exporter to the Prometheus configuration file. In the prometheus.yml file, which is usually located in /etc/prometheus/ or in the directory where you have Prometheus installed, add a scrape_configs section:

scrape_configs:
  - job_name: 'node_exporter'
    static_configs:
      - targets: ['localhost:9100']

This configuration tells Prometheus to regularly collect metrics from Node Exporter running on localhost on port 9100. After adding this configuration, restart the Prometheus server to apply the changes:

sudo systemctl restart prometheus

Monitoring and Data Visualization

After configuring Prometheus and Node Exporter, it is now possible to monitor hardware and system metrics of your CentOS server. For better visualization and analysis of the collected data, it is recommended to use Grafana, which allows creating dashboards with graphs and alarms based on data from Prometheus.

To connect Grafana to Prometheus, simply add Prometheus as a data source in the Grafana settings and start creating dashboards according to your needs.

 

Node Exporter, in conjunction with Prometheus and Grafana, provides a comprehensive solution for monitoring hardware and system metrics on CentOS servers. Its simple installation and configuration, coupled with the ability to monitor system and hardware parameters in detail, enable system administrators and DevOps engineers to maintain systems in optimal condition and prevent potential issues.

Prometheus and Node Exporter are both open-source tools, with a vast community and many available resources for support in configuration, issue resolution, and optimization of monitoring strategies. In addition to official documentation, numerous guides, tutorials, and user contributions share experiences and best practices.

In conclusion, Node Exporter is an invaluable tool for collecting crucial metrics from CentOS servers, which, when combined with Prometheus and Grafana, forms a robust solution for monitoring and visualizing data. Its ease of installation and configuration, along with the ability to monitor system and hardware parameters comprehensively, empower system administrators and DevOps engineers to maintain systems optimally and preempt potential issues.