{Prometheus}
{An Ideal Tool for
Monitoring}
{Why Monitoring?}
System malfunction can happen anytime and we won’t be able to monitor the
complete system for 24x7.
Once we are done with the infrastructure setup and our system is running live in
production so we have to ensure that everything is running fine.
We need to keep the record of our system as well for analysis, for example:- at
which time our system gets failed and what is the request count at that time
People who are monitoring the system will not be that much technical sometimes,
so we need a easier way for them to determine that something is not right in the
system
{Why Monitoring?}
After System failure, Client’s
reaction
I don’t want to become this
{What is Monitoring?}
Once the incident has been
detected, monitoring system is
needed to alert the stakeholders as
well
Monitoring is way of collecting the
different metrics of your system to
analyze and report them
One more key advantage of using
the monitoring system is that on the
basis of historical data, we can
predict what system level changes
needs to be done
{What we usually monitor?}
{What else can we monitor?}
And many more….
{How monitoring works?}
{Why Prometheus?}
Because this is the monitoring tools we need deserve.
{What is Prometheus?}
Prometheus is a time-series database which scrapes the metrics from
HTTP/HTTPS endpoint. It is written in Golang.
Originally developed by Soundcloud developers to monitor the systems like
Kubernetes.
Prometheus provides natives support to some services which means that they
doesn’t require any kind of monitoring agent, for example:- Kubernetes, ETCD,
SkyDNS.
Second project after the Kubernetes to graduate from CNCF and right now
it’s being managed by CNCF as well.
{Prometheus is different from Others}
Prometheus doesn’t depends on particular monitoring agent, also
exporters(monitoring agent) can be written in any language.
It’s a time series database, so we can easily take incremental backup of our
monitoring data.
Service Discovery feature is offered in Prometheus. By using this feature we
don’t have to define static targets in configuration.
A flexible query language in form of PromQL for time series data aggregation
and prediction.
{Time-series Database}
In human words, we can say time-series database is a database which simply
track, monitor, aggregate and downsample data over the time.
{Prometheus Architecture}
LAB 01
{Pull vs Push Model}
{Push Model in Prometheus}
Prometheus doesn’t exactly supports the push based model directly, to
achieve the push based model in Prometheus we can use another part of
Prometheus i.e. Push gateway.
Push gateway receives the metrics from different exporters(agents) and after
that Prometheus pulls the data from Push gateway
{Exporters}
Exporters are kind of monitoring agent for Prometheus which fetches the data
from different system and softwares and convert them into Prometheus time-
series format.
A single exporter exports the metrics for a particular kind of system or
software. For example- Redis exporter will export data for Redis database.
Exporters can be categorized into two parts- Third Party and Official. More
information about exporters can be found here
https://prometheus.io/docs/instrumenting/exporters/
Exporters can be written in any language(not necessarily in Golang) because
of multiple client libraries support.
{Exporters}
{Configuration}
----
global:
scrape_interval: 15s
evaluation_interval: 15s
alerting:
alertmanagers:
- static_configs:
- targets:
rule_files:
- "first_rules.yml"
scrape_configs:
- job_name: 'prometheus'
static_configs:
- targets: ['localhost:9090']
LAB 02
{PromQL}
PromQL is a Prometheus language for creating and executing queries to
extract or aggregate data in Prometheus.
It uses Prometheus’s Key Value based data representation and returns the
value.
Some example of Prometheus vectors are:-
● Range Vector - To calculate the values in Prometheus for a period of
time.
● Instant Vector - It will give the data output for the last time interval
{PromQL}
{Alerting with AlertManager}
AlertManager is used to handle alerts for client applications(like Prometheus).
It also takes care of alerts deduplicating, grouping and then routes them to
different receivers such as E-mail, Slack, Pagerduty.
AlertManager can be configured via command-line flags and configuration
files.
Prometheus AlertManager can be setup as an individual component as well
and can be get used to send notifications to different mediums by Webhook
trigger.
{AlertManager Integration}
LAB 03
{Prometheus Service Discovery}
It’s hard to update the configuration file each time if we have large
infrastructure. To overcome this, Prometheus supports service discovery
feature.
In Prometheus service discovery, the machine or agents will automatically get
registered to be monitor. No service restart required in case of new
monitoring agents.
Prometheus supports service discovery with different services like:- AWS, GCP,
Azure, Kubernetes, Consul, Docker, and Digitalocean.
{Prometheus Service Discovery Architecture}
LAB 03
{Summary}
Why Monitoring, Types of Monitoring, and its Working.
Prometheus a TSDB and scraping metrics.
Prometheus Architecture and Workflow model.
Exporters and Prometheus Configuration.
PromQL.
Alert Manager, and Service Discovery.

Prometheus workshop

  • 1.
  • 2.
    {Why Monitoring?} System malfunctioncan happen anytime and we won’t be able to monitor the complete system for 24x7. Once we are done with the infrastructure setup and our system is running live in production so we have to ensure that everything is running fine. We need to keep the record of our system as well for analysis, for example:- at which time our system gets failed and what is the request count at that time People who are monitoring the system will not be that much technical sometimes, so we need a easier way for them to determine that something is not right in the system
  • 3.
    {Why Monitoring?} After Systemfailure, Client’s reaction I don’t want to become this
  • 4.
    {What is Monitoring?} Oncethe incident has been detected, monitoring system is needed to alert the stakeholders as well Monitoring is way of collecting the different metrics of your system to analyze and report them One more key advantage of using the monitoring system is that on the basis of historical data, we can predict what system level changes needs to be done
  • 5.
  • 6.
    {What else canwe monitor?} And many more….
  • 7.
  • 8.
    {Why Prometheus?} Because thisis the monitoring tools we need deserve.
  • 9.
    {What is Prometheus?} Prometheusis a time-series database which scrapes the metrics from HTTP/HTTPS endpoint. It is written in Golang. Originally developed by Soundcloud developers to monitor the systems like Kubernetes. Prometheus provides natives support to some services which means that they doesn’t require any kind of monitoring agent, for example:- Kubernetes, ETCD, SkyDNS. Second project after the Kubernetes to graduate from CNCF and right now it’s being managed by CNCF as well.
  • 10.
    {Prometheus is differentfrom Others} Prometheus doesn’t depends on particular monitoring agent, also exporters(monitoring agent) can be written in any language. It’s a time series database, so we can easily take incremental backup of our monitoring data. Service Discovery feature is offered in Prometheus. By using this feature we don’t have to define static targets in configuration. A flexible query language in form of PromQL for time series data aggregation and prediction.
  • 11.
    {Time-series Database} In humanwords, we can say time-series database is a database which simply track, monitor, aggregate and downsample data over the time.
  • 12.
  • 13.
  • 14.
  • 15.
    {Push Model inPrometheus} Prometheus doesn’t exactly supports the push based model directly, to achieve the push based model in Prometheus we can use another part of Prometheus i.e. Push gateway. Push gateway receives the metrics from different exporters(agents) and after that Prometheus pulls the data from Push gateway
  • 16.
    {Exporters} Exporters are kindof monitoring agent for Prometheus which fetches the data from different system and softwares and convert them into Prometheus time- series format. A single exporter exports the metrics for a particular kind of system or software. For example- Redis exporter will export data for Redis database. Exporters can be categorized into two parts- Third Party and Official. More information about exporters can be found here https://prometheus.io/docs/instrumenting/exporters/ Exporters can be written in any language(not necessarily in Golang) because of multiple client libraries support.
  • 17.
  • 18.
    {Configuration} ---- global: scrape_interval: 15s evaluation_interval: 15s alerting: alertmanagers: -static_configs: - targets: rule_files: - "first_rules.yml" scrape_configs: - job_name: 'prometheus' static_configs: - targets: ['localhost:9090']
  • 19.
  • 20.
    {PromQL} PromQL is aPrometheus language for creating and executing queries to extract or aggregate data in Prometheus. It uses Prometheus’s Key Value based data representation and returns the value. Some example of Prometheus vectors are:- ● Range Vector - To calculate the values in Prometheus for a period of time. ● Instant Vector - It will give the data output for the last time interval
  • 21.
  • 22.
    {Alerting with AlertManager} AlertManageris used to handle alerts for client applications(like Prometheus). It also takes care of alerts deduplicating, grouping and then routes them to different receivers such as E-mail, Slack, Pagerduty. AlertManager can be configured via command-line flags and configuration files. Prometheus AlertManager can be setup as an individual component as well and can be get used to send notifications to different mediums by Webhook trigger.
  • 23.
  • 24.
  • 25.
    {Prometheus Service Discovery} It’shard to update the configuration file each time if we have large infrastructure. To overcome this, Prometheus supports service discovery feature. In Prometheus service discovery, the machine or agents will automatically get registered to be monitor. No service restart required in case of new monitoring agents. Prometheus supports service discovery with different services like:- AWS, GCP, Azure, Kubernetes, Consul, Docker, and Digitalocean.
  • 26.
  • 27.
  • 28.
    {Summary} Why Monitoring, Typesof Monitoring, and its Working. Prometheus a TSDB and scraping metrics. Prometheus Architecture and Workflow model. Exporters and Prometheus Configuration. PromQL. Alert Manager, and Service Discovery.