rico pahlisch - @rpahli prometheus€¦ · prometheus attaches job and instance labels...

25
Prometheus The DevOps Monitoring Toolkit Axel Köhler - @axdotl Rico Pahlisch - @rpahli

Upload: others

Post on 24-Sep-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Rico Pahlisch - @rpahli Prometheus€¦ · Prometheus attaches job and instance labels automatically to the scraped time series traefik_backend_requests_total{protocol=”http”,

Prometheus

The DevOps Monitoring Toolkit

Axel Köhler - @axdotlRico Pahlisch - @rpahli

Page 2: Rico Pahlisch - @rpahli Prometheus€¦ · Prometheus attaches job and instance labels automatically to the scraped time series traefik_backend_requests_total{protocol=”http”,

Agenda● Architecture, Agility and Deployments● Monitoring● Prometheus● Demo

2

Page 3: Rico Pahlisch - @rpahli Prometheus€¦ · Prometheus attaches job and instance labels automatically to the scraped time series traefik_backend_requests_total{protocol=”http”,

Architecture, Agility and Deployments

3

Page 4: Rico Pahlisch - @rpahli Prometheus€¦ · Prometheus attaches job and instance labels automatically to the scraped time series traefik_backend_requests_total{protocol=”http”,

Mono and Micro

4Image: https://dzone.com/storage/temp/11234802-monolithic-vs-microservices.png

Page 5: Rico Pahlisch - @rpahli Prometheus€¦ · Prometheus attaches job and instance labels automatically to the scraped time series traefik_backend_requests_total{protocol=”http”,

Death Star Architecture

5Image: https://contiv.io/articles/microservice-challenge-b139e7b3.jpg

Page 6: Rico Pahlisch - @rpahli Prometheus€¦ · Prometheus attaches job and instance labels automatically to the scraped time series traefik_backend_requests_total{protocol=”http”,

Agility und DevOps

6

● Agile Manifesto

“Our highest priority is to satisfy the customer through early and continuous delivery of valuable software.”

“Deliver working software frequently [...] with a preference to the shorter timescale.”

● DevOps

“DevOps is a set of principles and practices — both technical and cultural — that can help organizations deploy better software, faster.”

Page 7: Rico Pahlisch - @rpahli Prometheus€¦ · Prometheus attaches job and instance labels automatically to the scraped time series traefik_backend_requests_total{protocol=”http”,

DevOps Lifecycle

7Image: https://jelastic.com/blog/wp-content/uploads/2015/07/devopsimage.png

Page 8: Rico Pahlisch - @rpahli Prometheus€¦ · Prometheus attaches job and instance labels automatically to the scraped time series traefik_backend_requests_total{protocol=”http”,

Deploy Phase ● High level of automation● Reproducible● Often● “Self contained”

○ Contains everything needed to run and operate○ Including monitoring configuration

8

Page 9: Rico Pahlisch - @rpahli Prometheus€¦ · Prometheus attaches job and instance labels automatically to the scraped time series traefik_backend_requests_total{protocol=”http”,

Monitoring

9

Page 10: Rico Pahlisch - @rpahli Prometheus€¦ · Prometheus attaches job and instance labels automatically to the scraped time series traefik_backend_requests_total{protocol=”http”,

Why?

10

To identify how system behaves in production, to:

○ Identify bottlenecks and issues○ Derive actions (prevention)○ Retrieve results of experiments○ Identify potential for (cost) optimization

“Monitoring enhances communication and trust.” [1]

Page 11: Rico Pahlisch - @rpahli Prometheus€¦ · Prometheus attaches job and instance labels automatically to the scraped time series traefik_backend_requests_total{protocol=”http”,

History

11

Monitoring Systems

● Nagios (1999)● Zappix (1998)● Icinga (2009 Nagios fork)● Shinken (2009)

Time-Series Databases

● Influx● OpenTSDB● Graphite

Page 12: Rico Pahlisch - @rpahli Prometheus€¦ · Prometheus attaches job and instance labels automatically to the scraped time series traefik_backend_requests_total{protocol=”http”,

Why Prometheus?

12

● Build for scalable and dynamic infrastructures● Several ways for Service Discovery

● Consul● DNS● Kubernetes

● Built-in Alerting and Notification● Mighty Query Language

Page 13: Rico Pahlisch - @rpahli Prometheus€¦ · Prometheus attaches job and instance labels automatically to the scraped time series traefik_backend_requests_total{protocol=”http”,

Prometheus“Operate and Monitor”

13

Page 14: Rico Pahlisch - @rpahli Prometheus€¦ · Prometheus attaches job and instance labels automatically to the scraped time series traefik_backend_requests_total{protocol=”http”,

Facts

14Image: https://raw.githubusercontent.com/cncf/artwork/master/projects/prometheus/icon/color/prometheus-icon-color.png

● Open-Source monitoring and alerting system● Starts in 2012 by SoundCloud

○ v1.0 released in July 2016

● 26k stars on GitHub● 390 contributors● Latest Release 2.12.0 (28. August 2019)● One of six CNCF Graduated projects

Page 15: Rico Pahlisch - @rpahli Prometheus€¦ · Prometheus attaches job and instance labels automatically to the scraped time series traefik_backend_requests_total{protocol=”http”,

Data Model● Everything is a time-series● Every time-series has a unique name and a set of key-value pairs called

labels● Notation:

○ <metric name>{<label name>=<label value>, ...}

○ should have a single-word (application) prefix○ traefik_backend_requests_total{protocol=”http”}

15

Page 16: Rico Pahlisch - @rpahli Prometheus€¦ · Prometheus attaches job and instance labels automatically to the scraped time series traefik_backend_requests_total{protocol=”http”,

Architecture

16Image: https://prometheus.io/assets/architecture.png

Page 17: Rico Pahlisch - @rpahli Prometheus€¦ · Prometheus attaches job and instance labels automatically to the scraped time series traefik_backend_requests_total{protocol=”http”,

Jobs and Instances● An endpoint you can scrape is called an instance● A collection of instances (replicas) is called a job● Prometheus attaches job and instance labels automatically to the scraped

time series○ traefik_backend_requests_total{protocol=”http”, job=”kubernetes-pods”,

instance=”10.1.2.3:12345”}

17

Page 18: Rico Pahlisch - @rpahli Prometheus€¦ · Prometheus attaches job and instance labels automatically to the scraped time series traefik_backend_requests_total{protocol=”http”,

ExportersExports metrics from third-party systems as Prometheus metrics

● kube-state-metrics - listens to the Kubernetes API server and generates metrics about the state of the objects

● node-exporter - exports hardware and OS metrics exposed by *NIX kernels● stackdriver-exporter - requests Stackdriver API for the metrics

Many more - https://prometheus.io/docs/instrumenting/exporters/

18

Page 19: Rico Pahlisch - @rpahli Prometheus€¦ · Prometheus attaches job and instance labels automatically to the scraped time series traefik_backend_requests_total{protocol=”http”,

PromQL● Prometheus provides a functional query language called PromQL

sum by (backend) (rate(

traefik_backend_requests_total{

protocol=”http”, code=~”2..”

}[5m]

))

● https://timber.io/blog/promql-for-humans/

19

Page 20: Rico Pahlisch - @rpahli Prometheus€¦ · Prometheus attaches job and instance labels automatically to the scraped time series traefik_backend_requests_total{protocol=”http”,

Demo

20

Page 21: Rico Pahlisch - @rpahli Prometheus€¦ · Prometheus attaches job and instance labels automatically to the scraped time series traefik_backend_requests_total{protocol=”http”,

Content

21

Docker-compose setup

● Petstore○ Micronaut based application - https://micronaut.io○ Including Micrometer - https://micrometer.io

● Prometheus● Grafana● Traefik● See https://github.com/kiwigrid/prometheus-demo

Page 22: Rico Pahlisch - @rpahli Prometheus€¦ · Prometheus attaches job and instance labels automatically to the scraped time series traefik_backend_requests_total{protocol=”http”,

Conclusion and Outlook

22

Page 23: Rico Pahlisch - @rpahli Prometheus€¦ · Prometheus attaches job and instance labels automatically to the scraped time series traefik_backend_requests_total{protocol=”http”,

Conclusion and Outlook● Business metrics vs. technical metrics● Sidecars ● Thanos

23

Page 24: Rico Pahlisch - @rpahli Prometheus€¦ · Prometheus attaches job and instance labels automatically to the scraped time series traefik_backend_requests_total{protocol=”http”,

Questions?

24

Page 25: Rico Pahlisch - @rpahli Prometheus€¦ · Prometheus attaches job and instance labels automatically to the scraped time series traefik_backend_requests_total{protocol=”http”,

References

25

● [1] https://puppet.com/resources/ebook/cio-guide-to-devops● https://techbeacon.com/app-dev-testing/agile-devops-continuous-delivery-e

volution-software-delivery