Skip to content

Latest commit

 

History

History
121 lines (90 loc) · 5.98 KB

understanding-cockpit-usage.mdx

File metadata and controls

121 lines (90 loc) · 5.98 KB
meta content tags dates categories
title description
Understanding how to control Cockpit usage and pricing
Explore how to control Cockpit's usage and pricing, including how to manage and optimize costs by controlling the amount of metrics ingested. Learn to adjust scrape intervals and filter metrics effectively, ensuring efficient resource monitoring without unnecessary expenses.
h1 paragraph
Understanding how to control Cockpit usage and pricing
Explore how to control Cockpit's usage and pricing, including how to manage and optimize costs by controlling the amount of metrics ingested. Learn to adjust scrape intervals and filter metrics effectively, ensuring efficient resource monitoring without unnecessary expenses.
observability cockpit retention metrics logs
validation posted
2025-01-15
2023-06-07
observability

This page explains how to fine-tune your metrics ingestion rate while using Cockpit. Find out more about Cockpit pricing in the dedicated documentation.

Importance of controlling the rate

If you wish to avoid extra costs, you can define a limit to the number of samples of metrics you send to Cockpit. The following table shows an estimate of the pricing (€0.00000015 per sample of metrics) based on the push rate of the sample:

Sample ingestion rate per seconds Samples ingested per day Price per day Samples ingested per month Price per month
1 86 400 €0.01296 2 678 400 €0.4017
10 864 000 €0.1296 26 784 000 €4.0176
100 8 640 000 €1.296 267 840 000 €40.176
1000 86 400 000 €12.96 2 678 400 000 €401.76

How to know my current ingestion rate?

Within the Cockpit dashboard on Grafana, click Cockpit Overview. The panel named Metrics ingestion rate displays the ingestion rate for samples coming from Scaleway products, and the ingestion rate for your own samples if you look at "Other Metrics".

If you are using your own Grafana to visualize metrics, use the following query sum(rate(observability_cockpit_ingestion_samples_total{is_from_scaleway="false"}[5m])) OR on() vector(0) to know what your current ingestion rate is.

How to control the number of samples sent to Cockpit?

Control the interval between scrapes

A common good practice to control the number of samples you send to Cockpit, is to have a scrape_interval of 1 minute.

Let us say you have 1000 samples exposed and a scrape_interval of 10s. This means you will have a rate of 100 sample/s and pay around €40 per month. If you increase the scrape_interval to 60s, you will have a rate of 1,66 sample/s, which amounts to around €6.69 per month.

Change the scrape interval using Prometheus

If you are using Prometheus to remote write metrics to your Cockpit, you can tweak the scrape_interval using the following configuration:

    ```yaml
    global:
        scrape_interval: 60s

    scrape_configs:
        ...

    remote_write:
        - url: https://xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.metrics.cockpit.fr-par.scw.cloud/api/v1/push
        headers:
            "X-Token": <COCKPIT_TOKEN_SECRET_KEY>
    ```

Change the scrape interval using the Grafana agent

Here is an example of a Grafana agent configuration file with a scrape interval of 60 seconds:

    ```yaml
    metrics:
    global:
        scrape_interval: 60s
        remote_write:
        - url: https://xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.metrics.cockpit.fr-par.scw.cloud/api/v1/push
        headers:
            "X-Token": <COCKPIT_TOKEN_SECRET_KEY>
    integrations:
    ...
    ```

Control the metrics you are sending

Another good practice to control the number of samples you send to Cockpit, is to only send metrics that you want into your Cockpit, by filtering what you send.

Here is a configuration example with Prometheus:

    ```yaml
    ...

    remote_write:
        - url: https://xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.metrics.cockpit.fr-par.scw.cloud/api/v1/push
        headers:
            "X-Token": <COCKPIT_TOKEN_SECRET_KEY>
        write_relabel_configs:
            - source_labels: [__name__]
                regex: 'my_app_metrics(.*)'
                action: keep
    ```

This configuration will only send metrics starting with my_app_metrics to your Cockpit.

For more information, refer to the Prometheus documentation.

Learn about the agents you are using

Many agents, such as cadvisor and node_exporter expose a lot of metrics by default.

The following metrics collectors are enabled by default on a node_exporter. You can configure them to filter what is sent to your Cockpit.

Use the following configuration example for a Grafana Alloy agent with the prometheus.exporter.unix integration. For more information on how to configure and use the Grafana Alloy agent, refer to the dedicated documentation.

    ```yaml
    ...
    prometheus.exporter.unix "node" {:
        set_collectors:
        # Anything not provided in the list below will be disabled by default
        - uname
        - cpu
        - cpufreq
        - loadavg
        - meminfo
        - filesystem
        - netdev
    ```