tutorial

Monitoring pgAdmin 4 with Vigilmon

pgAdmin 4 is the de facto GUI for managing PostgreSQL — but if it goes down during an incident, you lose your primary diagnostic tool exactly when you need it most. Here's how to monitor pgAdmin 4 with Vigilmon.

pgAdmin 4 is the standard web-based administration tool for PostgreSQL: schema browsing, a query tool with execution plans, ERD diagrams, backup and restore via pg_dump/pg_restore, and job scheduling via pgAgent. DBAs, developers, and sysadmins rely on it as a browser-based replacement for psql during incidents and routine maintenance. But pgAdmin runs its own Gunicorn + Flask server with a SQLite configuration database — and when that stack goes down, you lose your primary diagnostic interface at the worst possible moment. Vigilmon keeps a continuous eye on pgAdmin's web interface, health endpoint, and SSL certificate so you know the moment it becomes unavailable.

What You'll Set Up

  • HTTP monitor for the pgAdmin 4 web interface (port 80)
  • Health check endpoint monitor for Flask app responsiveness
  • SSL certificate alerts for HTTPS deployments
  • Cron heartbeat for pgAgent job scheduler health

Prerequisites

  • pgAdmin 4 running (Docker via dpage/pgadmin4, package install, or virtual environment)
  • pgAdmin accessible over HTTP on port 80 (or HTTPS behind a reverse proxy)
  • A free Vigilmon account

Step 1: Monitor the pgAdmin 4 Web Interface

pgAdmin 4 serves its Angular SPA through Gunicorn and Flask. The root path / redirects to /browser/, which returns the full pgAdmin interface. A 200 or 302 response confirms the server stack is running.

  1. Log in to vigilmon.online and click Add Monitor.
  2. Set Type to HTTP / HTTPS.
  3. Enter the URL: http://your-server/ (or https://pgadmin.yourdomain.com/ if behind a proxy).
  4. Set Check interval to 1 minute.
  5. Set Expected HTTP status to 200 (or 302 if your setup redirects to /browser/).
  6. Under Keyword check, enter pgAdmin — the page title contains this string.
  7. Click Save.

For Docker deployments, the default port is 80 inside the container. If you mapped it to a different host port:

docker run -p 5050:80 dpage/pgadmin4

Use http://your-server:5050/ in the monitor URL.


Step 2: Monitor the Flask Application Health Endpoint

The web interface check in Step 1 confirms the server is responding, but a deep health check on the login page or /misc/ping endpoint verifies that the Flask app and its underlying SQLite configuration database are both functional. A 500 error on the login page typically indicates SQLite corruption or missing configuration files.

  1. Click Add MonitorHTTP / HTTPS.
  2. Enter the URL: http://your-server/login (or http://your-server/misc/ping if your version supports it).
  3. Set Check interval to 2 minutes.
  4. Set Expected HTTP status to 200.
  5. Under Keyword check, enter pgAdmin — the login page always contains this string when Flask is healthy.
  6. Click Save.

If you're running pgAdmin 4 v7+ in Docker, you can also check /misc/ping which returns a minimal JSON response:

curl http://localhost/misc/ping
# {"status": "OK"}

Add a keyword check for OK on this endpoint for a lightweight liveness probe.


Step 3: Verify pgAdmin Can Reach PostgreSQL (Optional Deep Check)

For teams that want to confirm pgAdmin's connectivity to the databases it manages — not just that the web UI is up — you can use pgAdmin's REST API to ping a configured server. This requires authentication, so it's best implemented as a scripted heartbeat rather than a passive HTTP monitor.

Create a script that logs in, pings a server connection, and sends a heartbeat:

#!/bin/bash
# /usr/local/bin/check-pgadmin-db-conn.sh

BASE_URL="http://localhost"
EMAIL="admin@example.com"
PASSWORD="your-pgadmin-password"
SERVER_ID="1"  # ID of the PostgreSQL server configured in pgAdmin

# Login and capture session cookie
COOKIE_JAR=$(mktemp)
LOGIN_RESPONSE=$(curl -sf -c "$COOKIE_JAR" -X POST \
  -H "Content-Type: application/json" \
  -d "{\"email\":\"${EMAIL}\",\"password\":\"${PASSWORD}\"}" \
  "${BASE_URL}/login")

# Get CSRF token and ping server connection
CSRF_TOKEN=$(echo "$LOGIN_RESPONSE" | jq -r '.csrf_token // empty')
if [ -n "$CSRF_TOKEN" ]; then
  STATUS=$(curl -sf -b "$COOKIE_JAR" \
    -H "X-pgA-CSRFToken: ${CSRF_TOKEN}" \
    "${BASE_URL}/browser/server/connect/${SERVER_ID}" | jq -r '.connected // false')
  if [ "$STATUS" = "true" ]; then
    curl -sf https://vigilmon.online/heartbeat/your-heartbeat-id
  fi
fi
rm -f "$COOKIE_JAR"

Schedule this with cron to run every 15 minutes:

*/15 * * * * /usr/local/bin/check-pgadmin-db-conn.sh

This heartbeat confirms the full chain: pgAdmin web server → Flask session → SQLite config → PostgreSQL connection.


Step 4: SSL Certificate Alerts for HTTPS pgAdmin

pgAdmin must be behind HTTPS in production — it stores and proxies database connection credentials, including passwords to production databases. An expired SSL certificate locks administrators out of their primary database management tool, often during the exact incident that requires database access.

  1. Open the HTTP monitor for your pgAdmin URL (created in Step 1).
  2. Enable Monitor SSL certificate under the SSL section.
  3. Set Alert when certificate expires in less than 21 days.
  4. Click Save.

Common pgAdmin reverse proxy configurations that need SSL monitoring:

nginx:

server {
    listen 443 ssl;
    server_name pgadmin.yourdomain.com;
    ssl_certificate /etc/letsencrypt/live/pgadmin.yourdomain.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/pgadmin.yourdomain.com/privkey.pem;

    location / {
        proxy_pass http://localhost:5050;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
    }
}

Docker Compose with Traefik:

labels:
  - "traefik.enable=true"
  - "traefik.http.routers.pgadmin.rule=Host(`pgadmin.yourdomain.com`)"
  - "traefik.http.routers.pgadmin.entrypoints=websecure"
  - "traefik.http.routers.pgadmin.tls.certresolver=letsencrypt"

With a 21-day alert window, you have ample time to renew before an expired cert triggers a lockout during an emergency.


Step 5: Heartbeat Monitoring for pgAgent Job Scheduler

pgAdmin supports scheduled maintenance jobs via pgAgent — automated backups, VACUUM ANALYZE runs, statistics refresh, and custom SQL tasks. When pgAgent stops running or a backup job fails, there's no built-in alert. A Vigilmon heartbeat catches missed backups before they become a data loss risk.

  1. In Vigilmon, click Add MonitorCron Heartbeat.
  2. Set the expected ping interval to match your backup schedule (e.g. 1440 minutes for daily backups).
  3. Copy the heartbeat URL.
  4. Add a pgAgent job step that pings the heartbeat URL after a successful backup:

In pgAdmin, create a pgAgent job with two steps:

Step 1 — Run backup:

-- Type: Batch (shell), runs pg_dump
pg_dump -h localhost -U postgres -Fc mydb > /backups/mydb_$(date +%Y%m%d).dump

Step 2 — Ping heartbeat on success:

curl -sf https://vigilmon.online/heartbeat/your-heartbeat-id

Alternatively, query pgAgent job history directly to verify the last successful run:

-- Run this in pgAdmin's Query Tool
SELECT jlgstatus, jlgstart
FROM pgagent.pga_joblog
WHERE jlgstatus = 's'  -- 's' = success
ORDER BY jlgstart DESC
LIMIT 1;

If this query returns a result older than your expected backup interval, your backup jobs are failing silently.


Step 6: Configure Alert Channels

  1. Go to Alert Channels in Vigilmon and add Slack, email, or PagerDuty.
  2. Set Consecutive failures before alert to 2 on the web interface monitor — pgAdmin occasionally takes a few seconds to respond under load.
  3. Route pgAdmin SSL certificate alerts to your on-call channel separately from the web interface alerts, since they require different response actions (certificate renewal vs. server restart).

Summary

| Monitor | Target | What It Catches | |---|---|---| | Web interface | https://pgadmin.domain.com/ | Gunicorn/Flask process down | | Login page | https://pgadmin.domain.com/login | SQLite config corruption | | SSL certificate | https://pgadmin.domain.com | Expired cert locks out admins | | pgAgent heartbeat | Heartbeat URL | Missed backups, pgAgent failure | | DB connectivity | Scripted heartbeat | pgAdmin can't reach PostgreSQL |

pgAdmin is your command center for PostgreSQL — and a command center that goes dark during an incident is worse than useless. With Vigilmon watching the web interface, Flask health endpoint, SSL certificate, and pgAgent job heartbeats, you know immediately when your database administration tool becomes unavailable or your scheduled backups stop running.

Monitor your app with Vigilmon

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

Start free →