Tutorial - Grafana rendering on Raspberry Pi

What seems to be working for me is migrating to Docker.
I have a found this: https://hub.docker.com/r/adejong/grafana-image-renderer-pi

If you use the provided docker-compose.yml there, you can get this working on a Raspberry Pi within minutes and no need to mess around with its dependencies. Seems to be working with the new 7.0 as well!

I followed the steps and everything is completed successfully. However, when i restart grafana the log still shows:

msg="No image renderer found/installed.

Since the version upgrade to Grafana 7 my renderer stopped working (was using the arm7 phantomjs till now). After trying to compile the grafana renderer for arm and going to all kinds of nodejs /yarn version mismatches I had most luck with the Docker version of the renderer. I decided to keep using my installed Grafana version and only run the renderer from Docker.

I use the following docker-compose.yml:

version: "2"

services:
  renderer:
    restart: always
    image: adejong/grafana-image-renderer-pi:1.0.8-beta2
    container_name: grafana-image-renderer-pi
    ports:
      - 8081:8081

You need to make the following changes only to the /etc/grafana.ini (replace “openhab” with the ip of your server running Grafana and the Docker container with the renderer):

server_url = http://openhab:8081/render
callback_url = http://openhab:3000

After that restart Grafana (sudo systemctl restart grafana-server.service if on linux / opehabian) and start the docker container (in the location of your docker-compose.yml file):

docker-compose up -d

If Docker is installed and started by systemd at boot the renderer will automatically start next time.

1 Like

@wezzix
Thanks for taking the time to document your solution. It worked perfectly for me. I would have never figured this out on my own. Just too bad that Grafana doesn’t have a plugin for RPi as it is such a common platform.

Big THANKS!!! to @wezzix and all others who put together the pieces, thanks to your help I was finally able to compile the plugin for my Pi4b.

This works perfect for me, thanks

If you are running grafana as a docker as well, add these as env vars:
GF_RENDERING_SERVER_URL=http://openhab:8081/render
GF_RENDERING_CALLBACK_URL=http://openhab:3000

1 Like

Do I need to update IP address for following variables

 environment:
      GF_RENDERING_SERVER_URL: http://renderer:8081/render
      GF_RENDERING_CALLBACK_URL: http://grafana:3000/

LIke if openhab and garafana on the same pi with IP 192.168.1.45

environment:
GF_RENDERING_SERVER_URL: http://192.168.1.45:8081/render
GF_RENDERING_CALLBACK_URL: http://192.168.1.45:3000/

Are you using Grafana in Docker also?
If yes, you don’t need to modify anything.

If you can use docker-compose, here is my compose file. This will install grafana and the image renderer in its own container:


version: "2"

services:
  grafana:
    image: grafana/grafana:latest
    user: "0"
    container_name: Grafana
    environment:
      GF_RENDERING_SERVER_URL: http://renderer:8081/render
      GF_RENDERING_CALLBACK_URL: http://grafana:3000/
      GF_INSTALL_PLUGINS: raintank-worldping-app,grafana-piechart-panel,natel-plotly-panel,grafana-worldmap-panel,alexandra-trackmap-panel,pr0ps-trackmap-panel
    ports:
      - 3000:3000
    links:
      - renderer
    volumes:
      - ./data:/var/lib/grafana
      - ./config:/etc/grafana
  renderer:
    image: adejong/grafana-image-renderer-pi:1.0.8-beta2
    container_name: GrafanaImageRendererPi
    ports:
      - 8081

You should update the volumes path for your installation but anything else then this is not required. Honestly I don’t really know where these urls are resolved and how, but in this case it works. If you are using Grafana as a standard installation, I think you might need to update these values.
For me this was the easiest way to get it working, other installation methods all failed for me somewhere.

Thanks Kristof,

Reached next step Now both Grafana and Grafana Image RendererPi container are running .
Render request received by Renderer:

render request received for http://grafana:3000/d-solo/A8dz1Eigk/internet?orgId=1&from=1592587229560&to=1592673629560&panelId=2&width=1000&height=500&tz=Asia%2FCalcutta&render=1


::ffff:172.19.0.11 - - [20/Jun/2020:17:41:38 +0000] "GET /render?deviceScaleFactor=1.000000&domain=grafana&encoding=&height=500&renderKey=0e99Yq6jFbprBSdQGC5WpSDXVtnWgtp2&timeout=60&timezone=Asia%2FCalcutta&url=http%3A%2F%2Fgrafana%3A3000%2Fd-solo%2FA8dz1Eigk%2Finternet%3ForgId%3D1%26from%3D1592587229560%26to%3D1592673629560%26panelId%3D2%26width%3D1000%26height%3D500%26tz%3DAsia%252FCalcutta%26render%3D1&width=1000 HTTP/1.1" 200 64845 "-" "Grafana/7.0.3"


render request received for http://grafana:3000/d-solo/A8dz1Eigk/internet?orgId=1&from=1592587229560&to=1592673629560&panelId=2&width=1000&height=500&tz=Asia%2FCalcutta&render=1

stadalone redaring url using browser is working fine great . :+1:
But using Openhab webview : system is giving :point_down:

**192.168.1.100** refused to connect.

Frame label="Statistics"

                {
                    Webview url="http://192.168.1.100:3000/render/d-solo/A8dz1Eigk/internet?orgId=1&from=1592587229560&to=1592673629560&panelId=2&width=1000&height=500&tz=Asia%2FCalcutta" height=12 icon="speedtest_summary"
                }

I think this is because openHAB did not have a cached authenticated session for Grafana. Try enabling anonymous access so that you don’t have to authenticate yourself to view the graphs.

1 Like

hi updated following parameter in Grafana config file
allow_embedding = true

Post of which now it started working intermittently

grafana.log (20.0 KB) GrafanaImageRendererPi.log (5.8 KB)

sometime it works some times it fails

THis no longer works, as the src directory doesn’t exist when i tried to cd into it.

I can confirm that above steps for running the plugin in grafana without docker is working on my raspberry PI 3B+ with the latest version of grafana (v 7.0.6)
In my case, editing the grpc-plugin.ts file was not needed (the file did not exist)
However, I did have to add another step. After restarting grafana and checking the the log with systemctl status grafana-server.service, I received following error:

"Failed to load plugin" logger=plugins error="plugin \"grafana-image-renderer\" is unsigned" pluginPath=/var/lib/grafana/plugins/grafana-image-renderer

Apparently, the compiled plugin is not signed. I used following workaround to get unsigned plugins working:

sudo nano /etc/grafana/grafana.ini

And then add the following line in the end:

[plugins]
allow_loading_unsigned_plugins = "grafana-image-renderer"

This allows grafana to run the unsigned image renderer plugin. Another option could be to get a signed version of the plugin, but I have no idea on how to do that.

I also had to install the chromium browser as already pointed out in this thread.

The image rendering is working fine now, but it does take ~5 secs for the image to appear

Raspberry Pi 3b+ SBU and grafana-image-renderer and Openhab does not look a good combination.
I started using Garafan Separately rather than integrating with openhab .
Do not know the performance on Pi 4 .

I’ve not read the whole thread but grafana and openHAB run fine on my RPi3+.
Webview url=“http://192.168.0.108:3000/d-solo/Ixy2RVkRk/openhab?orgId=1&panelId=2&<>..>&refresh=2h” height=10
Draws very quickly, I just get the annoying symbol in top left. Every now and then I have to enter the username and password into the Grafana login page

you can remove the annoying icon with: icon=none
Webview url=“http://192.168.0.108:3000/d-solo/Ixy2RVkRk/openhab?orgId=1&panelId=2&<>…>&refresh=2h ” height=10 icon=none

Thanks

I’m seeing some other users here are getting the Failure to launch chrome! error, as am I but with a different message. It seems it’s a permission issue. I know Grafana runs with a group ID of 472, so I’ve run sudo chown -R 472:472 ... on the suspect directories but no luck. Has anyone ran across this?

t=2021-04-26T05:03:16+0000 lvl=eror msg="Render request failed" logger=plugins.backend pluginId=grafana-image-renderer url="http://localhost:3000/dashboard-solo/db/graph-styles?panelId=2&fullscreen&from=1617645176357&to=1617855730979&width=1000&height=500&render=1" error="Error: Failed to launch chrome!\n/usr/bin/chromium-browser: 12: xdg-settings: not found\ncmd_run.go:994: WARNING: cannot create user data directory: cannot create \"/usr/share/grafana/snap/chromium/1565\": mkdir /usr/share/grafana/snap: permission denied\ncannot create user data directory: /usr/share/grafana/snap/chromium/1565: Permission denied\n\n\nTROUBLESHOOTING: https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md\n"

t=2021-04-26T05:03:16+0000 lvl=eror msg="Rendering failed." logger=context userId=0 orgId=1 uname= error="rendering failed: Error: Failed to launch chrome!\n/usr/bin/chromium-browser: 12: xdg-settings: not found\ncmd_run.go:994: WARNING: cannot create user data directory: cannot create \"/usr/share/grafana/snap/chromium/1565\": mkdir /usr/share/grafana/snap: permission denied\ncannot create user data directory: /usr/share/grafana/snap/chromium/1565: Permission denied\n\n\nTROUBLESHOOTING: https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md\n"

t=2021-04-26T05:03:16+0000 lvl=eror msg="Request Completed" logger=context userId=0 orgId=1 uname= method=GET path=/render/dashboard-solo/db/graph-styles status=500 remote_addr=192.168.1.228 time_ms=347 size=1723 referer=

Hello, I wonder if still someone is using the compiled plugin. I used it for about one year, but since update to Grafana 8.3.x it stopped working. When I downgrade to 8.2.1 it still works. Anyone else with this problem? The Log shows:

t=2021-12-12T15:35:23+0100 lvl=info msg="Initialising plugins" logger=plugin.manager
t=2021-12-12T15:35:24+0100 lvl=info msg="Plugin registered" logger=plugin.manager pluginId=input
t=2021-12-12T15:35:24+0100 lvl=warn msg="Permitting unsigned plugin. This is not recommended" logger=plugin.signature.validator pluginID=grafana-image-renderer pluginDir=/var/lib/grafana/plugins/grafana-image-renderer
t=2021-12-12T15:35:24+0100 lvl=info msg="Plugin registered" logger=plugin.manager pluginId=grafana-image-renderer
t=2021-12-12T15:35:24+0100 lvl=info msg="Live Push Gateway initialization" logger=live.push_http
t=2021-12-12T15:35:24+0100 lvl=info msg="Writing PID file" logger=server path=/run/grafana/grafana-server.pid pid=25452
t=2021-12-12T15:35:24+0100 lvl=eror msg="Stopped background service *rendering.RenderingService" logger=server reason="could not start plugin grafana-image-renderer as no plugin client exists"
t=2021-12-12T15:35:24+0100 lvl=eror msg="failed to lock and execute cleanup of expired auth token" logger=auth error="context canceled"
t=2021-12-12T15:35:24+0100 lvl=info msg="HTTP Server Listen" logger=http.server address=[::]:3000 protocol=http subUrl= socket=
t=2021-12-12T15:35:24+0100 lvl=eror msg="Server shutdown" logger=server error="*rendering.RenderingService run error: could not start plugin grafana-image-renderer as no plugin client exists"

Downgrading to 8.2.1 makes it running fine again.

I tried several steps with this rendering plugin now and also successfully installed it. However, it does not load now, message

Skipping loading plugin due to problem with signature" logger=plugin.loader pluginID=grafana-image-renderer status=unsigned

Never change a running system - before it was working :frowning:
Anybody any hints?

Thanks!