DEV Community

Vigilmon
Vigilmon

Posted on

How to Monitor Your MariaDB Database with Vigilmon

MariaDB is one of the most widely used open-source relational databases, powering everything from small web apps to enterprise systems. When it goes down, your entire application stack follows. This guide shows you how to set up reliable uptime monitoring for MariaDB using Vigilmon.

Why Monitor MariaDB?

MariaDB failures can be silent killers. A crashed service, an exhausted connection pool, or a locked table can take your app down within seconds. Common failure scenarios include:

  • Service crash due to out-of-memory conditions
  • Connection limits exhausted under load
  • Replication lag causing stale reads
  • Disk space exhaustion causing write failures

Setting Up MariaDB Monitoring with Vigilmon

Step 1: TCP Port Monitor

MariaDB listens on port 3306. Vigilmon monitors this port directly—no database credentials needed.

  1. Log into Vigilmon
  2. Click Add MonitorTCP Port
  3. Enter your database host and port 3306
  4. Set check interval to 60 seconds
  5. Configure alert channels (email, Slack, PagerDuty)

Step 2: HTTP Health Endpoint

Expose a lightweight health check from your application layer:

@app.route('/health/db')
def db_health():
    try:
        conn.execute('SELECT 1')
        return jsonify({"status": "ok"}), 200
    except Exception as e:
        return jsonify({"status": "error", "message": str(e)}), 503
Enter fullscreen mode Exit fullscreen mode

Add an HTTP Monitor in Vigilmon pointing to /health/db.

Step 3: Multi-Region Probes

Enable monitoring from US East, EU West, and Asia Pacific. This distinguishes real MariaDB outages from regional network issues.

Step 4: Replication Monitoring

For primary-replica setups, add a replication health endpoint:

@app.route('/health/replication')
def replication_health():
    cursor.execute("SHOW SLAVE STATUS")
    status = cursor.fetchone()
    lag = status.get('Seconds_Behind_Master', 9999)
    if lag > 30:
        return jsonify({"status": "degraded", "lag": lag}), 503
    return jsonify({"status": "ok", "lag": lag}), 200
Enter fullscreen mode Exit fullscreen mode

Create a separate Vigilmon HTTP monitor for this endpoint with an alert if it returns non-200.

Alert Escalation

Configure tiered alerts in Vigilmon:

Time Action
T+0 Slack/email notification
T+5m PagerDuty on-call alert
T+15m Secondary on-call + incident bridge

Conclusion

With Vigilmon you get external-perspective uptime monitoring for MariaDB in under 5 minutes—multi-region TCP checks, HTTP health endpoint monitoring, and instant alerts when your database becomes unreachable.

Start monitoring your MariaDB for free at vigilmon.online

Top comments (0)