Custom Prometheus: read-only user setup

What we scrape: Any third-party or platform `/metrics` endpoint you expose over HTTP — Traefik ingress stats, site-main controller metrics, notifier health, VictoriaMetrics, …

Custom exporters point at an existing Prometheus exposition URL (`/metrics`). There is no database user to create — expose the endpoint on a reachable interface, optionally protect it with Bearer or Basic auth via host env vars, and let the monitor-agent scrape it. Static labels (`component`, `plane`, …) attach to every series.

  1. 1. Expose `/metrics` on a reachable interface

    Bind the Prometheus handler on an interface the agent can reach (examples: Traefik metrics, node_exporter, app RED metrics). Empty path is normalised to `/metrics`.

    bash
    # Examples — pick what you already run:
    curl -sS http://traefik.example.com:9100/metrics | head
    curl -sS http://app.example.com:8080/metrics | head
  2. 2. Restrict network access

    Auth is optional. Prefer a firewall / NetworkPolicy so only the monitor-agent can reach the target. Do not put credentials in the scrape URL.

    YAML
    # Kubernetes NetworkPolicy sketch — only the monitor-agent namespace
    # can reach the metrics port.
    apiVersion: networking.k8s.io/v1
    kind: NetworkPolicy
    metadata:
      name: custom-metrics-from-agent-only
    spec:
      podSelector:
        matchLabels:
          app: my-metrics
      policyTypes: [Ingress]
      ingress:
        - from:
            - namespaceSelector:
                matchLabels:
                  kubernetes.io/metadata.name: monitor-agent
          ports:
            - protocol: TCP
              # replace with your metrics port
              port: 9100
  3. 3. Add the Custom Prometheus exporter

    In Add Exporter → Custom Prometheus: paste the URL, optional scrape interval (15–300s, default 60), and optional static labels. Labels must match `^[a-zA-Z_][a-zA-Z0-9_]*$` (no `__` prefix).

    bash
    # Example values in the form:
    # URL:      https://traefik.example.com:9100/metrics
    # Interval: 60
    # Labels:   component=traefik  plane=edge
  4. 4. Optional — Bearer or Basic auth via env vars

    Under Optional authentication choose Bearer (env) or Basic (env). We mint `EXPORTER_<id>_BEARER_TOKEN` or `EXPORTER_<id>_USER` / `_PASSWORD` and never store the secret values. Copy the names from the install snippet after save and set them on the agent host.

    bash
    # After save, the install snippet includes lines like:
    EXPORTER_exp_abc123_BEARER_TOKEN='<your-bearer-token>' \
    # or for basic:
    EXPORTER_exp_abc123_USER='<your-basic-user>' \
    EXPORTER_exp_abc123_PASSWORD='<your-basic-password>' \
  5. 5. Verify series land

    Confirm `up{job="custom",…}` (and your static labels) appear in Explore / Grafana. Missing series usually means network path, wrong URL, or unset auth env vars.

    bash
    # From Grafana Explore (Prometheus datasource) or curl against your tenant query API:
    # up{job="custom",component="traefik"}

Private RFC1918 / link-local / loopback scrape targets are blocked on customer control planes unless `CUSTOM_EXPORTER_ALLOW_PRIVATE` is enabled for platform operators. Never put credentials in the URL userinfo — use Optional authentication instead.