Grafana OnCall plugin provisioning

Hello,

apiVersion: 1

apps:
  - type: grafana-oncall-app
    org_id: 1
    disabled: false

Plugin is enabled automatically, but I can’t figure out what exactly should be pasted in jsonData and secureJsonData. After manual plugin configuration there were these fields (filled with values) in grafana.db/plugin-setting:

apiVersion: 1

apps:
  - type: grafana-oncall-app
    org_id: 1
    disabled: false
    
    jsonData:
      error: null
      license: OpenSource
      onCallApiUrl: http://engine:8080
      orgId: 100
      stackId: 5
    
    secureJsonData:
      grafanaToken: <token>
      onCallApiToken: <token>

And simple debug showed that Grafana sends several GET and POST requests and gets the same key:value pairs in response. But I don’t have any tokens before the start of containers and can’t fill token values in advance.

  • Also I’ve found this file on the OnCall github repository:
    ttps://github.com/grafana/oncall/blob/b3659872a7a66a53092ca5981e05d3510e0c2370/grafana-plugin/grafana-plugin.yml.example
apps:
  - type: grafana-oncall-app
    name: grafana-oncall-app
    disabled: false
    jsonData:
      stackId: <Populate via script>
      orgId: <Populate via script>
      onCallApiUrl: <Populate via script>
    secureJsonData:
      onCallApiToken: <Populate via script>

but I still can’t understand which script can be helpful in filling this yaml file before the start of containers.
So can you answer whether it is even possible to automate GUI button-clicking with Grafana plugin provisioning file? If so, how?

Hello,

I was searching how to provision the oncall plugin configuration and stumble upon this article. So adding my solution for others in need.

I managed to make it work with the following file :

/etc/grafana/provisioning/plugins/oncall.yaml

apiVersion: 1

apps:
  - type: grafana-oncall-app
    org_id: 1
    enabled: true
    jsonData:
      stackId: 5
      orgId: 1
      onCallApiUrl: http://oncall-engine.oncall.svc:8080

The context is a kubernetes cluster with grafana and oncall deployed via helm charts.