Integrations

cron & shell scripts

The simplest possible integration: a shell script that collects data and pushes it to EasyBoard with curl. Works on Linux, macOS, Raspberry Pi, or any cloud VM — no runtime, no package manager.

The one-liner

The full integration is a single command. You can run this directly in a terminal to test:

bash
# Push a value to a tile (replace IDs and token with yours)
curl -s -X PATCH https://easyboard.live/api/d/YOUR_DASHBOARD_ID/tiles \
  -H "Authorization: Bearer YOUR_WRITE_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"updates":[{"target":{"alternateId":"cpu"},"patch":{"value":"42"}}]}'

Store credentials safely

Never hardcode your write token in a script that might end up in version control. Keep credentials in a .env file next to your script and add it to .gitignore:

.env
# .env  — add this file to .gitignore
EASYBOARD_DASHBOARD_ID=abc123xyz456
EASYBOARD_WRITE_TOKEN=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

Full script: server metrics

This script collects CPU, memory, disk, and uptime and pushes all four in a single batched API call — one call, one rate-limit unit:

push-metrics.sh
#!/usr/bin/env bash
# push-metrics.sh — update EasyBoard tiles with system stats

set -euo pipefail

# Load credentials from .env in the same directory
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "${SCRIPT_DIR}/.env"

BASE_URL="https://easyboard.live/api/d/${EASYBOARD_DASHBOARD_ID}/tiles"

# Collect metrics
CPU=$(top -bn1 | grep "Cpu(s)" | awk '{print int($2)}')
MEM=$(free | awk '/Mem:/ {printf "%.0f", $3/$2 * 100}')
DISK=$(df / | awk 'NR==2 {print int($5)}')
UPTIME=$(uptime -p | sed 's/up //')

# Push all four tiles in one API call
curl -s -X PATCH "${BASE_URL}" \
  -H "Authorization: Bearer ${EASYBOARD_WRITE_TOKEN}" \
  -H "Content-Type: application/json" \
  -d "{
    \"updates\": [
      { \"target\": {\"alternateId\":\"cpu\"},    \"patch\": {\"value\":\"${CPU}\"} },
      { \"target\": {\"alternateId\":\"memory\"},  \"patch\": {\"value\":\"${MEM}\"} },
      { \"target\": {\"alternateId\":\"disk\"},    \"patch\": {\"value\":\"${DISK}\"} },
      { \"target\": {\"alternateId\":\"uptime\"},  \"patch\": {\"value\":\"${UPTIME}\"} }
    ]
  }"

Make it executable

Run chmod +x push-metrics.sh once so cron can execute it directly without prefixing bash.

Schedule with cron

bash
# Run every 5 minutes — add with: crontab -e
*/5 * * * * /home/user/scripts/push-metrics.sh >> /home/user/scripts/push-metrics.log 2>&1

# Or every minute:
* * * * * /home/user/scripts/push-metrics.sh

# Or once a day at 8am:
0 8 * * * /home/user/scripts/push-metrics.sh

cron has a minimal PATH

cron runs with a stripped-down environment — commands like curl need their full path (/usr/bin/curl) or you need to set PATH at the top of your crontab. Use which curl to find the right path on your system.

Database row counts

Query a PostgreSQL database and push counts to metric tiles — useful for a live production health board:

push-db-stats.sh
#!/usr/bin/env bash
# push-db-stats.sh — push row counts from PostgreSQL to EasyBoard

set -euo pipefail
source "$(dirname "${BASH_SOURCE[0]}")/.env"

# Query your database (requires psql + PGPASSWORD env var or .pgpass)
USERS=$(psql "${DATABASE_URL}" -t -c "SELECT COUNT(*) FROM users;" | xargs)
ORDERS=$(psql "${DATABASE_URL}" -t -c "SELECT COUNT(*) FROM orders WHERE created_at > NOW() - INTERVAL '24 hours';" | xargs)

curl -s -X PATCH "https://easyboard.live/api/d/${EASYBOARD_DASHBOARD_ID}/tiles" \
  -H "Authorization: Bearer ${EASYBOARD_WRITE_TOKEN}" \
  -H "Content-Type: application/json" \
  -d "{
    \"updates\": [
      { \"target\": {\"alternateId\":\"total-users\"},  \"patch\": {\"value\":\"${USERS}\"} },
      { \"target\": {\"alternateId\":\"orders-today\"},  \"patch\": {\"value\":\"${ORDERS}\"} }
    ]
  }"

Prefer systemd? Use a timer instead

Systemd timers are more reliable than cron on modern Linux — they survive missed runs, log to journald, and restart cleanly after reboots:

ini
# /etc/systemd/system/easyboard-metrics.service
[Unit]
Description=Push metrics to EasyBoard

[Service]
Type=oneshot
User=youruser
EnvironmentFile=/home/youruser/scripts/.env
ExecStart=/home/youruser/scripts/push-metrics.sh

---

# /etc/systemd/system/easyboard-metrics.timer
[Unit]
Description=Run EasyBoard metrics push every 5 minutes

[Timer]
OnBootSec=1min
OnUnitActiveSec=5min
Persistent=true

[Install]
WantedBy=timers.target

# Enable with:
# sudo systemctl daemon-reload
# sudo systemctl enable --now easyboard-metrics.timer

Common use cases

Server health

CPU %, memory %, disk %, uptime — updated every minute

Database metrics

Row counts, active connections, slow query count from PostgreSQL/MySQL

Log file stats

Error count from /var/log — grep | wc -l piped into curl

External API relay

Fetch a JSON value from another API and forward it to a tile

Backup status

Text tile with last backup timestamp, updated by your backup script

Daily reports

Push yesterday's totals each morning from a database query