prometheus monitoring - inovex gmbh · ›fasst ein oder mehrere container zusammen ›kleinste...

30
Prometheus Monitoring For Fun and Profit Christoph Petrausch München, 06.12.16

Upload: others

Post on 23-Sep-2019

19 views

Category:

Documents


0 download

TRANSCRIPT

Prometheus Monitoring

For Fun and Profit

Christoph Petrausch München, 06.12.16

Christoph Petrausch

Linux Systems Engineer

Automatisierung, Monitoring, Go

2

› Orchestrator für Container

› Cluster System

› Unabhängig von der Container Implementierung

› Verschiedene SDN & SDS Integrationen

3

Kubernetes… was ist das?

› Kubernetes Worker

› Startet Pods

› Verdrahtet Pods mit SDN und SDS

4

Kubernetes… Kubelet

› Fasst ein oder mehrere Container zusammen

› Kleinste schedulbare Einheit

› Hat eigenen Network Namespace

› Kann Volumes mounten

5

Kubernetes… Pods

› Managed mehrere Pods

› Rollout

› Autoscale

6

Kubernetes… Deployment

› Beliebige Key Value Paare

› Für alle Ressourcen verfügbar

7

Kubernetes… Labels

› vIP / Loadbalancer

› DNS

› Primär cluster-intern

› Endpoints per API

8

Kubernetes… Service

› Konfiguration auf dem Master

› Monitoring-Agents um Check-Scripte erweiterbar

› Integrierte Dashboards

9

Klassisches Monitoring…Icinga/Nagios/CheckMK/Zabbix

1. Hostgruppe definieren

2. Checks definieren

3. Alarme definieren

10

Klassisches Monitoring… neuer Service

› Alarm für: 80% aller HTTP Requests sind 503er

11

Klassisches Monitoring… Probleme

› Container/VMs sind Wegwerfprodukt

› Container haben keine festen Hostnamen oder IPs

› Ein Monitoring-Agent pro Container?

› Ein Monitoring-Agent pro Kubelet?

12

Klassisches Monitoring… Probleme

13

Prometheus

Application

OS

Network

Node Exporter

SNMP Exporter

Prometheus

› Static File

› Kubernetes API

› Consul

› DNS (A / AAAA / SRV)

14

Prometheus… wie findet es Exporter?

15

Prometheus… Metrik

http_count{

}731321

Metrikname

Wert

16

Prometheus… Metrik

# HELP Total Number of HTTP Requests# TYPE http_count counterhttp_count

{

}731321

Dokumentation

17

Prometheus… Metrik

# HELP Total Number of HTTP Requests# TYPE http_count counterhttp_count

{handler="/ui/static",instance="10.254.65.34:9100",job="physical_hosts", rack="fra01/v1"

}731321

Label

› Angelehnt an SQL

› Aggregationen über Labels

› Mathematische Funktionen

› Range und Offset Selektoren

18

Prometheus… PromQL

19

Prometheus… PromQL Aggregationen

Query:

sum by (rack) ( http_count{handler="/ui/static"} )

Beispiel:

http_count{handler="/ui/static",rack="a", i="a"} 5

http_count{handler="/ui/static",rack="a", i="y"} 5

http_count{handler="/ui/static",rack="b", i="z"} 5

Resultat: {rack="a"} =10, {rack="b"} = 5

20

Prometheus… PromQL Funktionen

rate( http_count{handler="/ui/static"} [1m] )

HTTP Requests pro Sekundefür die URI /ui/static

21

Prometheus… PromQL Offset Selektoren

http_count – ( http_count offset 5m)

Differenz der HTTP Requests zwischen jetzt und vor 5 Minuten

› Alarme

› Dashboards

› Third Party Tools

22

Prometheus… PromQL wofür?

ALERT rate(http_count[1m]) < 1

FOR 5m

LABELS {level="warn“, component= "web"}

ANNOTATIONS {summary="HTTP down {{$labels.instance}}"}

23

Prometheus… PromQL Alarm

› Unix Philosophie

› Grafana

› AlertManager

24

Prometheus… Dashboards und Alarm Management

› Langzeitspeicherung

› Datenreplikation

25

Prometheus… welche Probleme löst es nicht?

› Libraries für viele Sprachen

› OS, MySQL, Memcached, RabbitMQ, IPMI, SNMP,

Apache, Github, …

26

Prometheus… Exporter

Demo Time

27

› Konfiguration über die Service Discovery macht das

Monitoring genauso flexibel wie die Umgebung

› Prometheus wurde für dynamische Umgebungen

geschrieben

28

Fazit

Vielen Dank

Christoph Petrausch

Linux Systems Engineer

Slides & Code: github.com/hikhvar/prometheus-kubernetes-demo

[email protected]

[email protected]

www.inovex.de/jobs

+49 721 619 021 50

Wir suchen Verstärkung in den Bereichen• Digital Consulting• Web Frontend & Backend• Replatforming• Apps & Smart Devices• Big Data• Data Science• Search• Business Intelligence• DevOps• Cloud• Operations

Durchstarten bei inovex