RousselTMLEARNING

TP · Prometheus: From Discovery to Expertise

Exporting a batch job's metrics

What you will learn in this TP
  • Install Pushgateway
  • Access the Pushgateway console
  • Send a script's metrics to Pushgateway
  • Using the libraries
Mode :

All steps and instructions are shown. Recommended for this lab: autonomous

Prerequisites #

Context. A batch job lasts a few seconds: Prometheus has no time to scrape it. You push its metrics to a Pushgateway.

Prerequisites: a machine with Docker and Docker Compose  ·  Estimated time: 35 min

You must have a machine with Docker installed. If you don't have a machine or test environment, please complete the 'setting up the test environment' lab first.

Pushgateway #

What you will learn in this section
  • Install Pushgateway
  • Access the Pushgateway console
▶ Review the concept presentation video
  1. Deploy the container

    You must deploy a Pushgateway container to collect metrics sent by ephemeral jobs (batches, etc.).

    Find an example docker-compose file with the configuration to deploy Pushgateway here: File.

Sending your metrics to Pushgateway #

What you will learn in this section
  • Send a script's metrics to Pushgateway
  • Using the libraries
▶ Review the concept presentation video
  1. Create the script

    We will create a simple Bash script called non_system_user.sh that lists the number of non-system users on the machine and sends it to Pushgateway.
    INFO: On Linux:
    - Non-system users have a UID (User ID) of 1000 or higher, except nobody (UID 65534).
    - Users are listed in /etc/passwd
  2. Pushgateway instrumentation

    You must deploy a Node_exporter container to collect all of the machine's metrics. It must be added to the observability network.

  3. Verification

    Run the script and check that the data shows up correctly in the Pushgateway console

Validate your work

Check that each goal above is reached and that you get the result described in the introduction.

Difficulty level : ●●●●○ (4/5)

My progress

  • ⏱ Estimated time : ≈ 35 min

Sign in to track your progress and take notes. Sign in

⭐ Rate this lesson

5.0 initial rating from the teaching team

Sign in to rate this lesson →

💬 Recent discussions about this course

Ask a question about this lesson →See all discussions about this course

Course Glossary

Alerting

The process of notifying teams (via email, Slack, Teams) when a specific event, threshold breach, or anomaly is detected.

Architecture

The overall structural design of an IT system, defining its various components, their relationships, and the principles guiding its evolution.

OpenTelemetry

An open source framework providing standards, APIs, and SDKs to collect and export observability data (traces, metrics, logs) in an agnostic way.

Recommended Articles

Website monitoring: availability, HTTPS monitoring, certificates and performance

Set up website monitoring: availability and HTTPS checks, certificate expiry, response time, Core...

Prometheus recording rules: speeding up your queries and dashboards

Understand and master Prometheus recording rules: evaluation, naming convention, pitfalls (ratios...

Prometheus: alerting with Alertmanager (rules, routing, silences)

Set up Prometheus alerting: alert rules, Alertmanager, routing, grouping, inhibition, silences, S...

Prometheus: visualizing your metrics (UI, Grafana and dashboards)

Visualize Prometheus data: the web interface, PromQL graphs, connecting to Grafana, RED and USE d...

Prometheus best practices: metrics, cardinality, rules and operations

Prometheus best practices: metric naming, labels and cardinality, scrape intervals, recording rul...

Metric types in Prometheus

Discover in detail the four metric types supported by Prometheus (Counter, Gauge, Histogram, Summ...

PromQL: an introduction to the Prometheus query language

Learn PromQL, the Prometheus query language: selectors, rate, sum by, histograms and first querie...

Prometheus in the Kubernetes world (Operator, ServiceMonitor, kube-prometheus-stack)

Monitor Kubernetes with Prometheus: service discovery, kube-prometheus-stack, Prometheus Operator...

Prometheus on Kubernetes and the Prometheus web interface

Deploy Prometheus on Kubernetes with kube-prometheus-stack (Prometheus Operator, ServiceMonitor, ...

Support us

♥ SUPPORT US

Support RousselTM Learning

Courses, articles, labs and certificates stay free with no intrusive ads. A voluntary contribution, of any amount you choose, pays for hosting, lab environments and new content.

Contribute with PayPal Any amount · card or PayPal accountLearn more
QR code PayPal
Or scan this QR code with your phone

Thank you, every contribution counts!