Agent skill · data analytics · jeremylongshore

monitoring-database-transactions

Monitor use when you need to work with monitoring and observability.

Why this skill is useful

Adds executable monitoring scripts and specific database queries for real-time transaction health checks that the AI wouldn't generate on its own.

What it needs

Requires mongosh, mysql, psql installed locally. About 3k tokens when loaded. Last updated 2026-08-07. 2,604 stars on the source repository.

What this skill does

Database Transaction Monitor Overview Monitor active database transactions in real time to detect long-running queries, lock contention, uncommitted transactions, and transaction throughput anomalies across PostgreSQL, MySQL, and MongoDB. Prerequisites Database credentials with access to system catalogs (pgstatactivity, informationschema.PROCESSLIST, or MongoDB currentOp) psql, mysql, or mongosh CLI installed Permissions to view other sessions' transactions (PostgreSQL: pgmonitor role; MySQL: PROCESS privilege) Baseline metrics for normal transaction duration and throughput Alerting infrastructure (email, Slack webhook, or PagerDuty) for notifications Instructions 1. Query the active transaction view to establish a baseline. For PostgreSQL: SELECT pid, state, querystart, now() - querystart AS duration, query FROM pgstatactivity WHERE state != 'idle' ORDER BY duration DESC. For MySQL: SELECT id, user, host, db, command, time, state, info FROM informationschema.PROCESSLIST WHERE command != 'Sleep'. 2. Identify long-running transactions by filtering for duration exceeding the application's expected transaction time. Set initial thresholds at 30 seconds for OLTP workloads or 5 minutes for batch/reporting workloads. 3. Detect idle-in-transaction sessions that hold locks without executing queries. For PostgreSQL: SELECT pid, state, querystart, now() - statechange AS idleduration FROM pgstatactivity WHERE state = 'idle in transaction' AND now() - statechange > interval '5 minutes'. 4. Monitor lock contention by querying the lock manager. For PostgreSQL: SELECT blockedlocks.pid AS blockedpid, blockinglocks.pid AS blockingpid, blockedactivity.query AS blockedquery FROM pgcatalog.pglocks blockedlocks JOIN pgcatalog.pglocks blockinglocks ON blockinglocks.locktype = blockedlocks.locktype. For MySQL: SELECT FROM informationschema.INNODBLOCKWAITS. 5. …

How to use it

Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:

@skills jeremylongshore/monitoring-database-transactions

View the source on GitHub

Browse the @skills marketplace