Trying to connect selfhosted grafana to cloud oncall

Hi! I’m trying to connect self-hosted grafana oncall to cloud oncall so that we can use the mobile app with push notifications.

The grafana documentation says

To connect to Grafana Cloud OnCall, refer to the Cloud page in your OSS Grafana OnCall instance.

Our OSS grafana OnCall instance wants a Grafana Cloud OnCall API key

Find it on the Settings page of OnCall, within your Grafana Cloud OnCall instance

In the Grafana Cloud OnCall instance, there is no option to create an API key; I read in a blog post that they have been deprecated. I tried creating an API token instead, but it says “invalid token”. I can use the token with curl without error.

In the env variables tab of the grafana oncall plugin on our self hosted grafana, I looked for a place to set the https://oncall-prod-eu-west-0.grafana.net/oncall/ url, but I didn’t find one. Is this the problem?

I read a post in this community called “invalid-token-when-connecting-on-call-with-grafana-cloud” (hit the new user links per post limit, sorry) that the url should be set in an ONCALL_CLOUD_API_URL variable, but I’m not sure if that variable should be set in the helm chart for the kube-prometheus-stack (where our grafana is) or the docker compose for oncall or somewhere else.

After reading a grafana blog post about entitled “grafana-cloud-access-policies-say-hi-to-the-new-cloud-api-keys”, i tried creating one of those. This also did not work, same invalid token error.

1 Like

Hi @meander

I am facing the same issue, created a GitHub issue a few days ago: v1.9.0 Grafana OnCall Plugin: Can't connect to Grafana Cloud OnCall · Issue #4943 · grafana/oncall · GitHub

Thanks! I replied on the github issue. My setup is slightly different from yours but the result is the same.

Actually I think mine’s a bit different, because I can connect to the self-hosted OnCall all right, I’m just getting a token error when I try to connect to the cloud OnCall

Recently we made some changes to the way Grafana OnCall is initialized. Use 1.9.22, there were quite a few changes along the way from 1.9.0-1.9.22 to get things working.

  • If you are running Grafana 11 and newer you must have externalServiceAccounts feature toggle enabled.
    This has already been enabled in the docker compose files and helm charts in the oncall repo.
  • Plugin settings must be provided to the plugin using an API call if you are installing for the first time (Note: credentials and hostnames need to be adjusted for your configuration, stackId and orgId are expected to be the listed constants in a self-hosted configuration)
curl -X POST 'http://admin:admin@localhost:3000/api/plugins/grafana-oncall-app/settings' -H "Content-Type: application/json" -d '{"enabled":true, "jsonData":{"stackId":5, "orgId":100, "onCallApiUrl":"http://engine:8080/", "grafanaUrl":"http://grafana:3000/"}}'
  • Once settings are configured use this API call to install:
curl -X POST 'http://admin:admin@localhost:3000/api/plugins/grafana-oncall-app/resources/plugin/install'

Grafana OnCall should now be ready to use.
For additional troubleshooting see here

Hi! Thanks, I’ve followed these steps after upgrading to 1.9.22 but this only helped me to connect self-hosted grafana to oncall after the upgrade. The thing that I’ve been stuck on is connecting Open Source OnCall to Grafana Cloud OnCall so that I can use the mobile app with with push notifications.

In the self-hosted grafana, it says that I need a Grafana Cloud OnCall API Key, and it says that I can get this key from the Grafana Cloud OnCall instance on the Settings page:

But here I am on the settings page, and there is no place to generate a key. I tried to generate a token instead of an API Key, but when I paste the token into the API Key box, it says “Invalid token”.

I know the token is valid because I can curl with it and get a HTTP 200: https://oncall-prod-eu-west-0.grafana.net/oncall/api/v1/integrations