Setup

apt-get install -y adduser libfontconfig1
wget https://dl.grafana.com/oss/release/grafana_6.7.3_armhf.deb
dpkg -i grafana_6.7.3_armhf.deb
rm grafana_6.7.3_armhf.deb

Enable as service

systemctl enable grafana-server.service
service grafana-server start

Configuration

vim /etc/grafana/grafana.ini
/et/grafana/grafana.ini
[server]
root_url = someDomain

[security]
allow_embedding = true

[smtp]
enabled = true
host = smtp.host.de:25
user = user@host.de
password = password
from_address = printer@host.de
from_name = Grafana

[panels]
disable_sanitize_html = true

Upgrading

visit https://grafana.com/grafana/download?platform=arm

#make backup of Grafana SQLite Database
sudo cp /var/lib/grafana/grafana.db ~/grafana.db.bak

#visit https://grafana.com/grafana/download/5.2.0-beta1?platform=arm
LATEST_RELEASE=$(curl --silent "https://api.github.com/repos/grafana/grafana/releases/latest" | jq -r .tag_name | sed -e 's/v//')
echo $LATEST_RELEASE

wget https://dl.grafana.com/oss/release/grafana_"$LATEST_RELEASE"_armhf.deb
sudo dpkg -i grafana_"$LATEST_RELEASE"_armhf.deb
rm grafana_"$LATEST_RELEASE"_armhf.deb

sudo service grafana-server restart

Apache virtual host

See mkcert & Go for SSL cert generation

vim /etc/apache2/sites-enabled/grafana.conf


<VirtualHost *:3001>
ServerName localhost
ServerAdmin some_mail@domain.de
SSLEngine on
SSLCertificateFile /etc/ssl/certs/trikarus.pem
SSLCertificateKeyFile /etc/ssl/private/trikarus-key.pem
ProxyPass / http://localhost:3000/
ProxyPassReverse / http://localhost:3000/
ErrorLog ${APACHE_LOG_DIR}/error-grafana.log
CustomLog ${APACHE_LOG_DIR}/access-grafana.log combined
</VirtualHost>
vim /etc/apache2/ports.conf
Listen 3001

Grafana Image renderer plugin

This is not included in Raspbian arm version of Grafana because usually arm devices have not the minimum requirements of 16 GB of RAM as official documentation says. So without image rendering plugin we cannot send alert images by email sadly. It could be done by remote rendering using another machine to run the renderer as service. At the moment this is not used but possible → https://github.com/grafana/grafana-image-renderer/blob/master/docs/remote_rendering_using_docker.md

Compile

To compile as unsigned plugin is possible upon this but useless. This step documentation is based on https://community.openhab.org/t/tutorial-grafana-rendering-on-raspberry-pi/71777

grafana-cli plugins install grafana-image-renderer #this command fails

#clone git repository of the plugin
cd /var/lib/grafana/plugins
git clone https://github.com/grafana/grafana-image-renderer
cd grafana-image-renderer

#install yarn
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
apt update
apt install yarn

#install nodejs
wget https://nodejs.org/dist/latest-v12.x/node-v12.18.0-linux-armv7l.tar.gz
tar -xvf node-v12.18.0-linux-armv7l.tar.gz
sudo mv node-v12.18.0-linux-armv7l /opt/
sudo ln -s /opt/node-v12.18.0-linux-armv7l /opt/node
sudo chown -R root:root /opt/node*
sudo ln -s /opt/node/bin/node /usr/bin/node
sudo ln -s /opt/node/bin/npm /usr/bin/npm

#compile the plugin
yarn global add typescript
yarn install
yarn run build

#rename to match the archictecture
cp plugin_start_linux_amd64 plugin_start_linux_arm
vim /etc/grafana/grafana.ini
#restart Grafana and check if the plugin is available in the plugin list
systemctl restart grafana-server.service

Error:

t=2020-06-06T01:44:31+0200 lvl=eror msg="Render request failed" logger=plugins.backend pluginId=grafana-image-renderer error="Error: Failed to launch chrome!\n/var/lib/grafana/plugins/grafana-image-renderer/node_modules/puppeteer/.local-chromium/linux-706915/chrome-linux/chrome: 1: /var/lib/grafana/plugins/grafana-image-renderer/node_modules/puppeteer/.local-chromium/linux-706915/chrome-linux/chrome: Syntax error: \")\" unexpected\n\n\nTROUBLESHOOTING: https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md\n" url="http://localhost:3000/d-solo/xW5kn7zRz/collectd-influxdb-metrics?orgId=1&panelId=48&render=1"

Troubleshooting

Could not find datasource database is locked
Could not find datasource database is locked

(info) happens if Grafana cannot access the database

  • No labels
Write a comment…