tutorial

Monitoring Baetyl Edge Computing with Vigilmon

Baetyl extends cloud computing to edge nodes — but edge environments are notoriously hard to observe. Here's how to monitor Baetyl Core health, cloud connectivity, edge module status, and local MQTT broker availability with Vigilmon.

Baetyl is an open source cloud-native edge computing platform originally developed by Baidu and donated to the Linux Foundation Edge (LF Edge). It extends cloud capabilities — AI inference, function execution, message routing — to edge hardware, letting containerized applications run on edge nodes even without persistent cloud connectivity. That offline-first design is powerful, but it makes observability harder: your edge node may be silent when something goes wrong. Vigilmon bridges that gap, giving you uptime checks, heartbeat monitors, and alerts for every critical layer of your Baetyl deployment.

What You'll Set Up

  • Baetyl Core process health check via local HTTP status endpoint
  • Cloud connectivity monitor with drift alerting
  • Edge module container health via metrics scrape
  • MQTT broker port reachability monitor
  • Function module error rate alerting
  • Edge node resource saturation alerts
  • Heartbeat monitors for telemetry reporting

Prerequisites

  • A running Baetyl edge node (Baetyl Core v2.x+)
  • Baetyl Cloud management plane accessible from the edge node
  • Network access from Vigilmon probes to the edge node (or a local exporter pushing heartbeats)
  • A free Vigilmon account

Step 1: Monitor Baetyl Core Process Health

Baetyl Core is the edge agent that manages all module lifecycles. If Core crashes, every containerized workload on the edge node stops being managed. Expose a lightweight health endpoint from Core's local API (Baetyl Core exposes a local gRPC/REST management API — you can proxy it or add a thin HTTP wrapper):

  1. Log in to vigilmon.online and click Add Monitor.
  2. Set Type to HTTP / HTTPS.
  3. Enter the Core status URL: http://edge-node-ip:50050/health (adjust port to match your Baetyl Core config).
  4. Set Check interval to 1 minute.
  5. Set Expected HTTP status to 200.
  6. Click Save.

If your edge node is behind NAT or a firewall, use a Vigilmon Heartbeat monitor instead and push a signal from a cron job on the edge node:

# /etc/cron.d/baetyl-core-heartbeat
* * * * * root systemctl is-active --quiet baetyl && curl -fsS https://vigilmon.online/heartbeat/YOUR_HEARTBEAT_ID

This sends a heartbeat only when the Baetyl systemd service is active. If the service crashes and the cron job stops sending, Vigilmon alerts you within the heartbeat timeout.


Step 2: Monitor Cloud Connectivity

Baetyl Core connects to Baetyl Cloud to receive configuration updates and report device state. A prolonged outage causes configuration drift — edge modules keep running on stale config. Add a monitor that checks the last successful cloud sync timestamp:

  1. Add a Vigilmon Heartbeat monitor named Baetyl Cloud Sync.
  2. Set the Heartbeat timeout to 30 minutes.
  3. On the edge node, create a script that fires the heartbeat after a successful sync:
#!/bin/bash
# /usr/local/bin/check-baetyl-cloud-sync.sh
LAST_SYNC=$(baetyl-cli node status 2>/dev/null | grep "lastCloudSync" | awk '{print $2}')
NOW=$(date +%s)
LAST_SYNC_TS=$(date -d "$LAST_SYNC" +%s 2>/dev/null || echo 0)
AGE=$(( NOW - LAST_SYNC_TS ))

# Fire heartbeat if synced within the last 25 minutes
if [ "$AGE" -lt 1500 ]; then
  curl -fsS https://vigilmon.online/heartbeat/YOUR_CLOUD_SYNC_HEARTBEAT_ID
fi

Run this script every 10 minutes via cron. If cloud connectivity is lost for more than 30 minutes, Vigilmon triggers an alert before configuration drift becomes a problem.


Step 3: Monitor Edge Module Container Health

Baetyl Core manages containerized modules (MQTT broker, function executor, custom apps). Each module runs as a Docker container. Expose module health by querying the Docker socket on the edge node and pushing a heartbeat per module:

#!/bin/bash
# /usr/local/bin/check-baetyl-modules.sh
HEARTBEAT_BASE="https://vigilmon.online/heartbeat"

MODULES=("baetyl-broker" "baetyl-function" "baetyl-custom-app")

for MODULE in "${MODULES[@]}"; do
  STATUS=$(docker inspect --format='{{.State.Status}}' "$MODULE" 2>/dev/null)
  RESTART_COUNT=$(docker inspect --format='{{.RestartCount}}' "$MODULE" 2>/dev/null || echo "unknown")

  if [ "$STATUS" = "running" ]; then
    curl -fsS "${HEARTBEAT_BASE}/HEARTBEAT_ID_${MODULE}"
  else
    echo "Module $MODULE is $STATUS (restarts: $RESTART_COUNT)" >&2
  fi
done

Create one Vigilmon Heartbeat monitor per critical module with a 5-minute timeout. A module entering CrashLoopBackOff will stop its heartbeat and trigger an alert.


Step 4: Monitor MQTT Broker Port Reachability

The Baetyl MQTT broker module provides local connectivity for IoT devices. A broker crash silently disconnects all local sensors and devices. Add a TCP port monitor:

  1. Click Add Monitor in Vigilmon.
  2. Set Type to TCP Port.
  3. Enter the edge node IP and MQTT port: host edge-node-ip, port 1883 (or 8883 for TLS).
  4. Set Check interval to 1 minute.
  5. Click Save.

For TLS-secured MQTT brokers, also add an SSL certificate expiry monitor:

  1. Click Add Monitor.
  2. Set Type to SSL Certificate.
  3. Enter edge-node-ip:8883.
  4. Set alert threshold to 14 days before expiry.
  5. Click Save.

Step 5: Monitor Function Module Execution Health

The Baetyl function module executes Python/Node.js/C++ functions locally in response to MQTT messages. A rising error rate indicates data format issues, model problems, or dependency failures. Instrument your function modules to emit a heartbeat on successful execution:

# In your Baetyl function (Python example)
import urllib.request
import os

VIGILMON_HEARTBEAT = os.environ.get("VIGILMON_HEARTBEAT_URL", "")

def handler(event, context):
    try:
        result = process(event)
        if VIGILMON_HEARTBEAT:
            urllib.request.urlopen(VIGILMON_HEARTBEAT, timeout=2)
        return result
    except Exception as e:
        # Do not fire heartbeat — Vigilmon will alert on missing signal
        raise

Set the heartbeat timeout to match your expected function invocation frequency plus a buffer. If the function error rate spikes and heartbeats stop arriving, Vigilmon alerts you.


Step 6: Monitor Edge Node Resource Usage

Edge hardware is resource-constrained. CPU or memory saturation causes module failures and scheduling stalls. Push a resource heartbeat from the edge node:

#!/bin/bash
# /usr/local/bin/check-baetyl-resources.sh
CPU_IDLE=$(top -bn1 | grep "Cpu(s)" | awk '{print $8}' | cut -d. -f1)
CPU_USED=$(( 100 - CPU_IDLE ))
MEM_USED_PCT=$(free | awk '/Mem:/ {printf "%d", $3/$2 * 100}')

# Alert threshold: CPU > 85% or memory > 90%
if [ "$CPU_USED" -lt 85 ] && [ "$MEM_USED_PCT" -lt 90 ]; then
  curl -fsS https://vigilmon.online/heartbeat/YOUR_RESOURCE_HEARTBEAT_ID
fi

Run every 2 minutes via cron. Create a Vigilmon Heartbeat monitor with a 5-minute timeout.


Step 7: Monitor Configuration Sync and Telemetry Reporting

Baetyl applies configuration updates pushed from Baetyl Cloud and uploads telemetry (edge node state, module metrics) back to the cloud. Add heartbeats for both:

#!/bin/bash
# /usr/local/bin/check-baetyl-telemetry.sh

# Check telemetry upload success (Baetyl logs show "telemetry uploaded" on success)
LAST_UPLOAD=$(journalctl -u baetyl --since "5 minutes ago" 2>/dev/null | grep -c "telemetry uploaded")

if [ "$LAST_UPLOAD" -gt 0 ]; then
  curl -fsS https://vigilmon.online/heartbeat/YOUR_TELEMETRY_HEARTBEAT_ID
fi

Alerting Configuration

With monitors in place, configure targeted alerts:

| Alert | Condition | Recommended Channel | |-------|-----------|---------------------| | Core crash | Heartbeat missing > 2 min | PagerDuty / SMS | | Cloud connectivity loss | Heartbeat missing > 30 min | Email + Slack | | Module CrashLoopBackOff | Module heartbeat missing > 5 min | Slack | | MQTT broker down | TCP port check fails | PagerDuty | | Function error spike | Function heartbeat stops | Slack | | Resource saturation | Resource heartbeat stops | Email | | Telemetry failure | Telemetry heartbeat missing > 10 min | Slack |

In Vigilmon, go to Alerts → Notification Channels and add your Slack webhook, email, or PagerDuty integration key. Then assign each monitor to the appropriate channel.


Conclusion

Baetyl's edge-first architecture means monitoring must work even when cloud connectivity is intermittent. The combination of Vigilmon TCP port checks, heartbeat monitors driven by on-node cron scripts, and per-module container health checks gives you complete visibility into your edge nodes without requiring continuous cloud access. When Baetyl Core goes silent or a module enters a crash loop, Vigilmon alerts you before the edge node becomes a blind spot in your infrastructure.

Start with a free Vigilmon account and add your first Baetyl edge monitor in under two minutes.

Monitor your app with Vigilmon

Free plan — 5 monitors, no credit card required. Up and running in 60 seconds.

Start free →