Created
December 13, 2020 15:03
-
-
Save xoseperez/9bf74cc6c2dea151671f1f9f2e285c12 to your computer and use it in GitHub Desktop.
Minimal Raspberry Pi Grafana Dashboard
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Minimal Grafana Dashboard using a Raspberry Pi | |
# References: | |
# https://reelyactive.github.io/diy/pi-kiosk/ | |
# https://blog.r0b.io/post/minimal-rpi-kiosk/ | |
# https://grafana.com/blog/2019/05/02/grafana-tutorial-how-to-create-kiosks-to-display-dashboards-on-a-tv/ | |
# ----------------------------------------------------- | |
# Configuration (change to match your needs) | |
export WIFI_SSID=ssid | |
export WIFI_PASS=password | |
export WIFI_COUNTRY=ES | |
export GRAFANA_KIOSK_VERSION=v1.0.2 | |
export GRAFANA_USER=pi | |
export GRAFANA_PASS=pass | |
export GRAFANA_SERVER=grafana.example.com | |
export GRAFANA_PLAYLIST=1 | |
# ----------------------------------------------------- | |
# Download and burn Raspberry Pi OS Lite version | |
# Unplug ans plug the SD card again into you laptop SD reader | |
# From a terminal in your laptop, copy-past the configuration lines and then: | |
sudo touch /media/$USER/boot/ssh | |
sudo cat > /media/$USER/rootfs/etc/wpa_supplicant/wpa_supplicant.conf << EOF | |
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev | |
update_config=1 | |
country=$WIFI_COUNTRY | |
network={ | |
ssid="$WIFI_SSID" | |
psk="$WIFI_PASS" | |
key_mgmt=WPA-PSK | |
} | |
EOF | |
# ----------------------------------------------------- | |
# Unmount, plug into you RPi, boot the RPi and SSH into it | |
# Copy-past the configuration lines and then: | |
# Upgrade system | |
sudo apt update | |
sudo apt upgrade | |
# Enable SSH always | |
sudo systemctl sshd enable | |
sudo systemctl sshd start | |
# Install required packages | |
sudo apt install --no-install-recommends xserver-xorg-video-all \ | |
xserver-xorg-input-all xserver-xorg-core xinit x11-xserver-utils \ | |
chromium-browser unclutter | |
# Boot Options > Console Autologin > YES | |
sudo raspi-config | |
# If using an original Raspberry Pi Screen | |
echo "lcd_rotate=2" | sudo tee -a /boot/config.txt | |
# Download Grafana Kiosk App | |
wget https://github.com/grafana/grafana-kiosk/releases/download/$GRAFANA_KIOSK_VERSION/grafana-kiosk.linux.armv7 | |
chmod +x grafana-kiosk.linux.armv7 | |
# Create configuration file | |
cat > /home/$USER/grafana-kiosk.yml << EOF | |
general: | |
kiosk-mode: full | |
autofit: true | |
lxde: true | |
lxde-home: /home/$USER | |
target: | |
login-method: local | |
username: $GRAFANA_USER | |
password: $GRAFANA_PASS | |
playlist: true | |
URL: https://$GRAFANA_SERVER/playlists/play/$GRAFANA_PLAYLIST | |
ignore-certificate-errors: false | |
EOF | |
# Force to start the X if it's not an terminal or SSH session | |
cat > /home/$USER/.bash_profile << EOF | |
if [ -z \$DISPLAY ] && [ \$(tty) = /dev/tty1 ] | |
then | |
startx | |
fi | |
EOF | |
# Start Grafana Kiosk on X start | |
cat > /home/$USER/.xinitrc << EOF | |
#!/usr/bin/env sh | |
xset -dpms | |
xset s off | |
xset s noblank | |
unclutter & | |
/home/$USER/grafana-kiosk.linux.armv7 -c /home/$USER/grafana-kiosk.yml | |
EOF | |
# Reboot and enjoy |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Siguiendo instrucciones, con GRAFANA_KIOSK_VERSION=v1.0.4 nos muestra media pantalla: