Course · Training · Workshop

Monitoring and Observability with Prometheus and Grafana

Two days hands-on: query metrics with PromQL and logs with Loki and LogQL, build Grafana dashboards and set up alerts with Alertmanager on a Kubernetes cluster.

The kube-prometheus-stack runs on the Kubernetes cluster, Grafana ships with dozens of ready-made dashboards, and during an incident it still takes a long time to see which pod, node or filesystem causes the problem. Someone copied the queries in the panels, alerts fire too often or never, and the logs live in a different tool. In this course you work for two days in your own Kubernetes cluster with Prometheus, Grafana, Loki and Grafana Alloy. On the first day you get to know the architecture of Prometheus and write PromQL from the ground up: label matchers, range selectors, operators, aggregations, functions such as rate() and subqueries. Loki and LogQL follow, which you use to filter and parse logs and turn them into metrics. On the second day you build Grafana dashboards, connect your own targets with ServiceMonitor, relabelling and the Pushgateway, instrument a Spring Boot batch job and write alerting rules and recording rules as a PrometheusRule. At the end you can read, write and explain the queries behind your dashboards and alerts, and you know how metrics and logs flow through your cluster from the target to the notification.

What participants say

Great training with exercises that were immediately relevant to my daily work. The training environment was easy to set up and felt almost like our prod environment!
Tim Tim
Application Developer
The course "Prometheus and PromQL" by letsboot.ch met my expectations. The teacher, Jan-Hendrik Heuing, impressed with his expertise and competence. I can wholeheartedly recommend this course and letsboot.ch.
Martin Martin
Leiter IT Entwicklung Platform & Services

These customers booked courses in the same topic cluster.More customers →

Content

This training is for teams that run applications and platforms on Kubernetes and monitor them with Prometheus, Grafana and Loki. You work in your own cluster with the kube-prometheus-stack and query real metrics and logs of that cluster from the first hour.

The course consists of the following topics and can be adapted to the audience. The first day covers the architecture, PromQL and LogQL, the second day dashboards, connecting your own targets and alerting. For in-house courses we agree on the focus and the depth of the chapters.

Observability and Prometheus architecture

  • Logs, metrics and traces as the three pillars of observability
  • Prometheus server with retrieval, TSDB and HTTP API, the pull model and its security benefits
  • Exporters: Node Exporter, Blackbox Exporter, exporters for databases and Kafka
  • Service discovery in Kubernetes and container metrics with cAdvisor
  • Where Prometheus, Grafana, Loki, Jaeger and Elastic Observability fit
  • Hands-On: Start the Labmachine, open Grafana and create a first dashboard with one panel

PromQL basics with promtool

  • Running queries with promtool query instant in the terminal and in the expression browser
  • Data types: scalar, instant vector and range vector
  • Label matchers for exact values, exclusions and regular expressions
  • Range selectors, offset and the @ modifier for absolute points in time
  • Finding the right Kubernetes metric, for example kube_pod_info and container_memory_usage_bytes
  • Hands-On: Count pods per namespace and select memory usage by node, namespace and pod

PromQL operators and aggregation

  • Arithmetic operators: calculating used memory, percentages and units
  • Comparison operators and the bool modifier for thresholds
  • Logical operators and, or and unless
  • Aggregations such as sum, count and avg with by
  • Hands-On: Calculate memory and filesystem usage in per cent and find filesystems below a threshold

Functions, subqueries and metric types

  • Counter, gauge and histogram and which functions fit which type
  • rate() and irate() and choosing the right time window
  • avg() compared with avg_over_time(), max_over_time()
  • Classic histograms with buckets and histogram_quantile()
  • Subqueries for peak values over longer periods
  • Hands-On: Calculate network throughput and CPU usage with rate() and find peaks with subqueries

Logs with Loki and LogQL

  • Loki architecture, log streams and the differences to Prometheus
  • Log stream selectors and line filters for text and regular expressions
  • Parsers for JSON, logfmt, pattern and regexp
  • Label filters with numbers, bytes and durations
  • Shaping the output with line_format, label_format, drop and keep
  • Hands-On: Filter the nginx access logs of the Loki gateway in Grafana Explore, split them with the pattern parser and format them

Metrics from logs and Grafana Alloy

  • Metric queries with count_over_time, rate and bytes_rate
  • unwrap for numeric values from log lines, for example the average response size
  • Aggregations with sum by and topk, calculating ratios such as an error rate for an SLO
  • Fast queries: line filter before the parser, IP matching
  • Grafana Alloy as the successor of Promtail and Grafana Agent: components for discovery, loki.process, loki.relabel and loki.write
  • Hands-On: Calculate the request rate per HTTP status from the access logs and extend the Alloy pipeline with loki.relabel and loki.process

Grafana dashboards

  • Choosing visualisations: time series, gauge, stat, heatmap and pie chart
  • Setting thresholds, units, minimum and maximum, legend and time range
  • Exporting and sharing dashboards
  • Grafana 13: dynamic dashboards with rows, tabs, auto-grid and conditional rendering
  • Grafana 13: Git Sync for dashboards as code and restoring deleted dashboards
  • Hands-On: Build a dashboard with panels for CPU usage, memory and free disk space

Connecting targets: ServiceMonitor, relabelling and Pushgateway

  • ServiceMonitor and PodMonitor of the Prometheus Operator compared with additionalScrapeConfigs
  • relabelings before the scrape and metricRelabelings after it, with the actions keep and drop
  • The processing order from the target to the stored time series
  • Pushgateway for short-lived jobs and batch processing
  • Delivering metrics of a Spring Boot application through the Pushgateway
  • Hands-On: Deploy a Pushgateway with a ServiceMonitor, push metrics with curl and instrument a Spring Boot batch job running as a CronJob

Alerting and recording rules

  • Anatomy of an alerting rule: expr, for, labels and annotations, the states pending and firing
  • Alertmanager: grouping and routing alerts, receivers, silences and inhibition, notification by email
  • Managing rules as a PrometheusRule in the Kubernetes cluster, severity levels and best practices
  • Grafana alerts compared with Prometheus alerts
  • Recording rules for frequent and expensive queries
  • Hands-On: Write PrometheusRules for low disk space and high memory usage, load them and follow them to the firing state

At the end of the course you have written PromQL and LogQL queries for the most important questions about a Kubernetes cluster, built your own dashboard, connected an application through the Pushgateway and tested alerting rules through to the notification. You take the slides, exercises and solutions with you as a reference.

Still missing the Kubernetes basics? Then the course Kubernetes & Docker DevOps is the right place to start.

The actual course content may differ from the above depending on the trainer, delivery, duration and the composition of participants.

Request this course in-house

By submitting you accept our Privacy Policy.

Request a public date

No suitable public date? Register without obligation — once there is enough interest we schedule a new public date and let you know first.

Number of participants (approx.)

More than 3 participants? Best to request a dedicated in-house date directly.

By submitting you accept our Privacy Policy.

More about Prometheus & Grafana

Prometheus stores metrics as time series with labels and pulls them from its targets, which it finds through service discovery. Queries are written in PromQL, recording rules precompute frequent queries, and Alertmanager groups alerts and delivers them. Grafana visualises the data, and Loki adds logs to the stack with the query language LogQL.

Prometheus started at SoundCloud in 2012 and joined the CNCF in 2016 as the second project after Kubernetes. Prometheus 3.0 followed in November 2024 with a new user interface, UTF-8 in metric and label names and an OTLP endpoint for OpenTelemetry metrics; native histograms have been stable since version 3.8. For logs, Grafana Alloy has replaced the collectors Promtail and Grafana Agent.

Further resources:

Related courses