Saturday, July 30, 2022

How To Monitoring The Linux Servers Using Node exporter, Prometheus & Grafana

 

Prerequisites:
Let’s Start The Process:

Installing node_exporter on linux monitering Server:
  • Launch 3-Linux servers using AWS and open all traffic in Security Group for demo purpose only not recommended to open in real-time while working on projects.

Then login to Linux Server & move to /opt directory which you’re trying to moniter liken shown below. 
sudo 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 
  • Next open tar.gz file by using sudo tar xf like shown below
  • Next move that long name file of node-exporter into shortcut name as a node_exporter

  • Next chnage Directory  & move to node_exporter directory by using cd node_exporter 
  • Next run or execute that node_exporter on the same directory where you install Node exporter by
    sudo ./node_exporter


  • Copy public-i.p of Linux Monitor Server & Then move to browser click on search 

Prometheus Installation on another Linux Server:gThen login to Prometheus Server & move to cd /opt directory which you’re trying to
  • moniter liken shown below. 
Next install Prometheus on Linux Server by referring doc: https://prometheus.io/download/
sudo wget https://github.com/prometheus/prometheus/releases/download/v2.37.0/prometheus-
2.37.0.linux-amd64.tar.gz
  • Next open or extract tar.gz file by using sudo tar xf like shown below
  • Next After open that tar file remove that .gz file no longer need like this
  • Next rename to that Prometheus Software file its too long name 
    Next Move to Prometheus Directory cd Prometheus & then see the list of files and
    it will show the directories in the directory
  • Modify that Prometheus.yml file and add the host entries of Monitoring server like shown
    below
    Next Run that Prometheus.yml file to reflect the changes which we modified
    ./Prometheus.yml
    Copy public-I.P of the Prometheus Server & Then Move to browser and clcik on search 

    Grafana Installation on another Linux Server:
    Then login to Prometheus Server & move to cd /opt directory which you’re trying to
    moniter liken shown below. 
Next refer the Official Document of Grafana :
In that edit the file sudo vi /etc/yum.repos.d/grafana.repo
After modify service file then install the grafana software by sudo yum install grafana 

Then start the service using sudo systemctl start grafana-server 

  • Then Copy Public ip of Grafana server and access it from browser & login with default name as admin & password admin 
  • Next Configure data source as a Prometheus
  • Next Click on Import dashboard like shown 
    Then import and add dashboard from garafana labs avilabe predefine dashboard then finally
    monitor server 


  • Then finally you can moniter your Linux server using Prometheus & grafana help of node
    exporter
  •  
  • Note: Open all Traffic in Security Groups under Edit In-bound rules access from anywhere for all the 3 servers for demo purposes only 
  • If you need Grafana Dash Board from online searching with key word grafana-labs 0r grafana dashboards
  • I used here for demo purpose predefined Grafana Dash Board 1860

No comments:

Post a Comment