MySQL/MariaDB health checker — monitor connections, slow queries, replication status, and database size
Project description
dargslan-mysql-health
MySQL/MariaDB Health Checker — Monitor connections, slow queries, replication status, and database sizes. Zero external dependencies (uses mysql CLI client).
Installation
pip install dargslan-mysql-health
CLI Usage
# Full health report
dargslan-mysql report
# Connection statistics
dargslan-mysql connections
# Slow query info
dargslan-mysql slow
# Database sizes
dargslan-mysql databases
# Replication status
dargslan-mysql replication
# All issues
dargslan-mysql issues
# JSON output
dargslan-mysql json
# Custom connection
dargslan-mysql report -H 10.0.0.5 -P 3306 -u admin
Python API
from dargslan_mysql_health import MySQLHealth
mh = MySQLHealth(host='localhost', user='root')
# Full audit
issues = mh.audit()
# Specific checks
conn = mh.connection_status()
slow = mh.slow_queries()
dbs = mh.database_sizes()
repl = mh.replication_status()
# Server info
info = mh.server_info()
# Formatted report
mh.print_report()
Health Checks
| Check | Severity | Description |
|---|---|---|
| Connection usage >80% | Warning | Too many active connections |
| Connection usage >95% | Critical | Nearly maxed out connections |
| Slow query log off | Info | Slow query logging disabled |
| High slow queries | Warning | >1000 slow queries recorded |
| Replication broken | Critical | IO/SQL thread not running |
| Replication lag | Warning | >60 seconds behind master |
Environment Variables
| Variable | Description |
|---|---|
MYSQL_USER |
Default MySQL username |
MYSQL_PASSWORD |
Default MySQL password |
More from Dargslan
- Dargslan.com — Linux & DevOps eBook Store
- Free Cheat Sheets — 300+ downloadable PDFs
- Blog & Tutorials — 300+ in-depth articles
- All Python Tools — 20+ CLI packages
License
MIT — see LICENSE
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dargslan_mysql_health-1.0.0.tar.gz.
File metadata
- Download URL: dargslan_mysql_health-1.0.0.tar.gz
- Upload date:
- Size: 5.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7a4fc79a19aa876a131f3fbdae0e5906d6c4968016486a29e0c4a138145d061c
|
|
| MD5 |
0984db932fb8174111325ea236dac4e6
|
|
| BLAKE2b-256 |
db0afbc51aab4c334823b70bc7b386fc576bc22655142b992ac4e2aa3241dc41
|
File details
Details for the file dargslan_mysql_health-1.0.0-py3-none-any.whl.
File metadata
- Download URL: dargslan_mysql_health-1.0.0-py3-none-any.whl
- Upload date:
- Size: 6.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6963d2fdffc77571a82055b7ff09c6052a710a1d6ed71d38900d0c280ff1ba29
|
|
| MD5 |
ceb9efa9ba726f5e92e40ebee5783236
|
|
| BLAKE2b-256 |
312cef5bbf7aa55a26dc1b907150b402633364e5cf536eefe6de29f71439956a
|