How To Monitor Linux Servers Using Prometheus Node Exporter

Node exporter is the best way to collect all the Linux server related metrics and statistics for monitoring.

Monitor Linux Servers Using Prometheus

In this guide, you will learn how to setup Prometheus node exporter on a Linux server to export all node level metrics to the Prometheus server.

Before You Begin

  1. Prometheus Node Exporter needs Prometheus server to be up and running. If you would like to setup Prometheus, please see the Prometheus setup guide for Linux.
  2. Port 9100 opened in server firewall as Prometheus reads metrics on this port.

Setup Node Exporter Binary

Step 1: Download the latest node exporter package. You should check the Prometheus downloads section for the latest version and update this command to get that package.

Step 2: Unpack the tarball

Step 3: Move the node export binary to /usr/local/bin

Create a Custom Node Exporter Service

Step 1: Create a node_exporter user to run the node exporter service.

Step 2: Create a node_exporter service file under systemd.

Step 3: Add the following service file content to the service file and save it.

Step 4: Reload the system daemon and star the node exporter service.

READ  How To Setup and Configure Kubernetes Cluster On Google Cloud (GCE)

Step 5: check the node exporter status to make sure it is running in the active state.

Step 6: Enable the node exporter service to the system startup.

Now, node exporter would be exporting metrics on port 9100. 

You can see all the server metrics by visiting your server URL on /metrics as shown below.

Configure the Server as Target on Prometheus Server

Now that we have the node exporter up and running on the server, we have to add this server a target on the Prometheus server configuration.

Note: This configuration should be done on the Prometheus server.

Step 1: Login to the Prometheus server and open the prometheus.yml file.

Step 2: Under the scrape config section add the node exporter target as shown below. Change 10.142.0.3 with your server IP where you have setup node exporter. Job name can be your server hostname or IP for identification purposes.

Step 3: Restart the prometheus service for the configuration changes to take place.

Now, if you check the target in prometheus web UI (http://<prometheus-IP>:9090/targets) , you will be able to see the status as shown below.

prometheus node exporter status

Also, you can use the Prometheus expression browser to query for node related metrics. Following are the few key node metrics you can use to find its statistics.

READ  How To Mount Extra Disks on Google Cloud VM Instance

prometheus node exporter metric queries

 

Follow “Integrate And Visualize Prometheus Metrics In Grafana” blog to visualize the node exporter metrics in Grafana.

 

 

Free DevOps Resources

Get DevOps news, tutorials and resources in your inbox. A perfect way If you want to get started with devops. Like you, we dont like spam.