Skip to main content
HealOps uses MySQL diagnostics to investigate database-related alerts — checking server health, surfacing slow queries, monitoring replication status, and analyzing table statistics.

Prerequisites

  • MySQL 5.7+ (8.0+ recommended for full performance_schema support)
  • Network access from the HealOps environment to your MySQL instance
  • A read-only user with access to information_schema and performance_schema

Setup

Option 1: Interactive CLI

Select MySQL when prompted and provide your host, database, and credentials.

Option 2: Environment variables

Add to your .env:

Option 3: Persistent store

Integrations are automatically persisted to ~/.config/healops/integrations.json:

Creating a read-only user

performance_schema is enabled by default in MySQL 5.7+. Slow query data will not be available if it has been explicitly disabled in my.cnf.

Investigation tools

When HealOps investigates a MySQL-related alert, five diagnostic tools are available:

Server status

Retrieves version, uptime, connection counts (current, running, max used), query rates, and InnoDB buffer pool hit ratio and deadlock counts. Useful for spotting connection saturation, high deadlock rates, or poor buffer pool efficiency.

Current processes

Lists active queries running longer than a configurable threshold (default 1 s), excluding sleeping connections. Surfaces long-running queries and lock contention that may be blocking other operations.

Replication status

Reports replica IO and SQL thread health, seconds behind source, and last replication error. Uses SHOW REPLICA STATUS (MySQL 8.0.22+) with automatic fallback to SHOW SLAVE STATUS for older versions. Returns a note if the server is not configured as a replica.

Slow queries

Reads performance_schema.events_statements_summary_by_digest to surface queries with the highest average execution time. Results include call count, average/total/min/max execution time (in ms), rows examined, rows sent, and full-table scan indicators.
Slow query data requires performance_schema to be enabled (performance_schema=ON in my.cnf). This is the default in MySQL 5.7+.

Table statistics

Returns row count estimates, data size, and index size for all base tables in the target database, sourced from information_schema.TABLES. Results are ordered by total size descending.

Verify

Expected output:

Troubleshooting

Security best practices

  • Use a dedicated read-only user — avoid root credentials for monitoring.
  • Enable SSL (MYSQL_SSL_MODE=required) in production environments.
  • Restrict the user to specific hosts rather than '%' where possible.
  • Store credentials in .env, never in source code.
  • Rotate credentials periodically.