VPS monitor with graphana + prometheus + node_exporter


Natvps.id – There are many ways to conduct monitoring servers. Besides using software Like Nezha and Status, there are options that are no less popular such as using Prometheus + Node_Exporter and combining it with grafana.

This article discusses the steps to install Grafana + Prometheus + node_exporter on VPS. This article uses Ubuntu 22.04 as an OS basis. Other linux distributions (such as Debian & Centos) can be used, but several steps are possible. Please adjust the installation stages.

In short, grafana, prometheus, and node_exporter have different roles:

  • Erode: Used to visualize data from sources such as Prometheus
  • Prometheus: Data source for graphana. Prometheus collects data from various sources (such as node_exporter) which are then connected to grafana
  • node_exporter: Data sender / exporter which contains information about the system, then sent to Prometheus

The order is like this: node_exporter -> Prometheus -> Grafana.

PORT

Because we use NAT VPS, we need to add a Port Forwarding configuration to be able to access Grafana & Prometheus.

This is the port used:

  • Grafana -> 3000
  • Prometheus -> 9090

Add the forward port to the two ports. As an example:

Install graphana

First, install a few packaging it is needed:

sudo apt install -y apt-transport-https software-properties-common wget

Add GPG key to verification of authenticity binary GRAFANA:

sudo mkdir -p /etc/apt/keyrings/ && \
wget -q -O -  | gpg --dearmor | sudo tee /etc/apt/keyrings/grafana.gpg > /dev/null

Add graphana repository:

echo "deb [signed-by=/etc/apt/keyrings/grafana.gpg]  stable main" | sudo tee -a /etc/apt/sources.list.d/grafana.list

Finally, install graphana using:

sudo apt update
sudo apt install grafana -y

Wait until the installation process is complete.

Finally, activate graphana by entering the command:

sudo systemctl daemon-reload
sudo systemctl enable --now grafana-server

Install Prometheus

First, make it user new specifically for Prometheus:

sudo useradd -M -U prometheus

Then, download the latest release of Prometheus. To check it, please open then copy the download link for OS linux and architecture amd64. When this article was written, the latest version was v3.4.2.

wget  -O prometheus.tar.gz
tar -xzvf prometheus.tar.gz
sudo mv prometheus-* /opt/prometheus

Replace Permission Directory for User prometheus:

sudo chown prometheus:prometheus -R /opt/prometheus

To activate Prometheus, we can create a system system system so that it can run in the background.

apt install nano -y # Jika belum
sudo nano /etc/systemd/system/prometheus.service

Paste the following code:

# 
# Reference: 

[Unit]
Description=Prometheus Server
Documentation=
After=network-online.target

[Service]
User=prometheus
Group=prometheus
Restart=on-failure
ExecStart=/opt/prometheus/prometheus \
  --config.file=/opt/prometheus/prometheus.yml \
  --storage.tsdb.path=/opt/prometheus/data \
  --storage.tsdb.retention.time=30d

[Install]
WantedBy=multi-user.target

Save the file with Ctrl-X, Y, then enter.

Finally, activate the Prometheus unit system with the command:

sudo systemctl daemon-reload
sudo systemctl enable --now prometheus.service

Install node_exporter

Just like Prometheus, make it user new specifically for node_exporter:

sudo useradd -M -U node_exporter

Download node_exporter via the Prometheus page. Just like before, to check it, please open the slide down to the part node_exporter Then copy the download link for OS linux and architecture amd64. When this article was written, the latest version was V.1.9.1.

wget  -O node_exporter.tar.gz
tar -xzvf node_exporter.tar.gz
sudo mv node_exporter-*/node_exporter /usr/local/bin

Change permissions for users node_exporter:

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

To activate the node_exporter, we can create a system system system so that it can run in the background.

apt install nano -y # Jika belum
sudo nano /etc/systemd/system/node_exporter.service
# 
# Reference: 

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

[Service]
Type=simple
User=node_exporter
Group=node_exporter
ExecStart=/usr/local/bin/node_exporter \
--collector.mountstats \
--collector.logind \
--collector.processes \
--collector.ntp \
--collector.systemd \
--collector.tcpstat \
--collector.wifi
Restart=always
RestartSec=10s

[Install]
WantedBy=multi-user.target

Activate the system unit with orders:

sudo systemctl daemon-reload
sudo systemctl enable --now node_exporter.service

Prometheus configuration

Book Give

nano /opt/prometheus/prometheus.yml

At the lowest row, add:

  - job_name: node
    static_configs:
      - targets: ['localhost:9100']

Restart Prometheus with:

systemctl restart prometheus.service

Login graphana

Open the graphana through a predetermined port:

Default User Names & Passwords are Admin. Please change after successful login.

Add Datasource Prometheus

Open menu (graphana logo) -> connection -> data source.

Select Add Data Source.

Choose Prometheus.

You will be directed to the datasource configuration, in the connection section, enter

Click Save & test. If successful, successful notifications will appear.

Make a dashboard

Enter the menu -> Dashboards

Choose Create a dashboard

Choose Import of dashboard To use an idashboard that has been made by the community.

Enter ID 1860 Then click Load.

Choose Prometheus As datasource, then click Import.

Finished. The node_exporter dashboard has been added to grafana, and system information can be seen.

Cover

Thus this article is about the steps to install Gowhatsapp on NAT VPS. If you are confused or doubtful, don’t hesitate to ask questions in the telegram group @ipv6indonesia. Thank You!



Game Center

Game News

Review Film
Rumus Matematika
Anime Batch
Berita Terkini
Berita Terkini
Berita Terkini
Berita Terkini
review anime

Gaming Center