> ## Documentation Index
> Fetch the complete documentation index at: https://notes.kodekloud.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Node Exporter systemd

> Instructions to install and configure node_exporter as a systemd service, create a dedicated non-login user, enable it at boot, and verify metrics are exposed.

As with [Prometheus](https://prometheus.io/), starting node\_exporter directly runs it in the foreground and does not enable it to start automatically on boot. To have systemd manage node\_exporter (so you can use commands like `systemctl start node_exporter` and have it start on boot), follow the steps below.

Overview of the steps

* Download and extract the node\_exporter binary (if you haven't already).
* Move the binary to `/usr/local/bin`.
* Create a dedicated (non-login) user for node\_exporter.
* Ensure the node\_exporter binary is owned by that user.
* Add a systemd service unit for node\_exporter.
* Reload systemd, start, enable, and verify the service.
* Verify metrics are exposed at `/metrics`.

Commands and service unit

1. Change into the node\_exporter directory (after downloading and extracting):

```bash theme={null}
# Example: change into the extracted node_exporter directory
cd node_exporter-*/    # adjust to your extracted folder name
```

2. Copy the node\_exporter binary to `/usr/local/bin`:

```bash theme={null}
sudo cp node_exporter /usr/local/bin/
sudo chmod 0755 /usr/local/bin/node_exporter
```

3. Create a dedicated user for running node\_exporter:

```bash theme={null}
# Create a system user without a login shell and without creating a home directory
sudo useradd --no-create-home --shell /usr/sbin/nologin --system node_exporter
```

4. Make the node\_exporter binary owned by the node\_exporter user:

```bash theme={null}
sudo chown node_exporter:node_exporter /usr/local/bin/node_exporter
```

<Callout icon="lightbulb" color="#1CB2FE">
  It's good practice to run exporters as a non-privileged, system user (no shell and no home). This reduces the blast radius if the exporter is compromised.
</Callout>

5. Create the systemd service unit at `/etc/systemd/system/node_exporter.service`. The unit tells systemd to wait for the network to be online before starting the service and ensures it becomes part of the normal multi-user startup:

```ini theme={null}
[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

[Install]
WantedBy=multi-user.target
```

6. Reload systemd to pick up the new unit, start the service, and enable it at boot:

```bash theme={null}
sudo systemctl daemon-reload
sudo systemctl start node_exporter
sudo systemctl enable node_exporter
```

7. Verify the service is running:

```bash theme={null}
sudo systemctl status node_exporter
```

You should see an active (running) state in the status output.

8. Confirm node\_exporter is exposing metrics (default port 9100) by curling the metrics endpoint:

```bash theme={null}
curl http://localhost:9100/metrics
```

You should see plain-text Prometheus metrics returned. Prometheus can now be configured to scrape this target (add `localhost:9100` or the appropriate host:port to your Prometheus scrape targets).

That’s all — node\_exporter is now managed by systemd, runs as a dedicated user, and will start automatically on boot.

<CardGroup>
  <Card title="Watch Video" icon="video" cta="Learn more" href="https://learn.kodekloud.com/user/courses/prometheus-certified-associate-pca/module/e03e8702-ef6c-4402-b626-4437fc40b513/lesson/73d167e2-f9bc-4d37-97b6-897fdb184b85" />
</CardGroup>
