> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nofire.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# VictoriaMetrics

> Connect your VictoriaMetrics with NOFire AI

Connect VictoriaMetrics to NOFire AI so NOFire can read your metrics, alerts and metric names when it looks into a problem. NOFire queries VictoriaMetrics on demand. It does not copy your metrics. It also reads your metrics to map them to the services in the **production map**.

VictoriaLogs and VictoriaTraces are separate connections. See [VictoriaLogs](https://docs.nofire.ai/logs/victorialogs.md) and [VictoriaTraces](https://docs.nofire.ai/traces/victoriatraces.md).

## What NOFire reads

* Metrics. Chat reads them with PromQL instant and range queries through the query API, at the **Query URL** or through Edge.
* Metric names.
* Alerts from vmalert. This needs `-vmalert.proxyURL` set on VictoriaMetrics, or on vmselect in a cluster. Without it, NOFire cannot list alerts, and everything else still works.

NOFire sends only read requests.

## Prerequisites

* The URL of the Prometheus query API:
  * Single node: the server itself, for example `http://victoria-metrics.example.com:8428`.
  * Cluster: vmselect with your tenant in the path, for example `https://vmselect.example.com:8481/select/0/prometheus` for tenant 0.
* A read-only bearer token, if vmauth or another proxy with auth sits in front.
* If NOFire cannot reach the URL from the internet, an [Edge agent](https://docs.nofire.ai/edge/installation.md) in your network. See [Connect through Edge](#connect-through-edge).

## Connect directly

Use this when NOFire can reach VictoriaMetrics over the internet.

1. Open [Connections](https://my.nofire.ai/dashboard/connections) and click **Connect** on **VictoriaMetrics**.
2. Fill in the form:
   * **Name**: a name you choose, for example `production`.
   * **Query URL**: the URL from the prerequisites, for example `https://vmselect.example.com/select/0/prometheus`. Use http or https, with no user name, password, query string or fragment in it.
   * **Bearer token** (optional): the token for vmauth or your proxy.
3. Open **Advanced** only if you need it:
   * **Allow a private endpoint**: check it when the Query URL resolves to a private address. Your account needs private network access for this.
   * **Read through an MCP server**: see [Read through an MCP server](#read-through-an-mcp-server-optional).
4. Click **Connect**. NOFire tests the connection first and saves it only if the test passes.

## Connect through Edge

Use this when VictoriaMetrics is reachable only inside your network. The Edge agent in your cluster reads VictoriaMetrics and sends the results to NOFire. The token stays in a Kubernetes Secret in your cluster. You don't need an MCP server for this.

The `victoriametrics` type needs Edge v3.11.0 or later. Add an entry under `onPremConnections` in your Edge `values.yaml`:

```yaml theme={"dark"}
onPremConnections:
  prod-vm:
    type: victoriametrics
    name: "Production VictoriaMetrics"
    secretName: victoriametrics-creds   # optional, holds a token key
    # Cluster: vmselect with your tenant, for example tenant 0.
    url: "http://vmselect.monitoring:8481/select/0/prometheus"
    # Single node: the server itself.
    # url: "http://victoria-metrics.monitoring:8428"
```

Then run `helm upgrade` as in [On-prem connections](https://docs.nofire.ai/edge/on-prem-connections.md#victoriametrics). The connection then appears in Connections. You don't add it in the dashboard.

If you added VictoriaMetrics to Edge earlier as a `prometheus` connector, change `type` to `victoriametrics` and use the same key (`prod-vm` above). NOFire matches Edge connections by that key, so it turns the existing connection into a VictoriaMetrics connection in place, with its pipelines and environment settings. The steps are in [Moving from prometheus to victoriametrics](https://docs.nofire.ai/edge/on-prem-connections.md#moving-from-prometheus-to-victoriametrics).

## Read through an MCP server (optional)

By default NOFire reads the Query URL. If you run mcp-victoriametrics, the VictoriaMetrics MCP server, and want NOFire to read through it, turn on **Read through an MCP server** under **Advanced**. Three fields appear:

* **MCP server URL**: required while the switch is on, for example `https://mcp-victoriametrics.example.com/mcp`.
* **MCP token** (optional): the token for the MCP server.
* **VictoriaMetrics Cloud API key** (optional): for VictoriaMetrics Cloud.

With the switch on, NOFire reads metrics and alerts through the MCP server, with the VictoriaMetrics MCP tools. Through the MCP server NOFire also lists label names, label values and series. The **Query URL** stays required: NOFire uses it to map metrics to services, which the MCP server does not do.

This works for direct connections only. An MCP server cannot go through Edge. A connection through Edge always reads the query API.

## Test the connection

NOFire tests the connection when you click **Connect**. The test runs `vector(1)` against each URL the connection reads:

| How it reads | What the test checks |
| - | - |
| Query URL | `metrics query API (vm_query_url)` |
| MCP server | `victoriametrics (vm_mcp_url)` and `metrics query API (vm_query_url)` |
| Edge | `metrics query API (edge agent)` |

If a check fails, the message names only the ones that failed, for example `Connection validation failed for metrics query API (vm_query_url)`.

After the test passes, ask NOFire a question that needs metrics, for example "what is the error rate for the checkout service right now?". An answer that cites your metrics shows the connection works end to end.

## Connections created before

Before VictoriaLogs and VictoriaTraces had separate cards, one VictoriaMetrics connection could hold MCP server URLs for all three products. A connection like that still works as it did, with its metrics, logs and traces, and shows on the VictoriaMetrics card. To add a new VictoriaLogs or VictoriaTraces connection, use the VictoriaLogs or VictoriaTraces card.

## Troubleshooting

> [accordion] The test fails on a vmselect URL
>
> A cluster URL needs the tenant and the Prometheus path, for example `/select/0/prometheus`. The vmselect address alone does not answer queries.

> [accordion] NOFire answers metric questions but lists no alerts
>
> VictoriaMetrics, or vmselect in a cluster, needs `-vmalert.proxyURL` pointing at your vmalert. Without it the alerts API returns an error.

> [accordion] The Edge agent logs failed to create connector
>
> The agent is older than v3.11.0 and doesn't know the `victoriametrics` type. Upgrade Edge, or use `type: prometheus` with the same `url` until you do.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.