Skip to main content

Telegraf

Last update:

Telegraf is a monitoring system that allows you to set up metric collection, storage, and processing.

Before you begin, configure Telegraf.

Configure Telegraf

You can configure the agent to collect metrics to your infrastructure.

  1. Add a service user.
  2. Configure the agent to collect metrics.

1. Add a service user

Add a service user with permission in the Projects scope and the role:

  • metrics.admin;
  • member;
  • or reader.

Users can be added by the Account Owner or users with the iam.admin role.

2. Configure the agent to collect metrics

  1. Open the CLI.

  2. Create a configuration file telegraf.conf:

    nano /etc/telegraf/telegraf.conf
  3. Fill in the configuration file telegraf.conf:

    [agent]
    interval = "1m"
    flush_interval = "1m"

    [[inputs.prometheus]]
    urls = ["<base_url>/projects/<project_id>/namespaces/<namespace>/prometheus/metrics"]
    username = "<user_id>"
    password = "<password>"

    [[outputs.file]]
    files = ["stdout"]
    data_format = "prometheus"

    Specify:

    • <base_url> — the URL for accessing the Metrics service API. If you are configuring an agent to collect metrics for a dedicated server, use the cloud server pool URL that corresponds to the pool where your dedicated server is located. The list of URLs can be viewed in the URL list instruction;
    • <project_id> — project ID. You can copy it in the control panel: in the top menu, click Products and select any product → open the projects menu → in the line of the required project, click ;
    • <namespace> — the name of the selected namespace, for example, compute;
    • <user_id> — ID of the user you added in step 1;
    • <password> — password of the user you added in step 1.
  4. Optional: you can configure metrics collection from multiple pools or projects. To add a new pool or project, in the inputs.prometheus section, list all sources separated by a comma in the urls parameter.

  5. Optional: add metric export to external storage or processing systems, for example, VictoriaMetrics. To do this, extend the outputs section in the telegraf.conf configuration file using the Prometheus Output Plugin.

  6. Exit the nano text editor while saving changes: press Ctrl+Х, and then Y+Enter.

  7. Start Telegraf:

    docker run \
    --name telegraf \
    --rm \
    -v ${PWD}/telegraf.conf:/etc/telegraf/telegraf.conf:ro \
    telegraf:latest \
    --config /etc/telegraf/telegraf.conf

    Collected metrics will be output to stdout. Example output:

    # HELP network_meta_info_value Telegraf collected metric
    2026-03-03T12:46:30.359832865Z # TYPE network_meta_info_value untyped
    2026-03-03T12:46:30.359838580Z network_meta_info_value{server_uuid="...", ...} 1
    2026-03-03T12:46:30.359844441Z # HELP network_receive_bits_rate_value Telegraf collected metric
    2026-03-03T12:46:30.359847896Z # TYPE network_receive_bits_rate_value untyped
    2026-03-03T12:46:30.359851348Z network_receive_bits_rate_value{server_uuid="...", ...} 0