Skip to content

Debug a collector and scrape its internal metrics

On an unmanaged collector you would edit service.telemetry by hand: raise logs.level to debug while you chase a problem, or add a Prometheus reader so your own monitoring can scrape the collector’s otelcol_* metrics. On a collector LinkMesh manages, service.* is generated, so both are settings in the UI instead. This page covers them:

Both settings live in the Telemetry section of a collector’s Overview tab and of a collector group’s Overview tab. A collector inherits its group’s value unless you pick Set for this collector. A change is pushed to the collector over OpAMP like any other config change; no restart and nothing to do on the host.

Available from LinkMesh 1.495.0. Self-hosted installs get it after upgrading to that version.

The collector writes its own logs (the supervisor keeps them in agent.log in its storage directory). Their level is the Internal log level setting:

Value What the collector logs
debug everything, for troubleshooting
info the default
warn warnings and errors only
error errors only
  1. Open the collector (or the group) → Overview → Telemetry → Internal log level.

  2. On a collector, choose Inherit from group … or Set for this collector. A group’s value applies to every member that inherits.

  3. Pick the Level and Save. LinkMesh re-pushes the config to every collector whose effective level changed, and to no other.

LinkMesh renders the choice as service.telemetry.logs.level. With the default, info, nothing is written, so a collector you never touch keeps exactly the config it has today.

Expose internal metrics on a local Prometheus endpoint

Section titled “Expose internal metrics on a local Prometheus endpoint”

Available from LinkMesh 1.494.0. Self-hosted installs get it after upgrading to that version.

Every managed collector already pushes its otelcol_* metrics to LinkMesh (see Self-telemetry). Expose internal metrics locally (Prometheus) adds a second reader that serves the same metrics on a Prometheus endpoint on the collector host, so your own monitoring can scrape them. It is off by default.

  1. Open the collector (or the group) → Overview → Telemetry → Expose internal metrics locally (Prometheus).

  2. On a collector, choose Inherit from group … or Set for this collector.

  3. Tick Enabled. Host defaults to 127.0.0.1 and Port to 8888.

  4. Save. LinkMesh re-pushes the config to the collectors it affects.

LinkMesh’s own reader always stays, first and unchanged, so the Health tab and the topology canvas keep updating. The generated config then carries both readers:

service:
  telemetry:
    metrics:
      readers:
        - periodic:            # LinkMesh's own reader, unchanged
            interval: 30000
            timeout: 2000
            exporter:
              otlp:
                protocol: http/protobuf
                endpoint: https://linkmesh.example.com/v1/metrics
                headers:
                  Authorization: Bearer <per-collector token>
        - pull:                # the endpoint you switched on
            exporter:
              prometheus:
                host: 127.0.0.1
                port: 8888

With the setting off, the second reader is not rendered and nothing listens on the port.

Check it on the collector host:

curl -s http://127.0.0.1:8888/metrics | grep '^otelcol_' | head

A Prometheus server or agent on the same host scrapes it with a plain job:

scrape_configs:
  - job_name: linkmesh-collector
    metrics_path: /metrics
    static_configs:  # the managed collector on this host
      - targets: ['127.0.0.1:8888']

Send a collector’s internal metrics to your own backend

Section titled “Send a collector’s internal metrics to your own backend”

This is the recommended way to keep a collector’s own metrics for longer than LinkMesh’s 24 hours, or to see them next to everything else in your backend. It needs no extra feature: the collector scrapes its own endpoint with an ordinary Prometheus source and routes the result like any other metrics.

  1. Switch the endpoint on for the collector or its group, as above. Keep the defaults 127.0.0.1 and 8888 unless the port is taken.

  2. Add a Prometheus Scrape source on the same collector (or the same group), with:

    • Scrape Targets: 127.0.0.1:8888 (the port you chose);
    • Scheme http, Metrics Path /metrics;
    • Scrape Interval as you like, for example 30s.
  3. Route the source to the metrics destination where you want the data, for example a Prometheus Remote Write or OTLP destination, as in Build your first pipeline.

  4. Query the destination for otelcol_ series, for example otelcol_exporter_sent_metric_points.

On a group, every member scrapes its own 127.0.0.1:8888, and each member’s metrics arrive as a separate resource (host.name and service.instance.id differ), so the series of different members do not collapse into one.

The warning when the target does not match the endpoint

Section titled “The warning when the target does not match the endpoint”

From LinkMesh 1.496.0. A Prometheus source that scrapes the collector’s own loopback address while the endpoint is off would collect nothing and look healthy. LinkMesh warns when you save such a source, and saves it anyway:

  • endpoint off, target on its port: Target 127.0.0.1:8888 scrapes this collector’s internal metrics, but its internal metrics endpoint is off, so the scrape will collect nothing. Enable the internal metrics endpoint on port 8888 (Telemetry settings of the collector or its group).
  • endpoint on another port M, target on 8888: Target 127.0.0.1:8888 scrapes port 8888, but this collector’s internal metrics endpoint is on port M, so the scrape will collect nothing. Change the target to 127.0.0.1:M.

On a group source the check runs per member and the warning names the members affected. A loopback target on any other port, such as node_exporter on 127.0.0.1:9100, gets no warning.

  • 127.0.0.1 keeps the endpoint on the host. Only processes on the collector host can read it. That is the default and the right choice when the scraper runs on the same host, including the own-backend path above.
  • Any other host exposes the metrics to the network. With 0.0.0.0 or a LAN address, anyone who can reach the host on that port can read the collector’s internal metrics. LinkMesh saves it, with a warning that says so. Restrict the port with a firewall if you do it.
  • The endpoint has no TLS and no authentication of its own. It is otelcol’s plain Prometheus exporter.
  • Port clashes are refused. If a source or an extension of this collector already binds the port, saving fails with The internal metrics endpoint would listen on …, but … already binds port … — choose another port, because a collector cannot start two listeners on one port and stops entirely when it tries. The same guard refuses a source or extension added later on the endpoint’s port.
  • Host must be an IP address or a hostname and Port between 1 and 65535.