Portainer Templates logo

Portainer Templates

Raspberry Pi Docker Monitor Raspberry Pi Docker Monitor

MonitorTools

Monitor your Raspberry Pi and Dockers using Grafana developed by oijkn. Please download grafana configs from his git https://github.com/oijkn/Docker-Raspberry-PI-Monitoring

Source details

Stars: 576
Forks: 94
License: MIT
Updated: 1 years ago

Configuration

Type
Compose
Platform
linux
Ports
3000:3000/tcp
Env vars
PROMETHEUS_RETENTION=15d
Restart
unless-stopped
Source

Template by novaspirit·Source

Notes

Template created by Pi-Hosted Series
Check our Github page: https://github.com/pi-hosted/pi-hosted

Official Webpage: https://github.com/pi-hosted/pi-hosted/blob/master/docs/rpi_docker_monitor.md
Official Docker Documentation: https://github.com/pi-hosted/pi-hosted/blob/master/docs/rpi_docker_monitor.md

Pi-Hosted dedicated documentation: rpi_docker_monitor.md



Pre-installation script must be RAN before you install: wget -qO- https://raw.githubusercontent.com/pi-hosted/pi-hosted/master/tools/rpi_docker_monitor.sh | bash



Youtube Video: Novaspirit Tech - Raspberry Pi Docker Monitoring

Services

cadvisor

Configuration

Image
zcube/cadvisor:latest
Command
--docker_only=true,--housekeeping_interval=30s,--disable_metrics=accelerator,cpu_topology,disk,memory_numa,tcp,udp,percpu,sched,process,hugetlb,referenced_memory,resctrl,cpuset,advtcp,memory_numa,--store_container_labels=false,--event_storage_event_limit=default=0,--event_storage_age_limit=default=0
Volumes
/rootfs : //var/run : /var/run/sys : /sys/var/lib/docker : /var/lib/docker//etc/machine-id : /etc/machine-id
Restart
unless-stopped

Image details

Pulls: 6.2M
User: zcube
Created: Oct 27, 2019
Updated: 3 years ago
Status: active

grafana

Configuration

Image
grafana/grafana:latest
Ports
3000:3000
Volumes
/var/lib/grafana : /portainer/Files/AppData/Config/grafana/data/etc/grafana/grafana.ini : /portainer/Files/AppData/Config/grafana/grafana.ini/etc/grafana/provisioning : /portainer/Files/AppData/Config/grafana/provisioning
Env vars
GF_USERS_ALLOW_SIGN_UP=falseGF_PATHS_CONFIG=/etc/grafana/grafana.iniGF_PATHS_DATA=/var/lib/grafanaGF_PATHS_HOME=/usr/share/grafanaGF_PATHS_LOGS=/var/log/grafanaGF_PATHS_PLUGINS=/var/lib/grafana/pluginsGF_PATHS_PROVISIONING=/etc/grafana/provisioning
Restart
unless-stopped

Image details

Pulls: 5.3B
User: grafana
Created: Feb 06, 2015
Updated: 12 hours ago
Status: active

node-exporter

Configuration

Image
prom/node-exporter:latest
Restart
unless-stopped

Image details

Pulls: 4.0B
User: prom
Created: Oct 21, 2014
Updated: 3 days ago
Status: active

prometheus

Configuration

Image
prom/prometheus:latest
Command
--config.file=/etc/prometheus/prometheus.yml,--storage.tsdb.path=/prometheus,--storage.tsdb.retention.time=${PROMETHEUS_RETENTION:-15d}
Volumes
/prometheus : /portainer/Files/AppData/Config/prometheus/data/etc/prometheus/ : /portainer/Files/AppData/Config/prometheus/config
Restart
unless-stopped

Image details

Pulls: 2.0B
User: prom
Created: Oct 21, 2014
Updated: 4 hours ago
Status: active

Standalone Install

Select an install method, to see config/commands for deploying Raspberry Pi Docker Monitor

Installation method

Install on Portainer

Import all app templates into your Portainer instance, for easy 1-click deploys

  1. Ensure both Docker and Portainer are installed, and up-to-date
  2. Log into your Portainer web UI
  3. Under Settings → App Templates, paste the below URL
  4. Head to Home → App Templates, and the list of apps will show up
  5. Select Raspberry Pi Docker Monitor, fill in any config options, and hit Deploy

Template Import URL

https://raw.githubusercontent.com/Lissy93/portainer-templates/main/templates.json
Show Me demo
Original stackfile

The compose file this template deploys, straight from its repo:

version: "2.4"
services:
  cadvisor:
    command:
    - '--docker_only=true'
    - '--housekeeping_interval=30s'
    - '--disable_metrics=accelerator,cpu_topology,disk,memory_numa,tcp,udp,percpu,sched,process,hugetlb,referenced_memory,resctrl,cpuset,advtcp,memory_numa'
    - '--store_container_labels=false'
    - '--event_storage_event_limit=default=0'
    - '--event_storage_age_limit=default=0'
    container_name: monitoring-cadvisor
    devices:
      - /dev/kmsg:/dev/kmsg
    expose:
      - 8080
    hostname: rpi-cadvisor
    image: zcube/cadvisor:latest
    ipc: shareable
    networks:
      - rpimonitor_default
    privileged: true
    restart: unless-stopped
    security_opt:
      - label=disable
    volumes:
      - /:/rootfs:ro
      - /var/run:/var/run:rw
      - /sys:/sys:ro
      - /var/lib/docker/:/var/lib/docker:ro
      - /etc/machine-id:/etc/machine-id:ro
      
  grafana:
    container_name: monitoring-grafana
    environment:
      - GF_USERS_ALLOW_SIGN_UP=false
      - GF_PATHS_CONFIG=/etc/grafana/grafana.ini
      - GF_PATHS_DATA=/var/lib/grafana
      - GF_PATHS_HOME=/usr/share/grafana
      - GF_PATHS_LOGS=/var/log/grafana
      - GF_PATHS_PLUGINS=/var/lib/grafana/plugins
      - GF_PATHS_PROVISIONING=/etc/grafana/provisioning
    hostname: rpi-grafana
    image: grafana/grafana:latest
    networks:
      - rpimonitor_default
    ports:
      - 3000:3000
    restart: unless-stopped
    volumes:
      # to be modified depending on your needs
      - /portainer/Files/AppData/Config/grafana/data:/var/lib/grafana
      - /portainer/Files/AppData/Config/grafana/grafana.ini:/etc/grafana/grafana.ini
      - /portainer/Files/AppData/Config/grafana/provisioning:/etc/grafana/provisioning

  node-exporter:
    container_name: monitoring-node-exporter
    expose:
      - 9100
    hostname: rpi-exporter
    image: prom/node-exporter:latest
    networks:
      - rpimonitor_default
    restart: unless-stopped

  prometheus:
    command:
      - '--config.file=/etc/prometheus/prometheus.yml'
      - '--storage.tsdb.path=/prometheus'
      - '--storage.tsdb.retention.time=${PROMETHEUS_RETENTION:-15d}'
    container_name: monitoring-prometheus
    expose:
      - 9090
    hostname: rpi-prom
    image: prom/prometheus:latest
    user: root
    networks:
      - rpimonitor_default
    restart: unless-stopped
    volumes:
      # to be modified depending on your needs
      - /portainer/Files/AppData/Config/prometheus/data:/prometheus
      - /portainer/Files/AppData/Config/prometheus/config:/etc/prometheus/
    links:
      - cadvisor:cadvisor
      - node-exporter:node-exporter

networks:
  rpimonitor_default:

Or deploy it directly from the source:

git clone https://github.com/pi-hosted/pi-hosted
cd pi-hosted
docker compose -f stack/raspberrypi-monitoring.yml up -d

More install options in our documentation, or see oijkn/Docker-Raspberry-PI-Monitoring for app-specific guidance.

Container Documentation

cadvisor Documentation

cAdvisor image for multiarch(386, amd64, arm/v6, arm/v7, arm64, ppc64le, s390x)

grafana Documentation

The official Grafana docker container

node-exporter Documentation

prom/node-exporter

prometheus Documentation

prom/prometheus

Serve Raspberry Pi Docker Monitor on your own domain behind Caddy, Nginx or Traefik. Fill in your domain and copy the result. It's a starting point, some apps need their own base URL or extra headers set too.

Proxying raspberry-pi-docker-monitor.example.com to http://grafana:3000

Add this to your Caddyfile

raspberry-pi-docker-monitor.example.com {
	reverse_proxy http://grafana:3000
}

Check the logs first

Nine times out of ten the logs tell you exactly what went wrong.

  • In Portainer, go to Containers, click the container, then Logs. Or run docker logs <container>
  • Exit codes help too: 137 means killed, usually out of memory. 126 or 127 means the command inside the image is broken.

Port already in use

If deployment fails with "Bind for 0.0.0.0:3000 failed: port is already allocated", something else on your server is using that port.

  • Find what's using it: sudo ss -tlnp | grep :3000
  • Stop the other service, or pick a different host port. In 3000:3000 only the left number is yours to change, the right one belongs to the app.

Running but the page won't load

The container is up but nothing appears in your browser.

  • Use your server's real IP: http://your-server-ip:3000. The 0.0.0.0 link Portainer shows isn't a real address.
  • Give it a minute after first deploy, raspberrypi-docker-monitor can take a while to initialise.
  • Make sure your firewall allows the port, e.g. sudo ufw allow 3000

Permission denied on volumes

If the logs show "permission denied", the app can't write to its data folder on the host.

  • Fix the ownership: sudo chown -R 1000:1000 / (and the same for the other mapped folders)

Image won't pull

Test the pull directly on the host: docker pull zcube/cadvisor:latest

  • "manifest unknown" means the tag no longer exists. This template uses latest, so try pinning a specific version instead.
  • "toomanyrequests" is the Docker Hub rate limit. Log in with docker login to raise it.
  • "no space left on device" means a full disk. Reclaim space with docker system prune

"exec format error"

This means the image was built for a different CPU architecture than your server.

  • Check yours with uname -m: x86_64 is amd64, aarch64 is arm64. Raspberry Pi and other ARM boards are the usual culprits.

Container keeps restarting

The unless-stopped restart policy relaunches the app after every crash, so the real error can scroll past.

  • Check the logs right after a restart, the last few lines before it died are the useful ones.
  • Get the exit code with docker inspect <container> --format '{{.State.ExitCode}}'
  • Still stuck? Redeploy once with the restart policy set to no so the failure stays visible.

Stack won't deploy

Compose stacks fail fast on small mistakes, and Portainer shows the reason just above the editor.

  • YAML only accepts spaces for indentation, a single tab breaks the whole file.

Raise an issue

Found something which isn't working as it should? Here's how to report it.