Difference between revisions of "Node Exporter (Prometheus)"

From Nick's Personal Wiki
Jump to navigation Jump to search
Line 42: Line 42:
  
 
==Starting The Service==
 
==Starting The Service==
 +
Reload the systemd daemons:
 +
<nowiki>sudo systemctl daemon-reload</nowiki>
  
 +
Start the node_exporter service:
 +
<nowiki>sudo systemctl start node_exporter</nowiki>
 +
 +
Confirm the service started successfully via:
 +
<nowiki>sudo systemctl status node_exporter</nowiki>
 +
 +
If the service is running, enable it so that it starts on every boot:
 +
<nowiki>sudo systemctl enable node_exporter</nowiki>
 +
 +
We can also verify that it's listening/functioning with the below command:
 +
<nowiki>curl http://localhost:PORT/metrics</nowiki>
  
 
==Updating Prometheus Config==
 
==Updating Prometheus Config==

Revision as of 03:49, 28 March 2026

Installing Node_Exporter

Downloading The Package

Locate the appropriate package [here] and copy the URL (should be a Github link) for the below command:

wget LINK_GOES_HERE

Extract the package you downloaded via:

tar xvzf node_exporter-WHATEVER-VERSION-YOU-HAVE.tar.gz

Creating A User

Create a user for node_exporter without a home directory or shell login:

sudo useradd --no-create-home --shell /usr/sbin/nologin node_exporter

Relocating The Files/Directories

From the files extracted, copy the below to '/usr/local/bin/':

sudo cp node_exporter-WHATEVER-VERSION-YOU-HAVE/node_exporter /usr/local/bin/

Change ownership of those files to the node_exporter user:group that we created:

sudo chown node_exporter:node_exporter /usr/local/bin/node_exporter

Creating Systemd Service File

Create a .service file at the below location:

/etc/systemd/system/node_exporter.service

Input the below content into that new .service file:

[Unit]
Description=Node Exporter
Wants=network-online.target
After=network-online.target

[Service]
User=node_exporter
Group=node_exporter
Type=simple
ExecStart=/usr/local/bin/node_exporter \  # Make sure that each line of the ExecStart block ends in a \ EXCEPT for the final line
    --web.listen-address=:PORT            # Replace PORT with whatever the desired port number for node_exporter is, 9100 is default if this line is omitted

[Install]
WantedBy=multi-user.target

Starting The Service

Reload the systemd daemons:

sudo systemctl daemon-reload

Start the node_exporter service:

sudo systemctl start node_exporter

Confirm the service started successfully via:

sudo systemctl status node_exporter

If the service is running, enable it so that it starts on every boot:

sudo systemctl enable node_exporter

We can also verify that it's listening/functioning with the below command:

curl http://localhost:PORT/metrics

Updating Prometheus Config