Monitoring with Prometheus


Prometheus is a free software application used for even monitoring and alerting.

It records real time metrics in a time series database built using a HTTP pull model, with flexible queries and real-time alerting.


Why monitoring?

When we build an application, problems will occur regardless of how well it has been designed or built. In order to be prepared for dealing with any problems, we should be able to collect logs and diagnose when something goes wrong.

Monitoring is a valuable source of information on which you can decide how to act upon a problem in the system. To monitor your application efficiently, in general, you need something to measure, visualize the states and alert when something goes wrong.

What is Prometheus?

Prometheus is an open source monitoring framework written in Go. 
PromQL (Prometheus Query Language) can be used to query the prometheus data, and it has no reliance on the distributed storage as single server nodes are autonomous.
Prometheus uses HTTP interface, and timeseries collection happens via a pull model. It has Python client, which can be easily used by most of the data professionals, and also supports multiple modes of graphing and dashboarding.

The prometheus consists of the following componenets:
  • Server
    The main Prometheus server (standalone) that scrapes and stores time series data
  • Client
    The client libraries for instrumenting application code
  • Push gateway
    Push gateway supports short-lived jobs
  • Exporters (special-purpose)
    Special-purpose exporters for services like HAProxy, StatsD, Graphite, etc
  • Alert manager
    Handles alerts
  • Other support tools

It scrapes metrics from instrumented jobs, stores all scraped samples, and runs rules over this data to aggregate data or create alerts. Each prometheus server is standalone and does not depend on network storage or other remote services.

Prometheus has 4 default data types:
- Counter
- Gauge
- Histogram
- Summary

It is suitable for platform, dynamic service-oriented monitoring, and collecting multi-dimensional data is also possible for micro-services. It is designed for reliability so that problems can be quickly diagnosed even during an outage. In a lot of cases they combine Grafana with Prometheus to visualize and create an extensive dashboard. 

Comments