oncall
oncall copied to clipboard
Separate Grafana URLs for internal and external usage (helm)
We have installed Grafana OnCall OSS via helm. Grafana itself is installed externally, that is, in the values.yaml file for OnCall we have set the following:
grafana:
enabled: false
We get the following output from the oncall chart installation:
👋 Your Grafana OnCall instance has been successfully deployed
❗ Set up a DNS record for your domain (use A Record and "@" to point a root domain to the IP address)
Get the external IP address by running the following commands and point xxx to it:
kubectl get ingress oncall -o jsonpath="{.status.loadBalancer.ingress[0].ip}"
Wait until the dns record got propagated.
NOTE: Check with the following command: nslookup xxx
Try reaching https://xxx from the browser, make sure it is not cached locally
🦎 Grafana was NOT installed as a part of this helm release. Open external Grafana, go to "Configuration" - "Plugins" and find Grafana OnCall plugin
NOTE: Make sure your external Grafana is available by the network for the containers installed by this release.
🔗 Connect Grafana OnCall Plugin to Grafana OnCall backend:
Issue the one-time token to connect Grafana OnCall backend and Grafana OnCall plugin by running these commands:
export POD_NAME=$(kubectl get pods --namespace xxx -l "app.kubernetes.io/name=oncall,app.kubernetes.io/instance=oncall,app.kubernetes.io/component=engine" -o jsonpath="{.items[0].metadata.name}")
kubectl exec -it $POD_NAME -- bash -c "python manage.py issue_invite_for_the_frontend --override"
Fill the Grafana OnCall Backend URL:
http://oncall-engine:8080
Fill the Grafana URL:
https://<external-grafana>
Now, for the Grafana URL we have specified the service name of Grafana's kubernetes deployment, for example: http://grafana-service:80
. Everything is working as expected, and the OnCall plugin can successfully connect to Grafana.
The issue we have is in the slack integration in ChatOps. The link to Grafana's URL generated in the Slack message is using the same value specified above, that is: http://grafana-service:80
.
Would it be possible to define an external Grafana URL for the link generated in the Slack message? I believe in the template it is referenced by grafana_oncall_link
.
I can confirm this behavior for our installation, although we are using the docker-compose setup and with SMS templates using grafana_oncall_link
.
Same problem here, I am surprised there is no way to configure this.
As a temporary workaround until this issue gets fixed, you can change the Grafana URL with the replace filter in the alert template: grafana_oncall_link|replace("grafana-service:80", "grafana.your.domain.com")
Here is a template that changes the Grafana URL in the default Slack title template:
{% set title = payload.get("labels", {}).get("alertname", "No title (check Title Template)") %}
{# Combine the title from different built-in variables into slack-formatted url #}
*<{{ grafana_oncall_link|replace("grafana-service:80", "grafana.your.domain.com") }}|#{{ grafana_oncall_incident_id }} {{ title }}>* via {{ integration_name }}
{% if source_link %}
(*<{{ source_link }}|source>*)
{%- endif %}
This issue has been automatically marked as stale because it has not had activity in the last 120 days.
I think this is still relevant!