Redirecting application metrics to external storage
Раздел «For cluster administrators»: быстрый переход по подразделам
На этой странице
When setting up application monitoring, metrics for storage are sent to a local VictoriaMetrics instance (VMSinlge manifest), which is deployed in the user-monitoring namespace of the client cluster. If necessary, you can redirect application metrics to external storage.
To do this, in VMAgent, replace or add the external storage URL in the spec.remoteWrite section. Please note! External storage must support the Prometheus/VictoriaMetrics Remote Write protocol.
VMAgent Example
apiVersion: operator.victoriametrics.com/v1beta1
kind: VMAgent
metadata:
labels:
app: vmagent-user-monitoring # Name cannot be changed
app.kubernetes.io/component: monitoring
app.kubernetes.io/name: user-monitoring
name: user-monitoring
namespace: user-monitoring
spec:
externalLabels:
cluster: client-cluster
extraArgs:
<your parameter values>
logFormat: <your-parameter-value>
logLevel: <your-parameter-value>
nodeScrapeNamespaceSelector:
matchExpressions:
- key: shturval.tech/system-namespace
operator: DoesNotExist
podScrapeNamespaceSelector:
matchExpressions:
- key: shturval.tech/system-namespace
operator: DoesNotExist
port: "8429"
probeNamespaceSelector:
matchExpressions:
- key: shturval.tech/system-namespace
operator: DoesNotExist
remoteWrite:
- url: <your-parameter-value> # External VictoriaMetrics storage URL
replicaCount: <your-parameter-value>
resources:
limits:
cpu: <your-parameter-value>
memory: <your-parameter-value>
requests:
cpu: <your-parameter-value>
memory: <your-parameter-value>
scrapeConfigNamespaceSelector:
matchExpressions:
- key: shturval.tech/system-namespace
operator: DoesNotExist
scrapeInterval: <your-parameter-value>
securityContext:
fsGroup: 2000
runAsGroup: 2000
runAsNonRoot: true
runAsUser: 1000
serviceAccountName: vmagent-user-monitoring
serviceScrapeNamespaceSelector:
matchExpressions:
- key: shturval.tech/system-namespace
operator: DoesNotExist
staticScrapeNamespaceSelector:
matchExpressions:
- key: shturval.tech/system-namespace
operator: DoesNotExist
tolerations:
- effect: NoSchedule
key: node-role.kubernetes.io/infra
operator: Exists
vmAgentExternalLabelName: ""
| Parameter | Description | Data type | Example |
|---|---|---|---|
| extraArgs | List of additional launch arguments | []object | envflag.enable: “true” envflag.prefix: VM_ promscrape.dropOriginalLabels: “true” promscrape.maxScrapeSize: “67108864” promscrape.streamParse: “true” remoteWrite.tmpDataPath: /tmp |
| logFormat | Log Format | string | default |
| logLevel | Log level | string | INFO |
| replicaCount | Number of replicas | integer | 1 |
| remoteWrite | List of links to remote metrics stores for recording | []object | url: vmcluster.local:8480/insert/123/prometheus |
| resources | Resources requests and limits | []object | limits: cpu: 10 memory: 10Gi requests: cpu: 50m memory: 50Mi |
| scrapeInterval | Metric collection frequency | integer | 15s |