Tutorial - Grafana rendering on Raspberry Pi

Hey…

Hmm a reboot is a try…
unfortunately there are no errors in your log. Are you get an error in your browser, when you try to render a graph?

Maybe this is a solution for you…
https://github.com/grafana/grafana/issues/19842#issuecomment-561268838

I‘am still running Version 1.0.0

Anyone was able to get this running on RPi?
I have tried everything and still getting ‘Failed to launch chrome’ error.

I tried but the newer source code of the module are different and I don’t know how to modify it

I simply gave up on Grafana :smiley: even which part of it works is not great, shitty piece of software…

I followed the above steps to install the image rendering plugin on a RPi4 (with custom installation of openhab and grafana). As others pointed out, you need to install chromium-browser via apt, since the version included in puppeteer does not work. After that just add this:

to plugin_start_linux_arm.

If you use SSL with a custom CA, then you also need to add this line:

GF_RENDERER_PLUGIN_IGNORE_HTTPS_ERRORS=true

I got Grafana rendering working on RPi 4 (4Gb) running openhabian using a mix of the steps above and some more. Rendering takes approximately 5 seconds, so the webview solution is faster. But here we go:

InfluxDB and Grafana should be fairly straightforward to install in openhabian using sudo openhabian-config.
However, nodejs needed to be version 12 for yarn run build, whereas the the default repositories will install v10 and the latest will install v13. To install nodejs v12 i followed the instruction titled “Major version upgrades” here but make sure to change 13 to 12 like so:

sudo su
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
apt install nodejs
node -v

Then I followed the OP:

I cannot tell which of the following steps were necessary, but I did them as a part of trial and error:

(There was no grpc-plugin.ts to edit - no need)
Apparently yarn install was important too:

yarn install --pure-lockfile
yarn run build
cp plugin_start_linux_amd64 plugin_start_linux_arm

Now after restarting grafana, grafana renderer would complain in the log /var/log/grafana/grafana.log about executable not found, so we install chromium (1Gb):

sudo apt-get install chromium-browser

And make the renderer plugin use the chromium executable as pointed out above:

Finally:

I have likely missed something, but this is roughly how I got it working. I’m not an expert - I just put the pieces together. Hope it helps.

8 Likes

Thank’s Dude!
Once solved node version everything was smooth and went ok on my Pi 4.

Hi all,
First of all a big thank you for @wezzix for completing the journey to a functioning setup on a RPi 4. I’ve tried to get this running last year and gave up. I used an Ubuntu VM since to do the rendering part.
I followed @wezzix guidenace and had it running on my RPi 4 in less then 30 minutes!!

Now as an addition to this post, if any of you (like I do) have enabled HTTPS with a real TLD Certificate on Grafana the rendering fails with “ERR_CERT_COMMON_NAME_INVALID”

This is easy to solve by modifying the plugin_start_linux_arm adding the following line:

export GF_RENDERER_PLUGIN_IGNORE_HTTPS_ERRORS=true

Hope this helps!

1 Like

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.