Skip to content

Local System Alerts

Brian Wente edited this page Aug 11, 2026 · 3 revisions

Local System Alerts

Local device alerts are system-health messages generated by scripts or services running directly on the MagicMirror device. MessageCenter does not perform the monitoring itself. It receives the result and presents it through the same calm inbox, lifecycle, and attention model used by every other provider.

For example, an attention-level alert appears as an unread card with an amber urgency edge:

NETWORK UNAVAILABLE
Connectivity has been unavailable for five minutes.

System Monitor                         2:14 PM

The Unix-domain socket accepts trusted newline-delimited JSON from those local monitoring processes without opening a network port.

transports: {
  unixSocket: {
    enabled: true,
    path: "/tmp/mmm-messagecenter.sock",
    mode: 0o600
  }
}

Example with socat:

printf '%s\n' '{"id":"system-network","type":"system.network","source":"system-monitor","title":"Network unavailable","body":"Connectivity has been unavailable for five minutes.","urgency":"attention","retention":"untilAcknowledged"}' \
  | socat - UNIX-CONNECT:/tmp/mmm-messagecenter.sock

Storage warning

printf '%s\n' '{"id":"system-storage","type":"system.storage","source":"system-monitor","title":"Storage running low","body":"The mirror has less than 10% free storage.","urgency":"attention","retention":"untilAcknowledged"}' \
  | socat - UNIX-CONNECT:/tmp/mmm-messagecenter.sock

Use a stable source and id for an ongoing condition. Repeated checks can then update the same event instead of filling the inbox with duplicate warnings.

Useful conditions to monitor

  • Storage below a configured threshold
  • Network connectivity unavailable
  • MagicMirror repeatedly restarting or failing
  • High CPU temperature
  • MQTT broker disconnected
  • Home Assistant or a local camera unreachable
  • Backup failure
  • Read-only filesystem or storage errors
  • Operating-system updates available

Copy-and-paste storage monitor

The repository includes a small, versioned examples/system-monitor.sh script. It checks free storage, sends a warning only when the configured threshold is crossed, and clears the active warning when storage recovers.

After enabling the Unix socket in MessageCenter, run these commands on the mirror:

sudo apt update
sudo apt install socat
cd ~/MagicMirror/modules/MMM-MessageCenter
./examples/system-monitor.sh

The default warning threshold is 10% free storage. To test with a different threshold for one run:

MESSAGECENTER_MIN_FREE_PERCENT=25 ./examples/system-monitor.sh

To check automatically every five minutes, open the current user's crontab:

crontab -e

Add this line, adjusting the MagicMirror path if necessary:

*/5 * * * * /home/pi/MagicMirror/modules/MMM-MessageCenter/examples/system-monitor.sh

Run the script as the same user that runs MagicMirror so it can access the default 0o600 socket. The script stores only its current ok or warning state in /tmp, which prevents it from repeating the same alert every five minutes.

Keep the actual disk, network, temperature, and service checks in separate scripts or services. MessageCenter supplies transport, normalization, presentation, and attention semantics while remaining hardware-independent.

Clone this wiki locally