Prometheus Node Exporter on AWS EC2
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.
cd /tmp
wget https://github.com/prometheus/node_exporter/releases/download/v1.4.0-rc.0/node_exporter-1.4.0-rc.0.linux-amd64.tar.gz
Step 2: Unpack the tarball
tar -xvf node_exporter-0.18.1.linux-amd64.tar.gz
Step 3: Move the node export binary to /usr/local/bin
sudo mv node_exporter-0.18.1.linux-amd64/node_exporter
/usr/local/bin/
Create a Custom Node Exporter Service:
Step 1: Create a node_exporter user to run the node exporter
service.
sudo useradd -rs /bin/false node_exporter
Step 2: Create a node_exporter service file under systemd.
sudo vi /etc/systemd/system/node_exporter.service
Step 3: Add the following service file content to the service file
and save it.
[Unit]
Description=Node Exporter
After=network.target
[Service]
User=node_exporter
Group=node_exporter
Type=simple
ExecStart=/usr/local/bin/node_exporter
[Install]
WantedBy=multi-user.target
Step 4: Reload the system daemon and star the node exporter service.
sudo systemctl daemon-reload
sudo systemctl start node_exporter
Step 5: check the node exporter status to make sure it is running in the active state.
sudo systemctl status node_exporter
Step 6: Enable the node exporter service to the system startup.
sudo systemctl enable node_exporter
Step 7: Access Node Exporter Web UI
http://serverip:9100/metrics
Setup 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.
sudo vi /etc/prometheus/prometheus.yml
Step 2: Under the scrape config section add the node exporter
target as shown below.
- job_name: 'node_exporter_metrics'
scrape_interval: 5s
static_configs:
- targets:
['serverip:9100']
Step 3: Restart the prometheus service for the configuration
changes to take place.
sudo systemctl restart prometheus
Step 4: Access Node Exporter on Prometheus Web UI
http://ec2serverip:9090/targets
Learn about What is Prometheus? and How does it work?
---
Thanks & Regards,
Kanchan Soni
(A girl who saw the dream with an open eye to compete with self capability in the area of IT and its Next-Gen Technology, with the ability to complete the task with perfection.)
Email: kanchansoni.cse@gmail.com
Comments
Post a Comment