DEV Community

Vigilmon
Vigilmon

Posted on

MySQL Monitoring with Vigilmon: External Health Checks for Your Database

MySQL Monitoring with Vigilmon: External Health Checks for Your Database

MySQL powers everything from small WordPress sites to large-scale web applications. When MySQL becomes unreachable, your application breaks immediately. Vigilmon monitors your MySQL-backed services externally by checking a health endpoint that proves database connectivity.

The Pattern: Health Endpoint as Database Probe

Your application already connects to MySQL. A /health endpoint that runs a lightweight query becomes your database heartbeat — and Vigilmon checks it from multiple regions continuously.

Building the Health Endpoint

Node.js + mysql2

const mysql = require('mysql2/promise');
const pool = mysql.createPool({ connectionString: process.env.DATABASE_URL });

app.get('/health', async (req, res) => {
  try {
    await pool.query('SELECT 1');
    res.json({ status: 'ok', database: 'mysql', connected: true });
  } catch (error) {
    res.status(503).json({ status: 'error', message: error.message });
  }
});
Enter fullscreen mode Exit fullscreen mode

PHP / Laravel

Route::get('/health', function () {
    try {
        DB::connection()->getPdo();
        return response()->json(['status' => 'ok', 'database' => config('database.default')]);
    } catch (Exception $e) {
        return response()->json(['status' => 'error', 'message' => 'Database unavailable'], 503);
    }
});
Enter fullscreen mode Exit fullscreen mode

WordPress (PHP)

add_action('init', function() {
    if ($_SERVER['REQUEST_URI'] === '/health') {
        global $wpdb;
        $result = $wpdb->get_var('SELECT 1');
        $status = $result ? 'ok' : 'error';
        $code = $result ? 200 : 503;
        wp_send_json(['status' => $status], $code);
        exit;
    }
});
Enter fullscreen mode Exit fullscreen mode

Python + PyMySQL

import pymysql, os

@app.get("/health")
async def health():
    try:
        conn = pymysql.connect(
            host=os.getenv("DB_HOST"),
            user=os.getenv("DB_USER"),
            password=os.getenv("DB_PASSWORD"),
            database=os.getenv("DB_NAME"),
            connect_timeout=3
        )
        conn.close()
        return {"status": "ok", "database": "mysql"}
    except Exception as e:
        raise HTTPException(status_code=503, detail=str(e))
Enter fullscreen mode Exit fullscreen mode

Configuring Vigilmon

  1. Log in to vigilmon.online
  2. Click Add Monitor
  3. Enter: https://yourapp.com/health
  4. Enable keyword assertion: ok
  5. Set response time alert threshold: 2000ms

Common MySQL Failures Vigilmon Detects

Failure How Vigilmon Catches It
MySQL server crash Health endpoint returns 503
Connection pool exhausted Response time spikes, then 503
Wrong password after rotation Health endpoint returns 503
Network partition Health endpoint times out
Disk full Queries fail, returns 503

Multi-Region Coverage

Vigilmon checks from multiple geographic regions. An alert fires only when a majority agree the endpoint is failing — no false positives from transient network issues.

Free Tier

5 monitors, 5-minute intervals, email alerts, no credit card required.

Start monitoring your MySQL-backed application at vigilmon.online.

Top comments (0)