# victoria-metrics-agent

VictoriaMetrics agent: a metrics scraper run through a VMAgent CR

This page is generated from [`kix/packages/stable/victoria-metrics-agent`](https://github.com/kix-run/kix/tree/main/kix/packages/stable/victoria-metrics-agent).

| | |
| --- | --- |
| Stability | Stable |
| `package` value | `packages.victoria-metrics-agent` |
| Default software version | `1.156.0` |
| Default aliases | `vmAgent` |

## How-to guides

- [Install the VictoriaMetrics HA monitoring stack](/docs/how-to/package-task-guides/install-the-victoriametrics-ha-monitoring-stack/)

## Dependencies

Kix matches each dependency below to another package instance by instance name, alias, or role. To bind a specific instance, set [`deps.<name>`](/docs/reference/instances-and-composition/#deps) in your cluster definition. See [Declaring dependencies](/docs/reference/package-anatomy/#declaring-dependencies) for how required and optional dependencies work.

| Dependency | Requirement |
| --- | --- |
| `vmCluster` | Required |
| `vmOperator` | Required |
| `prometheus` | Optional |

## Options

### `externalLabels`

Labels attached to every scraped sample (e.g. cluster identity).

- **Type:** `attribute set of string`
- **Default:** `{ }`

### `extraArgs`

vmagent flags for the VMAgent CR's `extraArgs`, keyed by flag name without the leading dash. Merged over the package's flags, so an entry here replaces the package's value for that flag. The package sets `promscrape.streamParse = "true"`. It refuses `remoteWrite.url`, which comes from the vmCluster dependency, and `promscrape.config`, which the operator writes.

- **Type:** `attribute set of string`
- **Default:** `{ }`

### `extraSpec`

Extra fields deep-merged into the VMAgent CR spec. The package refuses `remoteWrite` and `scrapeInterval`, which come from the vmCluster dependency, and `image`, `replicaCount`, `selectAllByDefault`, `resources`, and `extraArgs`, which have options of their own. Setting `topologySpreadConstraints` here replaces the default pod spread constraints set from the availability level.

- **Type:** `attribute set of anything`
- **Default:** `{ }`

### `healthCheck.enabled`

Run the package's post-deploy probe (kix.healthCheck) once its resources are ready. A failing probe fails the deploy before the activation switches.

- **Type:** `boolean`
- **Default:** `false`

### `healthCheck.maxSampleAge`

Seconds. The agent's newest sample older than this fails the probe.

- **Type:** `signed integer`
- **Default:** `120`

### `healthCheck.retryFor`

Seconds the probe keeps re-checking before it gives up, so a target still restarting from the rollout does not fail the deploy. The Job's deadline is sized from it.

- **Type:** `signed integer`
- **Default:** `90`

### `image`

Container image for this instance. Set it from a pin file (`kix.pins`) so the deployed reference is committed and resolved.

- **Type:** `submodule`
- **Default:**

  ```nix
  {
    digest = "sha256:d3229ab469c54ae5266e86246932266bad29b06668b5371acbd6d3de1b3035e7";
    pullPolicy = null;
    repository = "docker.io/victoriametrics/vmagent";
    tag = "v1.156.0";
  }
  ```

### `image.digest`

Resolved manifest digest, `sha256:` followed by 64 hex characters. What will actually run. Null means not resolved.

- **Type:** `null or string`
- **Default:** the package's digest while `tag` is the package's tag, otherwise null

### `image.note`

Whatever a person wanted to say about this pin. Kix never reads it and a promotion never discards it. Declared here for the same reason as the three fields above: a pin carries its own record-keeping, and the option accepts the whole pin rather than a subset of it.

- **Type:** `null or string`
- **Default:** `null`

### `image.promotedBy`

Who resolved this pin, for the record. Null when unknown.

- **Type:** `null or string`
- **Default:** `null`

### `image.pullPolicy`

imagePullPolicy for containers using this image. Null leaves it to Kubernetes.

- **Type:** `null or string`
- **Default:** `null`

### `image.repository`

Image repository, registry host included.

- **Type:** `string`
- **Default:** `"docker.io/victoriametrics/vmagent"`

### `image.resolvedAt`

When this pin was resolved, RFC 3339. Null when unknown.

- **Type:** `null or string`
- **Default:** `null`

### `image.sourceRev`

Revision of the source the image was built from, when Kix built it. Null for upstream images.

- **Type:** `null or string`
- **Default:** `null`

### `image.tag`

Image tag. What was asked for.

- **Type:** `string`
- **Default:** `"v1.156.0"`

### `metrics.enabled`

Render the package's alert rules when a `prometheus` dependency is present. The operator's scrape of the workload does not depend on it.

- **Type:** `boolean`
- **Default:** `true`

### `replicaCount`

Identical-replica HA pair; the cluster's dedup collapses the
double ingest. Defaults from the cluster's availability level.

- **Type:** `signed integer`
- **Default:** `1`

### `resources`

Container resource requests and limits. Each field keeps its default until set, and null removes a default.

- **Type:** `submodule`
- **Default:**

  ```nix
  {
    limits = {
      memory = "1Gi";
    };
    requests = {
      cpu = "250m";
      memory = "512Mi";
    };
  }
  ```

### `resources.claims`

Dynamic resource claims the container uses. Null leaves it unset.

- **Type:** `null or (list of (submodule))`
- **Default:** `null`

### `resources.claims.*.name`

Name of an entry in the pod's `resourceClaims`.

- **Type:** `string`

### `resources.claims.*.request`

Request within the claim to use. Null uses the whole claim.

- **Type:** `null or string`
- **Default:** `null`

### `resources.limits`

Resource quantities by name.

- **Type:** `open submodule of attribute set of Kubernetes quantity, such as "500m" or "1Gi" (a non-negative decimal or integer with an optional suffix m, k, M, G, T, P, E, Ki, Mi, Gi, Ti, Pi or Ei)`
- **Default:** `{ }`

### `resources.limits.cpu`

The cpu quantity. Null leaves it unset.

- **Type:** `null or Kubernetes quantity, such as "500m" or "1Gi" (a non-negative decimal or integer with an optional suffix m, k, M, G, T, P, E, Ki, Mi, Gi, Ti, Pi or Ei)`
- **Default:** `null`

### `resources.limits.ephemeral-storage`

The ephemeral-storage quantity. Null leaves it unset.

- **Type:** `null or Kubernetes quantity, such as "500m" or "1Gi" (a non-negative decimal or integer with an optional suffix m, k, M, G, T, P, E, Ki, Mi, Gi, Ti, Pi or Ei)`
- **Default:** `null`

### `resources.limits.memory`

The memory quantity. Null leaves it unset.

- **Type:** `null or Kubernetes quantity, such as "500m" or "1Gi" (a non-negative decimal or integer with an optional suffix m, k, M, G, T, P, E, Ki, Mi, Gi, Ti, Pi or Ei)`
- **Default:** `"1Gi"`

### `resources.requests`

Resource quantities by name.

- **Type:** `open submodule of attribute set of Kubernetes quantity, such as "500m" or "1Gi" (a non-negative decimal or integer with an optional suffix m, k, M, G, T, P, E, Ki, Mi, Gi, Ti, Pi or Ei)`
- **Default:** `{ }`

### `resources.requests.cpu`

The cpu quantity. Null leaves it unset.

- **Type:** `null or Kubernetes quantity, such as "500m" or "1Gi" (a non-negative decimal or integer with an optional suffix m, k, M, G, T, P, E, Ki, Mi, Gi, Ti, Pi or Ei)`
- **Default:** `"250m"`

### `resources.requests.ephemeral-storage`

The ephemeral-storage quantity. Null leaves it unset.

- **Type:** `null or Kubernetes quantity, such as "500m" or "1Gi" (a non-negative decimal or integer with an optional suffix m, k, M, G, T, P, E, Ki, Mi, Gi, Ti, Pi or Ei)`
- **Default:** `null`

### `resources.requests.memory`

The memory quantity. Null leaves it unset.

- **Type:** `null or Kubernetes quantity, such as "500m" or "1Gi" (a non-negative decimal or integer with an optional suffix m, k, M, G, T, P, E, Ki, Mi, Gi, Ti, Pi or Ei)`
- **Default:** `"512Mi"`

### `scrapeInterval`

null = use the cluster's out.scrapeInterval (recommended: dedup
on vmselect/vmstorage is calibrated to it). Override only with a
matching change on the cluster instance.

- **Type:** `null or string`
- **Default:** `null`

### `selectAllByDefault`

Scrape all scrape objects cluster-wide when the selectors are unset.

- **Type:** `boolean`
- **Default:** `true`