in FOSS

How to Install Grafana for System Monitoring on Ubuntu 18.04

How to Install Grafana for System Monitoring on Ubuntu 18.04

Grafana is an open source software for analytics and monitoring that supports more than 30 data sources. Previously I installed Prometheus on the Ubuntu server and the data will be visualized on Grafana.

0.Install Grafana

Download the GPG key and add the Grafana repository.

Install Grafana.

Activate grafana-server.

1.Disable Anonymous Registration and Access

Open the Grafana configuration file.

Look for allow_sign_up under [users], remove ;then fill in the value to false.

Look for enabled under [auth.anonymous], remove ; then fill in the value to false.

Restart grafana-server.

2.Update User and Password

Browse for http://SERVER-IP: 3000, login with user = admin and password = admin. After logging in successfully, you will be asked to change the admin password.

Change password

Change password

3.Add Data Source

Previously on this server Prometheus was installed. Data from Prometheus will be visualized or displayed on Grafana.

  1. Click Add data source.
  2. Click Select on Prometheus.
  3. URL = http://SERVER-IP:9090, (Prometheus server)
  4. Click Save & Test.
  5. If successful message appears Data source is working.
Grafana Home

Grafana Home

Add data source

Add data source

4.Create Dashboard

Next create a Dashboard while creating a panel for the server status whether Up or Down.

  1. Click menu + Create -> Dashboard.
  2. Click Choose Visualization.
  3. Click Singlestat
  4. At Value Mappings, add Set value mappings, 1 -> UP dan 0 -> DOWN.
  5. Click Queries, at Query choose data source Prometheus.
  6. At Metrics enter up{instance="NODE-EXPORTER-IP:9100",job="node_exporter"}.
  7. Click General, at Title enter title panel Status.
  8. Click Save
  9. Enter Dashboard name, Save.
New Dashboard - New Panel

New Dashboard – New Panel

Panel editor - Query

Panel editor – Query

Dashboard

Dashboard

5.Add Panel

Add a new panel to monitor other resources, for example to monitor CPU usage.

  1. Click Add Panel.
  2. Click Choose Visualization.
  3. Click Graph.
  4. At Axes, Unit percent (0-100).
  5. At Legend, As Table = on, Current = on.
  6. Click Queries, Queury choose data source Prometheus.
  7. At Metrics, masukkan 100 - (avg by (instance) (irate(node_cpu_seconds_total{instance="NODE-EXPORTER-IP:9100",job="node_exporter",mode="idle"}[5m])) * 100).
  8. Click General, Title enter CPU Used.
  9. Click Save.
  10. ESC.
Status Panel - CPU Used Panel

Status Panel – CPU Used Panel

Add panels according to the needs of the monitoring system. Noteworthy is the selection of visualizations, metrics, and units.

Good luck 🙂

Write a Comment

Comment