RousselTMLEARNING

TP · Prometheus: From Discovery to Expertise

Exporting a batch job's metrics with correction

The correction is integrated into the TP (See the green boxes)

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.
    See the correction
    Create a file with the configuration, e.g. docker-compose-pushgateway.yml, and put this configuration in it . Once the file is created, you can run it with the following command:
    docker compose -f docker-compose-pushgateway.yml up -d 

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
    See the correction
    Here's an example script that does this .
  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.

    See the correction
    Here's an example script that does this .
  3. Verification

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

    See the correction
    Just run the script:
    sh non_system_user.sh
    then go to:
    http://localhost:9091/metrics

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

Vector: sinks in detail (destinations, batches, buffers and retries)

Send Vector events: Loki, Elasticsearch, S3, Kafka, OpenTelemetry, Prometheus, Datadog, HTTP and ...

Grafana Alloy: collecting system metrics and local logs

Learn how to configure Grafana Alloy to monitor the server it runs on, with a focus on configurat...

Time-based vs event-based SLO: understanding, computing and choosing (with the Qonto example)

Differences between time-based SLOs (time slices, uptime) and event-based SLOs (good events over ...

The observability trilemma: cost, completeness and performance, and how solutions resolve it

Understanding the observability trilemma (cost, data completeness, query performance), its three ...

Ingesting metrics into VictoriaMetrics: scraping, vmagent and remote write

All the ways to feed VictoriaMetrics: remote write from Prometheus, built-in scraping, vmagent an...

Prometheus vs VictoriaMetrics: metrics scalability

Why choose VictoriaMetrics as an alternative to Prometheus for long-term storage and high perform...

Capstone project: the four signals of the OpenTelemetry Demo in the Grafana stack

A capstone project spanning the observability courses: deploy the OpenTelemetry Demo, send metric...

Grafana Alloy: Metrics Collection (Prometheus & Ecosystem)

Learn how to configure Grafana Alloy to collect, transform, and forward metrics using the Prometh...

Grafana Alloy: The importance of Self-Monitoring

Discover why and how to configure Grafana Alloy so that it monitors itself, collecting its own lo...

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!