{{- $ctx := dict "helm" . "style" "plain" }}
{{- $fullname := include "vm.plain.fullname" $ctx }}
{{- $ns := include "vm.namespace" $ctx }}
Write API:

The Victoria Metrics Auth can be accessed via port {{ .Values.service.servicePort }} on the following DNS name from within your cluster:
{{ $fullname }}

Get the Victoria Metrics Auth service URL by running these commands in the same shell:
{{- if contains "NodePort" .Values.service.type }}
  export NODE_PORT=$(kubectl get --namespace {{ $ns }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ $fullname }})
  export NODE_IP=$(kubectl get nodes --namespace {{ $ns }} -o jsonpath="{.items[0].status.addresses[0].address}")
  echo http://$NODE_IP:$NODE_PORT
{{- else if contains "LoadBalancer" .Values.service.type }}
  NOTE: It may take a few minutes for the LoadBalancer IP to be available.
        You can watch the status of by running 'kubectl get svc --namespace {{ $ns }} -w {{ $fullname }}'

  export SERVICE_IP=$(kubectl get svc --namespace {{ $ns }} {{ $fullname }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
  echo http://$SERVICE_IP:{{ .Values.service.servicePort }}
{{- else if contains "ClusterIP"  .Values.service.type }}
  export POD_NAME=$(kubectl get pods --namespace {{ $ns }} -l "app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
  kubectl --namespace {{ $ns }} port-forward $POD_NAME {{ .Values.service.servicePort }}
{{- end }}

You need to update your prometheus configuration file and add next lines into it:

prometheus.yml
```yaml
remote_write:
  - url: "http://<insert-service>/insert/0/prometheus/"
```

for e.g. inside the kubernetes cluster:
```yaml
remote_write:
  - url: {{ include "vm.url" $ctx }}/insert/0/prometheus/
```

Read API:

You need to update specify select service URL in your Grafana:
 NOTE: you need to use Prometheus Data Source

Input for URL field in Grafana

```
http://<select-service>:{{ .Values.service.servicePort }}/select/0/prometheus/
```

for e.g. inside the kubernetes cluster:
```
{{ include "vm.url" $ctx }}/select/0/prometheus/"
```
