tutorial

How to Monitor mirrord-Enabled Services with Vigilmon

mirrord is an open-source developer tool that lets you run a local process in the context of a remote Kubernetes pod — mirroring its network traffic, environ...

mirrord is an open-source developer tool that lets you run a local process in the context of a remote Kubernetes pod — mirroring its network traffic, environment variables, and file system. It eliminates the inner dev loop of building Docker images, pushing to a registry, and deploying to a cluster just to test a code change.

While mirrord itself is a development-time CLI tool rather than a long-running service, the applications it helps you develop need uptime monitoring. This tutorial covers how to use Vigilmon to monitor the Kubernetes services you work on with mirrord — both during development and in production — so you always know the state of your remote environment.


Why mirrord workflows benefit from uptime monitoring

When you use mirrord to mirror a remote Kubernetes service to your local machine, you're working against live infrastructure. Several failure modes can silently block your work:

  • Target pod goes down — mirrord connects to a specific pod; if that pod is evicted or crashes, your local process loses its mirror without an obvious error
  • Remote service degrades — if the service you're developing against starts returning errors, it's hard to distinguish remote-side issues from bugs in your local code change
  • Network policies block mirroring — a newly applied NetworkPolicy can silently prevent mirrord's agent from forwarding traffic to your local machine
  • Staging environment drift — the remote staging service may go down while you're developing locally, giving you misleading test results
  • Integration dependencies fail — the services your code calls inside the cluster may be down, masking your changes as failures

Adding uptime monitors for your development targets and staging services with Vigilmon gives you real-time confirmation that the environment you're mirroring into is healthy before and during your work session.


What you'll need

  • A Kubernetes cluster with services you develop against using mirrord
  • Services exposed via Ingress, LoadBalancer, or NodePort (or accessible via kubectl port-forward)
  • A free Vigilmon account

Step 1: Identify the services you work with

mirrord connects to a target pod within your cluster. Start by identifying the services you typically mirror:

# List services in your development namespace
kubectl get svc -n staging

# Example output:
# NAME              TYPE           CLUSTER-IP      EXTERNAL-IP       PORT(S)    AGE
# frontend          LoadBalancer   10.96.100.10    203.0.113.10      80/TCP     3d
# api-gateway       LoadBalancer   10.96.100.20    203.0.113.11      8080/TCP   3d
# user-service      ClusterIP      10.96.100.30    <none>            3000/TCP   3d
# payment-service   ClusterIP      10.96.100.40    <none>            4000/TCP   3d

Services with external IPs (LoadBalancer or NodePort) can be monitored directly by Vigilmon. ClusterIP services that your code calls inside the cluster need a health check approach — either via their dependency chain (if api-gateway calls user-service, monitoring the gateway health indirectly validates the dependency) or by temporarily exposing them.


Step 2: Add a health endpoint to your service (if missing)

When you're developing a service with mirrord, add a /health endpoint locally and verify it works before monitoring:

// Express.js example
app.get('/health', (req, res) => {
  res.json({ status: 'ok', version: process.env.APP_VERSION });
});
# FastAPI example
@app.get("/health")
async def health():
    return {"status": "ok"}

Deploy your service (or let mirrord forward the traffic to your local version):

# Start mirrord, mirroring the staging api-service pod to your local process
mirrord exec --target pod/api-service-7d4f8b9c6-xxxxx -- node server.js

# In another terminal, verify the health endpoint
curl http://staging-api.example.com/health
# {"status":"ok","version":"1.2.3"}

Step 3: Set up HTTP monitoring in Vigilmon

  1. Log in to vigilmon.online and go to Monitors → New Monitor
  2. Choose HTTP / HTTPS as the type
  3. URL: http://staging-api.example.com/health (your staging service's health endpoint)
  4. Set the check interval to 1 minute
  5. Under Expected response:
    • Status code: 200
    • (Optional) Response body contains: "status":"ok"
  6. Save the monitor

Add a monitor for each service in your development stack. This gives you a dashboard showing which services are healthy before you start a mirrord session.

The pre-session health check

Before running mirrord exec, check Vigilmon:

  • All monitors green → safe to start mirroring; failures in your local code are yours to fix
  • A monitor red → the remote environment is broken; don't waste time debugging your local code

This simple workflow saves hours of debugging "is this my code or the environment?"


Step 4: Monitor mirrord's dependency services

mirrord's power comes from running your local code in the exact context of the remote pod — including its ability to call other services inside the cluster. Monitor those dependencies:

# Expose internal services for monitoring via NodePort
kubectl expose svc user-service -n staging --type=NodePort --name=user-service-monitor --port=3000

kubectl get svc user-service-monitor -n staging
# NAME                  TYPE       CLUSTER-IP     EXTERNAL-IP   PORT(S)          AGE
# user-service-monitor  NodePort   10.96.100.50   <none>        3000:31300/TCP   10s

Add a TCP monitor for this NodePort in Vigilmon:

  1. Go to Monitors → New Monitor
  2. Choose TCP Port
  3. Host: your cluster node IP
  4. Port: 31300
  5. Save

Now you'll know if user-service is down before you start a mirrord session that depends on it.


Step 5: Monitor staging vs. production

A common mirrord workflow mirrors staging to your local machine while production runs normally. Monitor both environments separately in Vigilmon to catch divergence:

| Environment | URL | Purpose | |-------------|-----|---------| | Production | https://api.yourdomain.com/health | Real user traffic; high-severity alerts | | Staging | https://staging-api.yourdomain.com/health | Dev target; medium-severity alerts |

Set different alert channels for each:

  • Production → PagerDuty/Opsgenie (immediate page)
  • Staging → Slack (channel notification, not a page)

When staging goes down, Vigilmon notifies your Slack #dev channel so developers know their mirrord targets are unavailable.


Step 6: Configure alert channels

Email alerts

  1. Go to Alert Channels → Add Channel → Email
  2. Add your development team's email for staging alerts
  3. Add your on-call address for production alerts
  4. Assign each channel to the appropriate monitors

Webhook to Slack

  1. Go to Alert Channels → Add Channel → Webhook
  2. Add your Slack webhook URL for the #dev-alerts channel
  3. Assign to your staging monitors

Example payload:

{
  "monitor_name": "Staging API /health",
  "status": "down",
  "url": "https://staging-api.example.com/health",
  "started_at": "2024-01-15T14:00:00Z",
  "duration_seconds": 300
}

When this fires, developers know to check the staging environment before assuming their mirrord session is working correctly.


Step 7: Set up a development environment status page

  1. Go to Status Pages → New Status Page
  2. Name it: "Development Environment Health"
  3. Add your staging service monitors
  4. Publish

Share the URL in your team's #engineering Slack channel. Before starting a mirrord session, developers can check this page to see if the environment is ready.


Monitor summary

| Monitor | Type | What it catches | |---------|------|-----------------| | https://staging-api.example.com/health | HTTP | Staging API availability for mirrord targeting | | https://api.yourdomain.com/health | HTTP | Production health (baseline comparison) | | node-ip:31300 | TCP | Internal user-service reachability | | node-ip:31400 | TCP | Internal payment-service reachability |


Bonus: Automating pre-session health checks

You can script a health check before every mirrord session using the Vigilmon API:

#!/bin/bash
# check-staging.sh — run before mirrord exec

STAGING_URL="https://staging-api.example.com/health"
STATUS=$(curl -s -o /dev/null -w "%{http_code}" "$STAGING_URL")

if [ "$STATUS" != "200" ]; then
  echo "WARNING: Staging API is not healthy (HTTP $STATUS). mirrord session may be unreliable."
  echo "Check https://status.vigilmon.online/your-dev-page for details."
  exit 1
fi

echo "Staging environment is healthy. Starting mirrord session..."
mirrord exec --target deployment/api-service -- "$@"

Usage:

./check-staging.sh node server.js

What's next

  • SSL certificate monitoring — if your staging environment uses TLS (it should), Vigilmon monitors cert expiry so expired certs don't block mirrord HTTPS traffic
  • Heartbeat monitoring — if you run database migrations or seed jobs in staging before development sessions, add heartbeats to confirm they completed
  • Response time tracking — Vigilmon records response time history; if staging latency is much higher than production, your mirrord-based performance tests won't be representative

Get started free at vigilmon.online — no credit card, monitors start running in under a minute.

Monitor your app with Vigilmon

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

Start free →