Skip to content

About

node exporter offline installer

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 

Repository files navigation

SIMPLE

🚀 Node Exporter Remote Installer

A simple Bash script that installs Node Exporter on a remote Linux server via SSH and automatically configures it as a systemd service.


📦 Prerequisites

Before running the script, download the desired Node Exporter release from the official GitHub releases page:

https://github.com/prometheus/node_exporter/releases

This script is configured by default for Node Exporter v1.8.1.

Download the archive:

wget https://github.com/prometheus/node_exporter/releases/download/v1.8.1/node_exporter-1.8.1.linux-amd64.tar.gz

Extract the archive:

tar -xzf node_exporter-1.8.1.linux-amd64.tar.gz

After extraction, your directory should look similar to:

.
├── install_node_exporter.sh
├── node_exporter-1.8.1.linux-amd64.tar.gz
└── node_exporter-1.8.1.linux-amd64/
    └── node_exporter

⚠️ Important:

The script expects the extracted Node Exporter binary to exist at:

node_exporter-1.8.1.linux-amd64/node_exporter

🔧 Make the Script Executable

Grant execute permissions:

chmod +x install_node_exporter.sh

▶️ Run the Script

Execute:

./install_node_exporter.sh

The script will prompt for the following information:

🌐 Remote Server IP Address

Example:

192.168.1.100

👤 SSH Username

Examples:

root
ubuntu

🔌 SSH Port

Default:

22

Custom:

2222

If left blank, the script automatically uses 22.


⚙️ What the Script Does

📤 Local Operations

  • Verifies that the Node Exporter binary exists locally.
  • Copies the binary to the remote server using SCP.

🖥️ Remote Operations

The script automatically:

  1. Creates a dedicated node_exporter user if it does not already exist.

  2. Moves the binary to:

    /usr/local/bin/node_exporter
    
  3. Sets ownership and permissions.

  4. Creates a systemd service file.

  5. Reloads systemd.

  6. Enables Node Exporter to start on boot.

  7. Starts the service immediately.

  8. Displays the service status.


📋 Remote Server Requirements

The remote SSH user must:

  • Have SSH access to the target server.
  • Have sudo privileges.
  • Be allowed to execute administrative commands such as:
sudo useradd
sudo mv
sudo tee
sudo systemctl

🔍 Verify Installation

Check service status:

sudo systemctl status node_exporter

Check whether Node Exporter is listening on port 9100:

ss -tulpn | grep 9100

or

netstat -tulpn | grep 9100

📈 Test the Metrics Endpoint

From your Prometheus server or any machine with network access:

curl http://SERVER_IP:9100/metrics

If the installation was successful, you should see Prometheus metrics output similar to:

# HELP go_gc_duration_seconds ...
# TYPE go_gc_duration_seconds summary
...

🔄 Installing Other Node Exporter Versions

The script is configured by default for v1.8.1:

NODE_EXPORTER_PATH="node_exporter-1.8.1.linux-amd64/node_exporter"

To use a different version:

  1. Download the desired Node Exporter release.
  2. Extract the archive.
  3. Update the NODE_EXPORTER_PATH variable inside the script.

Example:

NODE_EXPORTER_PATH="node_exporter-1.9.0.linux-amd64/node_exporter"

You may also update any version references in the documentation if desired.

This makes the script easy to adapt for newer Node Exporter releases.


🛠 Troubleshooting

Binary Not Found

If you see:

❌ Node Exporter binary not found

Make sure the archive has been extracted and that the following file exists:

node_exporter-1.8.1.linux-amd64/node_exporter

Permission Denied

Ensure the SSH user has sudo privileges on the remote server.

Service Failed to Start

Inspect the service logs:

sudo journalctl -u node_exporter -f

🎉 Result

After a successful installation:

  • Node Exporter runs as a dedicated system user.
  • The service starts automatically after reboot.
  • Metrics are exposed on port 9100.
  • The server is ready to be scraped by Prometheus.

Default metrics endpoint:

http://SERVER_IP:9100/metrics

About

node exporter offline installer

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages