cozystack/packages/extra/monitoring
Andrei Kvapil 23bc8525be
[monitoring] Add inlineScrapeConfig support to tenant vmagent (#2200)
## Summary

- Adds `inlineScrapeConfig` support to the tenant `VMAgent` resource in
`packages/system/monitoring/templates/vm/vmagent.yaml`
- Adds commented usage example in both
`packages/system/monitoring/values.yaml` and
`packages/extra/monitoring/values.yaml`

## Problem

The tenant VMAgent resource does not support custom scrape
configurations. Using `additionalScrapeConfigs` (which references a
Kubernetes Secret) is not viable because tenant users have no access to
create or read Secrets — they can only manage resources under
`apps.cozystack.io`. Instead, `inlineScrapeConfig` accepts inline YAML
directly through Helm values, which is consistent with tenant
permissions.

Relates to #2194

## Usage

```yaml
vmagent:
  inlineScrapeConfig: |
    - job_name: "custom"
      static_configs:
        - targets: ["my-service:9090"]
```

## Test plan

- [ ] `helm template` monitoring with `inlineScrapeConfig` set — block
rendered
- [ ] `helm template` monitoring without it — no `inlineScrapeConfig` in
output
- [ ] Deploy and verify custom scrape targets are picked up by vmagent

```release-note
Add inlineScrapeConfig support to tenant vmagent
```

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **New Features**
* Support for including an inline scrape configuration into VMAgent
monitoring when provided.

* **Documentation**
* Added a commented example showing how to supply an inline scrape job
and targets.
* Reordered remote-write URL entries in monitoring configuration for
clearer ordering.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-03-16 14:56:15 +01:00
..
charts feat(monitoring): add migration for monitoring-system HelmRelease 2026-02-04 04:04:00 +01:00
logos feat(monitoring): add migration for monitoring-system HelmRelease 2026-02-04 04:04:00 +01:00
templates feat(monitoring): migrate VictoriaLogs from VLogs to VLCluster 2026-03-10 12:04:12 +05:00
Chart.yaml Adding the ability to deploy system monitoring 2026-02-04 03:34:12 +01:00
Makefile Adding the ability to deploy system monitoring 2026-02-04 03:34:12 +01:00
README.md Adding the ability to deploy system monitoring 2026-02-04 03:34:12 +01:00
values.schema.json Adding the ability to deploy system monitoring 2026-02-04 03:34:12 +01:00
values.yaml [monitoring] Add inlineScrapeConfig support to tenant vmagent 2026-03-11 10:40:20 +01:00

Monitoring Hub

Parameters

Common parameters

Name Description Type Value
host The hostname used to access Grafana externally (defaults to 'grafana' subdomain for the tenant host). string ""

Metrics storage configuration

Name Description Type Value
metricsStorages Configuration of metrics storage instances. []object [...]
metricsStorages[i].name Name of the storage instance. string ""
metricsStorages[i].retentionPeriod Retention period for metrics. string ""
metricsStorages[i].deduplicationInterval Deduplication interval for metrics. string ""
metricsStorages[i].storage Persistent volume size. string 10Gi
metricsStorages[i].storageClassName StorageClass used for the data. string ""
metricsStorages[i].vminsert Configuration for vminsert. object {}
metricsStorages[i].vminsert.minAllowed Minimum guaranteed resources. object {}
metricsStorages[i].vminsert.minAllowed.cpu CPU request. quantity ""
metricsStorages[i].vminsert.minAllowed.memory Memory request. quantity ""
metricsStorages[i].vminsert.maxAllowed Maximum allowed resources. object {}
metricsStorages[i].vminsert.maxAllowed.cpu CPU limit. quantity ""
metricsStorages[i].vminsert.maxAllowed.memory Memory limit. quantity ""
metricsStorages[i].vmselect Configuration for vmselect. object {}
metricsStorages[i].vmselect.minAllowed Minimum guaranteed resources. object {}
metricsStorages[i].vmselect.minAllowed.cpu CPU request. quantity ""
metricsStorages[i].vmselect.minAllowed.memory Memory request. quantity ""
metricsStorages[i].vmselect.maxAllowed Maximum allowed resources. object {}
metricsStorages[i].vmselect.maxAllowed.cpu CPU limit. quantity ""
metricsStorages[i].vmselect.maxAllowed.memory Memory limit. quantity ""
metricsStorages[i].vmstorage Configuration for vmstorage. object {}
metricsStorages[i].vmstorage.minAllowed Minimum guaranteed resources. object {}
metricsStorages[i].vmstorage.minAllowed.cpu CPU request. quantity ""
metricsStorages[i].vmstorage.minAllowed.memory Memory request. quantity ""
metricsStorages[i].vmstorage.maxAllowed Maximum allowed resources. object {}
metricsStorages[i].vmstorage.maxAllowed.cpu CPU limit. quantity ""
metricsStorages[i].vmstorage.maxAllowed.memory Memory limit. quantity ""

Logs storage configuration

Name Description Type Value
logsStorages Configuration of logs storage instances. []object [...]
logsStorages[i].name Name of the storage instance. string ""
logsStorages[i].retentionPeriod Retention period for logs. string 1
logsStorages[i].storage Persistent volume size. string 10Gi
logsStorages[i].storageClassName StorageClass used to store the data. string replicated

Alerta configuration

Name Description Type Value
alerta Configuration for the Alerta service. object {}
alerta.storage Persistent volume size for the database. string 10Gi
alerta.storageClassName StorageClass used for the database. string ""
alerta.resources Resource configuration. object {}
alerta.resources.requests Resource requests. object {}
alerta.resources.requests.cpu CPU request. quantity 100m
alerta.resources.requests.memory Memory request. quantity 256Mi
alerta.resources.limits Resource limits. object {}
alerta.resources.limits.cpu CPU limit. quantity 1
alerta.resources.limits.memory Memory limit. quantity 1Gi
alerta.alerts Alert routing configuration. object {}
alerta.alerts.telegram Configuration for Telegram alerts. object {}
alerta.alerts.telegram.token Telegram bot token. string ""
alerta.alerts.telegram.chatID Telegram chat ID(s), separated by commas. string ""
alerta.alerts.telegram.disabledSeverity List of severities without alerts (e.g. ["informational","warning"]). []string []
alerta.alerts.slack Configuration for Slack alerts. object {}
alerta.alerts.slack.url Configuration uri for Slack alerts. string ""
alerta.alerts.slack.disabledSeverity List of severities without alerts (e.g. ["informational","warning"]). []string []

Grafana configuration

Name Description Type Value
grafana Configuration for Grafana. object {}
grafana.db Database configuration. object {}
grafana.db.size Persistent volume size for the database. string 10Gi
grafana.resources Resource configuration. object {}
grafana.resources.requests Resource requests. object {}
grafana.resources.requests.cpu CPU request. quantity 100m
grafana.resources.requests.memory Memory request. quantity 256Mi
grafana.resources.limits Resource limits. object {}
grafana.resources.limits.cpu CPU limit. quantity 1
grafana.resources.limits.memory Memory limit. quantity 1Gi

Vmagent configuration

Name Description Type Value
vmagent Configuration for VictoriaMetrics Agent. object {}
vmagent.externalLabels External labels applied to all metrics. object {}
vmagent.remoteWrite Remote write configuration. object {}