helm-charts icon indicating copy to clipboard operation
helm-charts copied to clipboard

[prometheus] How to set prometheus alert ExternalURL value

Open charlottehu111 opened this issue 2 years ago • 0 comments

Describe the bug a clear and concise description of what the bug is.

It is more like a consulting issue.

We are using your prometheus chart to deploy in our kubenetes. We are using externalUrl to set the link in our alert template:

"activityTitle": "[{{ $alert.Annotations.description }}]({{ $externalUrl }})",

We are using externalUrl from alert request jason body as blow:

{
    "version": "4",
    "groupKey": "{}:{alertname=\"test_by_ying\"}",
    "status": "firing",
    "receiver": "teams_proxy",
    "groupLabels": {
        "alertname": "test_by_ying"
    },
    "commonLabels": {
        "alertname": "test_by_ying",
        "monitor": "master",
        "severity": "error"
    },
    "commonAnnotations": {
        "summary": "Server High Memory usage"
    },
    "externalURL": "http://docker.for.mac.host.internal:9093",
    "alerts": [
        {
            "labels": {
                "alertname": "test",
                "instance": "10.80.40.11:9100",
                "job": "docker_nodes",
                "monitor": "master",
                "severity": "error"
            },
            "annotations": {
                "description": "Test.",
                "summary": "Test"
            },
            "startsAt": "2018-03-07T06:33:21.873077559-05:00",
            "endsAt": "0001-01-01T00:00:00Z"
        }
    ]
}

We want to configure externalURL in alert. It seems that we should configure value.yaml in this two line: https://github.com/prometheus-community/helm-charts/blob/main/charts/prometheus/values.yaml#L77 and https://github.com/prometheus-community/helm-charts/blob/main/charts/prometheus/values.yaml#L705 due to your configuration code in file 1 and file 2:

          {{- if .Values.server.baseURL }}
            - --web.external-url={{ .Values.alertmanager.baseURL }}
          {{- end }}

However, I deployed using this command:

helm upgrade --install prometheus prometheus-community/prometheus -f prometheus.values.yaml --namespace istio-system --set alertmanager.baseURL=https://grafana.api.eu12.print.services.sap/d/k7VPy7WGk/logs\?orgId\=1 --set server.baseURL=https://grafana.api.eu12.print.services.sap/d/k7VPy7WGk/logs\?orgId\=1

and the configuration is inserted in our deployed prometheus deployment and alertmanager deployment:

     containers:
        - name: prometheus-server-configmap-reload
          image: 'jimmidyson/configmap-reload:v0.5.0'
          args:
            - '--volume-dir=/etc/config'
            - '--webhook-url=http://127.0.0.1:9090/-/reload'
          resources: {}
          volumeMounts:
            - name: config-volume
              readOnly: true
              mountPath: /etc/config
          terminationMessagePath: /dev/termination-log
          terminationMessagePolicy: File
          imagePullPolicy: IfNotPresent
          securityContext: {}
        - name: prometheus-server
          image: 'quay.io/prometheus/prometheus:v2.36.2'
          args:
            - '--storage.tsdb.retention.time=15d'
            - '--config.file=/etc/config/prometheus.yml'
            - '--storage.tsdb.path=/data'
            - '--web.console.libraries=/etc/prometheus/console_libraries'
            - '--web.console.templates=/etc/prometheus/consoles'
            - '--web.enable-lifecycle'
            - >-
              --web.external-url=<custom web external url>
      containers:
        - name: prometheus-alertmanager
          image: 'quay.io/prometheus/alertmanager:v0.24.0'
          args:
            - '--config.file=/etc/config/alertmanager.yml'
            - '--storage.path=/data'
            - '--cluster.listen-address='
            - >-
              --web.external-url=<custom web external url>

The externalUrl value in prometheus alert is still http://localhost:9093/ as default configuration in this line . It is not my <custom web external url>.

I wonder is there anything else I need to configure? Thanks

Charlotte

What's your helm version?

version.BuildInfo{Version:"v3.6.3", GitCommit:"d506314abfb5d21419df8c7e7e68012379db2354", GitTreeState:"dirty", GoVersion:"go1.16.5"}

What's your kubectl version?

Client Version: version.Info{Major:"1", Minor:"25", GitVersion:"v1.25.0", GitCommit:"a866cbe2e5bbaa01cfd5e969aa3e033f3282a8a2", GitTreeState:"clean", BuildDate:"2022-08-23T17:36:43Z", GoVersion:"go1.19", Compiler:"gc", Platform:"darwin/amd64"} Kustomize Version: v4.5.7 Server Version: version.Info{Major:"1", Minor:"21", GitVersion:"v1.21.10", GitCommit:"a7a32748b5c60445c4c7ee904caf01b91f2dbb71", GitTreeState:"clean", BuildDate:"2022-02-16T11:18:16Z", GoVersion:"go1.16.14", Compiler:"gc", Platform:"linux/amd64"} WARNING: version difference between client (1.25) and server (1.21) exceeds the supported minor version skew of +/-1

Which chart?

prometheus

What's the chart version?

latest

What happened?

No response

What you expected to happen?

No response

How to reproduce it?

No response

Enter the changed values of values.yaml?

helm upgrade --install prometheus prometheus-community/prometheus -f prometheus.values.yaml --namespace istio-system --set alertmanager.baseURL=https://grafana.api.eu12.print.services.sap/d/k7VPy7WGk/logs?orgId=1 --set server.baseURL=https://grafana.api.eu12.print.services.sap/d/k7VPy7WGk/logs?orgId=1

Enter the command that you execute and failing/misfunctioning.

helm upgrade --install prometheus prometheus-community/prometheus -f prometheus.values.yaml --namespace istio-system --set alertmanager.baseURL=https://grafana.api.eu12.print.services.sap/d/k7VPy7WGk/logs?orgId=1 --set server.baseURL=https://grafana.api.eu12.print.services.sap/d/k7VPy7WGk/logs?orgId=1

Anything else we need to know?

No response

charlottehu111 avatar Sep 21 '22 08:09 charlottehu111