tutorial

Monitoring Lima Linux VMs on macOS with Vigilmon

Lima runs Linux VMs on macOS for local development — but services inside those VMs are invisible to your team's uptime tooling. Here's how to monitor Lima-hosted apps with Vigilmon.

Lima (Linux virtual machines, pronounced lee-mah) lets macOS developers run full Linux VMs with automatic port forwarding, file sharing, and containerd support — no Docker Desktop license required. It's popular for running Linux-specific tools, local Kubernetes clusters, and containerized development environments. Services running inside Lima VMs are locally accessible but typically invisible to external monitoring. Vigilmon bridges that gap: wire your Lima-hosted services to cloud-based uptime monitoring so you know immediately when a shared development VM or staging service goes down.

What You'll Set Up

  • HTTP uptime monitor for services running inside Lima VMs
  • Cron heartbeat for background workers and daemons in Lima VMs
  • SSL certificate monitoring for locally signed certificates in staging VMs
  • TCP port checks for database and cache services

Prerequisites

  • Lima 0.16+ installed on macOS (brew install lima)
  • At least one VM running (limactl start) with a service inside
  • A free Vigilmon account

Step 1: Expose Your Lima VM Service to Monitoring

Lima forwards ports from the guest VM to 127.0.0.1 on the host by default. For external monitoring you need one of:

  • A VPN or tunnel (Tailscale, ngrok) that exposes the VM's port publicly
  • Cloud deployment of the same service, with Lima as the local mirror
  • Vigilmon's agent running inside the VM and reporting to Vigilmon's cloud

For shared development VMs on a VPS running Lima, the service is already externally accessible. Add a monitor directly:

  1. Log in to vigilmon.online and click Add Monitor.
  2. Set Type to HTTP / HTTPS.
  3. Enter the service URL: http://your-vps-ip:8080 or https://dev.example.com.
  4. Set Check interval to 2 minutes.
  5. Set Expected HTTP status to 200.
  6. Click Save.

For a purely local Lima VM, use Tailscale or a similar mesh VPN to expose the VM's address to Vigilmon:

# Inside the Lima VM
limactl shell default
curl -fsSL https://tailscale.com/install.sh | sh
sudo tailscale up --authkey=YOUR_TAILSCALE_KEY

After joining Tailscale, the VM has a stable 100.x.x.x address that Vigilmon can reach.


Step 2: Add Health Endpoints to Lima-Hosted Services

Services inside Lima should expose a /health endpoint that returns machine-readable status. This lets Vigilmon (and developers) quickly confirm the service is running.

For a containerd/nerdctl service

# compose.yaml inside the Lima VM
services:
  api:
    image: my-api:latest
    ports:
      - "8080:8080"
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
      interval: 30s
      timeout: 5s
      retries: 3

For a native Linux service

# systemd service file: /etc/systemd/system/my-api.service
[Unit]
Description=My API Service
After=network.target

[Service]
ExecStart=/usr/local/bin/my-api
Restart=on-failure

[Install]
WantedBy=multi-user.target

Deploy the service in the VM:

limactl shell default -- sudo systemctl enable --now my-api

The /health endpoint now answers on port 8080 inside the VM, forwarded or exposed through Tailscale.


Step 3: Monitor Background Daemons with Heartbeats

Lima VMs often run background processes — build daemons, test runners, local CI pipelines. These have no HTTP endpoint to probe. Use Vigilmon's cron heartbeat instead.

  1. In Vigilmon, click Add MonitorCron Heartbeat.
  2. Set the expected interval: 30 minutes for a half-hourly job, 1440 minutes for a daily task.
  3. Copy the heartbeat URL.

Inside the Lima VM, add the ping to your daemon or cron job:

# /etc/cron.d/build-job inside the Lima VM
*/30 * * * * ubuntu /home/ubuntu/scripts/build.sh && curl -s https://vigilmon.online/heartbeat/abc123

Or in a systemd timer:

# /etc/systemd/system/build-job.service
[Unit]
Description=Build job with Vigilmon heartbeat

[Service]
Type=oneshot
ExecStart=/home/ubuntu/scripts/build.sh
ExecStartPost=curl -s https://vigilmon.online/heartbeat/abc123
User=ubuntu

If the VM suspends, crashes, or the cron daemon dies, the heartbeat stops and Vigilmon alerts.


Step 4: TCP Port Monitoring for Databases and Caches

Lima VMs are popular for running development databases (PostgreSQL, MySQL, Redis) without installing them natively on macOS. Monitor the forwarded ports so you know if the database inside the VM goes down.

Lima port forwarding configuration (~/.lima/default/lima.yaml):

portForwards:
  - guestPort: 5432
    hostPort: 5432
  - guestPort: 6379
    hostPort: 6379

After the VM starts, add TCP monitors in Vigilmon for the host ports — or, if the VM is on a VPS, for the VPS IP:

  1. In Vigilmon, click Add MonitorTCP.
  2. Enter the host: your-vps-ip and port: 5432.
  3. Set Check interval to 1 minute.
  4. Click Save.

Repeat for Redis on port 6379. A crashed PostgreSQL inside the VM shows up within one minute.


Step 5: SSL Certificate Alerts for Local HTTPS Setups

Development VMs often use self-signed certificates or mkcert-generated certificates for local HTTPS. These have short validity periods (typically 1–2 years) and no auto-renewal. Add SSL monitoring in Vigilmon to catch upcoming expirations:

  1. Open the HTTP monitor for your Lima-hosted service.
  2. Enable Monitor SSL certificate.
  3. Set Alert when certificate expires in less than 30 days.
  4. Click Save.

To regenerate a mkcert certificate inside the VM before it expires:

limactl shell default
mkcert -install
mkcert dev.example.com localhost 127.0.0.1
# Restart your service to pick up the new certificate
sudo systemctl restart my-api

Step 6: Configure Alerts and Maintenance Windows

Lima VMs are frequently stopped and restarted. Configure Vigilmon to tolerate brief downtime during VM restarts:

  1. Go to Alert Channels and add your preferred channel (Slack, email, webhook).
  2. Set Consecutive failures before alert to 3 on HTTP and TCP monitors — Lima VMs typically restart in 30–60 seconds.
  3. Use Maintenance windows when doing VM snapshots or upgrades:
# Pause monitoring before stopping the VM
curl -X POST https://vigilmon.online/api/maintenance \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{"monitor_id": "abc123", "duration_minutes": 10}'

limactl stop default
limactl start default

# Window expires automatically after 10 minutes

Summary

| Monitor | Target | What It Catches | |---|---|---| | HTTP health | Lima VM service endpoint | Service crash inside VM | | Cron heartbeat | Background daemon / cron job | VM suspended or daemon died | | TCP port | Forwarded DB/cache port | Database inside VM down | | SSL certificate | VM HTTPS endpoint | Self-signed cert expired |

Lima makes Linux development on macOS seamless — but the services inside VMs are a blind spot for standard monitoring tools. With Vigilmon watching your Lima-hosted endpoints, heartbeats, and TCP ports, you get the same visibility into VM-hosted services that you expect from any cloud deployment.

Monitor your app with Vigilmon

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

Start free →