Rendering a dashboard

Hi all,

I’m trying to render a dashboard using the /render api; these are the steps I’m following as an initial attempt (Grafana v6.0.1, from inside a Docker container):

  1. Find the dashboard’s uid and name:

    curl 'localhost:3000/api/search'

  2. Try to render it

    curl 'localhost:3000/render/d-solo/UID/NAME?width=600&height=400&panelId=1'

I tried with other urls like /render/dashboard-solo/db endpoint and /render/dashboard/db but they both gave 301 errors when retrieving data (I think it had to do with this.)

Log output:

t=2019-06-12T21:43:53+0000 lvl=info msg=Rendering logger=rendering path="d-solo/UID/NAME?width=600&height=400&panelId=1"
t=2019-06-12T21:43:53+0000 lvl=eror msg="Could not find plugin definition for data source: "
t=2019-06-12T21:44:55+0000 lvl=info msg="Rendering timed out" logger=rendering
t=2019-06-12T21:44:55+0000 lvl=eror msg="Timeout error. You can set timeout in seconds with   &timeout url parameter" logger=context userId=0 orgId=1 uname= error="Timeout error. You can set timeout in seconds with &timeout url parameter"
t=2019-06-12T21:44:55+0000 lvl=eror msg="Request Completed" logger=context userId=0 orgId=1 uname= method=GET path=/render/d-solo/UID/NAME status=500 remote_addr=127.0.0.1 time_ms=62029 size=1790 referer=

I’ve tried upping the timeout but I still get timeout errors.

Any idea what could be causing the issue?

Thanks!

Hmm, that Could not find plugin definition for data source message looks like there’s something wrong with the dashboard you’re trying to render. If this is the case, can I suggest that the first step would be to generate a really simple dash with a single panel - and use one of the built in ones.

If that works then it proves your access method is sound, in which case I’d revisit your original dashboard, and export the JSON. Loading that into an editor should easily show what plugins are needed - check the __requires property and you’ll be able to see the datasource and graphics plugins needed listed.

I also just checked my setup (I have a Go program that makes HTML reports from a variety of sources including Grafana panels) and I’ve got orgId, from and to parameters set as well. I’m also setting Content-Type: application/json header in my requests, but that’s maybe just a peculiarity of the way we have Grafana setup here.