server-monitoring-using-grafana-and-prometheus.jpg
Blogger_636621947188836984.jpg
By: Akhilesh NS

Server monitoring using Grafana and Prometheus

Grafana
Grafana is an associate, open supply metric analytics suite which can be used on top of a variety of different data stores. It is most commonly used for visualizing statistical knowledge for infrastructure and application analytics, however, several use it in different domains together with industrial sensors, home automation, weather, and process control.

Grafana help server monitoring by:

Visualize
From heatmaps to histograms. Graphs to geomaps.
Grafana encompasses an inordinately of visualization choices to assist you in perceiving your knowledge, beautifully.

Alert
Seamlessly outline alerts wherever it is sensible — whereas you’re within the knowledge. Grafana also gets you notified via varied communication mediums like Slack, PagerDuty etc and also defines the threshold in a visual format.

Unify
Grafana act as a platform to bring data from different sources and analyze each with others. Different databases like Mysql, PostgreSQL, etc have different monitoring packages available in Grafana and also can mix them together to better monitoring.

Prometheus
Prometheus is an open source computer code project written in Go, that real-time records the period of time metrics in very statistic info designed employing a hypertext transfer protocol pull model, with flexible queries and real-time alerting. Prometheus is not only a monitoring tool, but it also gives a better view of some of its hardware. Very useful for analyzing capacity and performance reporting when running into issues and use it for forecasting and increases in hardware.

Combination of Prometheus and Grafana
The combination of Prometheus and Grafana is changing into a lot of and a lot of common observance stack used for storing and visualizing statistic knowledge. Prometheus acts because of the storage backend and Grafana because of the interface for analysis and visualization. Prometheus collects metrics from monitored targets by scraping metrics from the hypertext transfer protocol endpoints on these targets.

In this blog, I am explaining about monitoring of basic system performance at its core level. Database monitoring will explain in my next blog.  

Install Grafana on Ubuntu 18.04 LTS
Use these terminal commands for Grafana stable version installation. 
1) wget https://dl.grafana.com/oss/release/grafana_5.4.3_amd64.deb
2) sudo apt-get install -y adduser libfontconfig
3) sudo dpkg -i grafana_5.4.3_amd64.deb

To start Grafana service
4) systemctl daemon-reload
5) sudo service grafana-server start

To configure the Grafana server to start at boot time:
6) sudo update-rc.d grafana-server defaults

This will start the grafana-server process as the grafana user, which was created during the package installation. 
a) Grafana’s default running port is 3000 and default user and password is admin. (To access Grafana goto: http://localhost:3000
b) Default login and password admin/ admin

server monitoring using grafana and prometheus

Fig 1. Grafana Login Page

server monitoring using grafana and prometheus

Fig 2. Grafana Home Page 

Install Prometheus on Ubuntu 18.04 LTS

Use these terminal commands for Prometheus installation. 
1) wget https://s3-eu-west-1.amazonaws.com/deb.robustperception.io/41EFC99D.gpg | apt-key add -
2) sudo apt-get update
3) sudo apt-get install prometheus prometheus-node-exporter prometheus-pushgateway prometheus-alertmanager
4) sudo service prometheus status

This will start Prometheus on localhost:9090. Prometheus doesn't require any login credentials.

server monitoring using grafana and prometheus


Fig 3. Prometheus Home Page

For our basic system monitoring, no more configurations required. The file “prometheus.yml” have built-in configurations.

Create our First Grafana Dashboard

1) Goto Grafana Home page and click on: Create your First Data Source 

server monitoring using grafana and prometheus

Fig 4. New Data source page

2) Select Prometheus from the list. If it not present, search  Prometheus on the search box.

server monitoring using grafana and prometheus

Fig 5.Prometheus Configuration

3) Enter Name and Basic Auth Details (Give grafana user name and password for Basic Auth Details). The default settings enough for  Prometheus. Save the information. 

4) Find an Official & community built a dashboard from https://grafana.com/dashboards
for basic system monitoring,  I am using CPU Utilization Details (Cores) [ID: 4151] custom dashboard. Copy the dashboard ID from here. 

server monitoring using grafana and prometheus

Fig 6. CPU Utilization dashboard 

5) To import the above dashboard to our Grafana, Go to manage the menu from Dashboard Icon:

server monitoring using grafana and prometheus

Fig 7. Dashboard menus

6) Click Import Button

server monitoring using grafana and prometheus

Fig 8. Dashboard Import page

7) Paste dashboard ID and load.


server monitoring using grafana and prometheus

Fig 9. Prometheus Import

8) Select system Prometheus instance and click Import. Now our first dashboard is ready to use. From the dashboard, home selects the CPU Utilization dashboard. It will give a beautiful system monitoring UI.

server monitoring using grafana and prometheus

Fig 10. Dashboard row

server monitoring using grafana and prometheus

Fig 11. Core wise CPU utilization

If you want to customize the above dashboard or graph click the graph and edit Prometheus parameters. Also, export the graph data to the CSV file. 

server monitoring using grafana and prometheus

Fig 12. Dashboard panel options

server monitoring using grafana and prometheus

Fig 13. Panel query editor

Enjoy Grafans features and become a pro on server management. 




Comments

1

Nico Bustillos

08/04/2019 - 1:37PM

Great stuff!! Will definitely try it out on a Odoo installation




Leave a comment

 
Calicut

Cybrosys Technologies Pvt. Ltd.
Neospace, Kinfra Techno Park
Kakkancherry
Kerala, India - 673635

London

Cybrosys Limited
Alpha House, 100 Borough High Street,
London, Greater London,
SE1 1LB, United Kingdom

Kochi

Cybrosys Technologies Pvt. Ltd.
1st Floor, Thapasya Building,
Infopark, Kakkanad,
Kochi, India - 682030.

Bangalore

Cybrosys Techno Solutions
The Estate, 8th Floor,
Dickenson Road,
Bangalore, India - 560042

Send Us A Message