Indonesia Website Awards
Indonesia Website Awards

In the previous article I discussed how to install Prometheus on Linux. This time, as promised, I will share information about how to install node_exporter on linux. Before we starting, need to know, node_exporter is an OS / Server exporter of Prometheus. Where node_exporter itself acts as a metrics collector for a server. This will be very helpful in measuring and monitoring server resources such as CPU usage, RAM usage, DISK usage, and etc. OK, let’s get started with the installation:

1. Install node_exporter on Linux

1.1. Install node_exporter on Linux CentOS 7

Preparation & Install node_exporter

  • Create user for node_exporter ( without home directory )

useradd --no-create-home --shell /bin/false node_exporter

  • Download and extract node_exporter
curl -LO https://github.com/prometheus/node_exporter/releases/download/v1.0.1/node_exporter-1.0.1.linux-amd64.tar.gz
tar xzvf node_exporter-1.0.1.linux-amd64.tar.gz

/* note : adjust the version and type of your linux */
  • Copy node_exporter into bin directory and change ownership to node_exporter user
cp node_exporter-1.0.1.linux-amd64/node_exporter /usr/local/bin
chown node_exporter:node_exporter /usr/local/bin/node_exporter

Node_exporter service

    • Create service for node_exporter

    vim /etc/systemd/system/node_exporter.service

    • Fill in node_exporter.service file whit this
    [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
    • Reload daemon for register node_exporter.service

    systemctl daemon-reload

    • Activate node_exporter service and check the status
    systemctl enable node_exporter
    systemctl start node_exporter
    systemctl status node_exporter

    1.2. Install node_exporter on Linux Ubuntu

    For node_exporter installation on Ubuntu, the method is also the same as installing on CentOS 7, so you can follow the method described above 😀

     

    2. Allow ports on firewall (optional)

    If you manage your port access with a firewall, you need to open port 9100 for prometheus access. Here are several ways to open a port for prometheus:

    • allow ports on ufw firewall

    sudo ufw allow 9100/tcp

    • allow ports on iptables
    iptables -A INPUT -p tcp --dport 9100 -j ACCEPT
    iptables-save | sudo tee /etc/sysconfig/iptables
    systemctl restart iptables

    3. Access node_exporter

    At this point, node_exporter should have been successfully installed. Very good! Then we can access it at http://IP_ADDR:9100. it will look like this :

    how to install node_exporter on linux

    Node_exporter

    Then, click Metrics to display all metric data available at node_exporter. It will look like this:

    node_exporter metrics

    Node_exporter Metrics

    Okay, until here you have successfully installed node_exporter. In the next article, I will discuss grafana and how to combine it with prometheus & node_exporter for real-time server monitoring. I will also discuss how to connect node_exporter with prometheus which I haven’t had the chance to discuss in this post. Thank you to all of you 😉

     

    Also Read :

    0 Comments

    Leave a Reply

    Avatar placeholder

    Your email address will not be published. Required fields are marked *