Remote Rendering - Connection refused

Hi all,

Currently, I am using docker with WSL2 enabled on a Windows 10 server.
On this docker, I have depoyed InfluxDB2, Grafana (v7.5.6) and Grafana-Image-Renderer (v2.1.0)

I am already able to graph my data, but I wish also to export the charts via grafana remote image renderer to internal png files.

Therefore I used the setup information provided within the grafana image renderer documentation.

Therefore I have set the following environment variables of grafana:
GF_RENDERING_SERVER_URL=http://localhost:3030/render
GF_RENDERING_CALLBACK_URL=http://localhost:3000/
GF_LOG_FILTERS=rendering:debug

As well as the remote image renderer variables:
HTTP_HOST=localhost
HTTP_PORT=3030
ENABLE_METRICS=true
LOG_LEVEL=debug
RENDERING_VERBOSE_LOGGING=true

to get the most beneficial log information.

What now happens if I hit the share button of a panel and select “direct link rendered image” the pop-up window shows an error.
Reviewing the logs of the grafana container shows that the connection was refused by grafana image renderer:

t=2021-05-14T07:00:41+0000 lvl=info msg=Rendering logger=rendering renderer=http path="d-solo/AlmW8bwGz/openhab-dashboard?orgId=3&refresh=30m&from=1620954040208&to=1620975640209&panelId=2&width=1000&height=500&tz=Europe%2FBerlin"
t=2021-05-14T07:00:41+0000 lvl=dbug msg="calling remote rendering service" logger=rendering renderer=http url="http://localhost:3030/render?deviceScaleFactor=1.000000&domain=localhost&encoding=&height=500&renderKey=pe790ZAB7BxzFB31mIfUeKLDxKIvvY28&timeout=60&timezone=Europe%2FBerlin&url=http%3A%2F%2Flocalhost%3A3000%2Fd-solo%2FAlmW8bwGz%2Fopenhab-dashboard%3ForgId%3D3%26refresh%3D30m%26from%3D1620954040208%26to%3D1620975640209%26panelId%3D2%26width%3D1000%26height%3D500%26tz%3DEurope%252FBerlin%26render%3D1&width=1000"
t=2021-05-14T07:00:41+0000 lvl=eror msg="Failed to send request to remote rendering service." logger=rendering renderer=http error="Get \"http://localhost:3030/render?deviceScaleFactor=1.000000&domain=localhost&encoding=&height=500&renderKey=pe790ZAB7BxzFB31mIfUeKLDxKIvvY28&timeout=60&timezone=Europe%2FBerlin&url=http%3A%2F%2Flocalhost%3A3000%2Fd-solo%2FAlmW8bwGz%2Fopenhab-dashboard%3ForgId%3D3%26refresh%3D30m%26from%3D1620954040208%26to%3D1620975640209%26panelId%3D2%26width%3D1000%26height%3D500%26tz%3DEurope%252FBerlin%26render%3D1&width=1000\": dial tcp 127.0.0.1:3030: connect: connection refused"
t=2021-05-14T07:00:42+0000 lvl=eror msg="Rendering failed." logger=context userId=4 orgId=3 uname=StephanAdmin error="failed to send request to remote rendering service: Get \"http://localhost:3030/render?deviceScaleFactor=1.000000&domain=localhost&encoding=&height=500&renderKey=pe790ZAB7BxzFB31mIfUeKLDxKIvvY28&timeout=60&timezone=Europe%2FBerlin&url=http%3A%2F%2Flocalhost%3A3000%2Fd-solo%2FAlmW8bwGz%2Fopenhab-dashboard%3ForgId%3D3%26refresh%3D30m%26from%3D1620954040208%26to%3D1620975640209%26panelId%3D2%26width%3D1000%26height%3D500%26tz%3DEurope%252FBerlin%26render%3D1&width=1000\": dial tcp 127.0.0.1:3030: connect: connection refused"
t=2021-05-14T07:00:42+0000 lvl=eror msg="Request Completed" logger=context userId=4 orgId=3 uname=StephanAdmin method=GET path=/render/d-solo/AlmW8bwGz/openhab-dashboard status=500 remote_addr=172.17.0.1 time_ms=224 size=1723 referer=

I was expecting that everything went well after both, grafana container, as well as tha imager renderer container, started successfully, without any error logs.

This issues is driving me crazy, since I get no information why/or where the connection is refused.
I can access everything else on the server without any issues and I also tried to let the remote image renderer run via the docker bridge network as well as via the host.
Both with the same result, the service is starting properly but the connection is refused.

I am really looking forward to any suggestions, help or hints.

Best regards

I haven’t used the image renderer specifically, but am I right to assume that it’s running in a separate Docker container to your Grafana server? Because I feel like that’s the issue.

Within each Docker container, localhost generally refers to the container itself - rather than your host machine. So instead of pointing your Grafana image to a renderer at localhost (where one doesn’t exist), I think you need to select the actual domain name (usually just the container name) or IP address of the container where the renderer is running.

Hopefully that helps, but let me know if not

1 Like

Hi,

many thanks for your suggestion and yes, your assumption is correct,
both, grafana and image renderr are running in two different containers.

the strange thing is, that if I am using the domain name (container name or server name) the address is not resolved properly.

If I am using the docker ip of the container for grafana and image renderer the rendering works without any issue.

So currently my grafana environment variables has to look like this:
GF_RENDERING_SERVER_URL=http://172.17.0.5:3030/render
GF_RENDERING_CALLBACK_URL=http://172.17.0.7:3000/

Many thanks for the hint!!
Now I can proceed with my work. =)