How to install Node Exporter on CentOS 7 - Linux Monitoring
top of page

How to install Node Exporter on CentOS 7 - Linux Monitoring

Updated: Dec 12, 2022

Prometheus is a complete monitoring and trending system with built-in and active scraping, storing, querying, graphing and alerting based on time series data.


First, you need to configure Prometheus node exporter on a Linux server.

Download & configure Node Exporter

Copy URL of the Node Exporter from the official download page, or this link for version 1.2.2.linux-amd64.


Paste the copied URL after wget in the following command:

$ wget https://github.com/prometheus/node_exporter/releases/download/v1.2.2/node_exporter-1.2.2.linux-amd64.tar.gz

Extract the downloaded package:

$ tar -xzvf node_exporter-1.2.2.linux-amd64.tar.gz

Create a user for the node exporter:

$ sudo useradd -rs /bin/false nodeusr

Move binary to “/usr/local/bin” from the extracted package:

$ sudo mv node_exporter-1.2.2.linux-amd/node_exporter /usr/local/bin/

Create a system service fil for the node exporter:

$ sudo vim /etc/systemd/system/node_exporter.service

Add the following content to the file:

[Unit]
Description=Node Exporter
After=network.target

[Service]
User=nodeusr
Group=nodeusr
Type=simple
ExecStart=/usr/local/bin/node_exporter

[Install]
WantedBy=multi-user.target

Save & exit file.


Reload the system daemon:

$ sudo systemctl daemon-reload

Enable boot-up system service auto-start after rebooting:

$ sudo systemctl enable node_exporter

Add a firewall rule to allow node exporter:

$ sudo firewall-cmd --zone=public --add-port=9100/tcp --permanent

Reload firewall service:

$ sudo systemctl restart firewalld

View the metrics browsing node explorer URL:

http://IP-Address:9100/metrics

Add target to Prometheus YAML configuration file

Add configured node exporter target on Prometheus Server.

Login to Prometheus server and modify the prometheus.yml file


Edit the file:

$ sudo vim /etc/prometheus/prometheus.yml

Add the following configurations under the scrape config.

 - job_name: 'node_exporter_centos'
    scrape_interval: 5s
    static_configs:
      - targets: ['10.94.10.209:9100']
 

Restart Prometheus service:

$ sudo systemctl restart prometheus

Login to Prometheus server web interface, and check targets

http://Prometheus-Server-IP:9090/targets

You can click the graph and query any server metrics and click execute to show output. It will show the console output.


16,995 views0 comments
Stationary photo

Be the first to know

Subscribe to our newsletter to receive news and updates.

Thanks for submitting!

Follow us
bottom of page