Monitoring Your Mockoon Mock Server with Vigilmon
Your Mockoon mock server is down. Frontend developers are blocked. The CI pipeline is failing on integration tests that depend on it. You found out when someone pinged you on Slack.
Mock servers are infrastructure. They need monitoring too. By the end of this tutorial you'll have:
- A
/healthroute in Mockoon that returns a known-good response - HTTP uptime monitoring with Vigilmon
- Alerts when the mock server stops responding
- Heartbeat monitoring for Mockoon running as a CLI process
Setup takes under 15 minutes.
Step 1: Add a health route to your Mockoon environment
Mockoon doesn't ship a built-in health endpoint, but you can add one in seconds through the GUI or the environment JSON.
Option A — GUI (Mockoon Desktop)
- Open your environment
- Click Add route → set method to
GET, path to/health - Set the response status to
200 - Set the response body to:
{
"status": "ok",
"service": "mock-api",
"timestamp": "{{now}}"
}
- Save (Ctrl+S / Cmd+S)
Option B — Edit the environment JSON directly
Open your .json environment file and add a route to the routes array:
{
"uuid": "health-route-uuid",
"documentation": "Health check",
"method": "get",
"endpoint": "health",
"responses": [
{
"uuid": "health-response-uuid",
"statusCode": 200,
"label": "OK",
"headers": [
{ "key": "Content-Type", "value": "application/json" }
],
"body": "{ \"status\": \"ok\", \"service\": \"mock-api\" }",
"rules": [],
"default": true
}
]
}
Verify the route is live:
curl http://localhost:3001/health
# {"status":"ok","service":"mock-api"}
Step 2: Run Mockoon CLI for production-grade mock serving
Mockoon Desktop is great for development. For CI, staging, or any persistent environment, use the Mockoon CLI — it runs headless and is much easier to monitor.
Install the CLI:
npm install -g @mockoon/cli
Start your environment:
mockoon-cli start --data ./my-api.json --port 3001 --daemon-off
For a persistent daemon:
mockoon-cli start --data ./my-api.json --port 3001
Check the process:
mockoon-cli list
Add a pm2-style restart policy using PM2 directly if you want process supervision:
npm install -g pm2
pm2 start "mockoon-cli start --data ./my-api.json --port 3001 --daemon-off" --name mock-api
pm2 save
pm2 startup
Step 3: Set up HTTP monitoring in Vigilmon
With your Mockoon server running and the /health endpoint live, connect it to Vigilmon:
- Sign up at vigilmon.online (free, no card required)
- Click New Monitor → HTTP
- Enter
http://your-mock-server.yourdomain.com/health - Set check interval: 1 minute (paid) or 5 minutes (free)
- Under Expected status code, set
200 - Save
Vigilmon checks from multiple regions. If your mock server returns a non-200, is unreachable, or times out, you get alerted within the check interval.
You can add monitors for critical mock routes too:
http://mock.yourdomain.com/health → server alive
http://mock.yourdomain.com/api/users → users endpoint responding
http://mock.yourdomain.com/api/orders → orders endpoint responding
This catches route-level failures — Mockoon can start but serve 404s if the environment JSON is malformed.
Step 4: Heartbeat monitoring for the Mockoon process
HTTP monitoring detects when the mock server isn't responding. But it doesn't catch the case where the process restarts frequently or PM2 is silently restarting it every few minutes.
Add a heartbeat check: a script that pings a Vigilmon heartbeat URL after confirming Mockoon is healthy.
Create check-mock.sh:
#!/bin/bash
HEALTH_URL="http://localhost:3001/health"
HEARTBEAT_URL="${VIGILMON_MOCK_HEARTBEAT}"
response=$(curl -s -o /dev/null -w "%{http_code}" "$HEALTH_URL")
if [ "$response" = "200" ]; then
curl -s "$HEARTBEAT_URL" > /dev/null
else
echo "Mock server health check failed: HTTP $response"
exit 1
fi
Add it to cron:
# Run every 5 minutes
*/5 * * * * /usr/local/bin/check-mock.sh >> /var/log/mock-health.log 2>&1
In Vigilmon, create a Heartbeat Monitor:
- Click New Monitor → Heartbeat
- Set expected interval to 10 minutes (2× the cron interval for tolerance)
- Copy the ping URL
- Set
VIGILMON_MOCK_HEARTBEAT=<url>in your environment
If the mock server stops responding, the cron script exits non-zero and doesn't ping Vigilmon. After one missed interval, you get alerted.
Step 5: Slack alerts and status page
Go to Notifications → New Channel → Slack in Vigilmon and paste your Slack incoming webhook URL.
When your mock server goes down:
🔴 DOWN: mock.yourdomain.com/health
Status: Connection refused
Region: EU-West
3 minutes ago
Recovery:
✅ RECOVERED: mock.yourdomain.com/health
Downtime: 12 minutes
For a shared status page (useful when multiple teams depend on your mock server):
- Status Pages → New Status Page
- Add your mock monitors
- Share the public URL with your frontend and mobile teams
They can check it before assuming their code is broken.
What you've built
| What | How |
|------|-----|
| Health route | Mockoon GET /health → 200 + JSON |
| Process supervision | PM2 wrapping mockoon-cli |
| HTTP uptime monitoring | Vigilmon HTTP monitor |
| Process health heartbeat | Cron script + Vigilmon heartbeat |
| Slack alerts | Vigilmon Slack notification channel |
| Shared status page | Vigilmon public status page |
Your mock server is now monitored the same way you'd monitor a production API. Teams depending on it will know when it's down before they waste time debugging their own code.
Next steps
- Add monitors for every critical Mockoon route your CI pipeline hits
- Use Mockoon's response rules to simulate error states and verify your monitors catch them
- Monitor response time — a Mockoon server getting slow is often a sign of resource contention on the host
Get started free at vigilmon.online.