MySQL Alerts & Rules

Setup alert rules for your MySQL deployment to monitor key metrics, disk space, and server role change for custom thresholds, triggers, and time parameters to improve your app performance.

ScaleGrid's alerts and rules for MySQL hosting allow you to stay on top of your deployment activity. Every database type has a different set of alert rules that can be configured as per your convenience. You can get alerts sent directly to you via SMS, email, PagerDuty, Opsgenie or Slack.

MySQL Global Alert Rules

These are the default alert rules automated by ScaleGrid for all MySQL clusters:

  • CPU - Total (%) greater than 60%
  • Available disk space (%) less than 20%
  • Replication Delay (secs) greater than 300 secs
  • Connections (per second) greater than 1000 per second

📘

Override Global Rules

You can override a Global Alert Rule by creating a new Cluster-Level Alert Rule or an Account-Level Alert Rule. For example, our CPU usage rule is set to 60% by default, but if you create a new Cluster-Level Alert and set it to 80%, this will override the Global Alert Rules for this cluster.

Account Level Rules

These rules are enforced by you and apply to all MySQL clusters in your ScaleGrid account based on database type. You can configure account level rules under:

Settings > Global Rules > Alert Rules

See how to Create MySQL Account-Level Alert Rules.

🚧

These rules are enforced by you and apply to all clusters in your ScaleGrid account based on database type. Account-Level rules override Global Rules and are overridden by Cluster-Level rules.

Cluster Level Rules

These rules are enforced by you and apply to specific clusters in your ScaleGrid account. You can configure cluster level rules on the details page:

Details Page > Alerts > Rules > Create New Rule

See how to Create MySQL Cluster-Level Alert Rules.

🚧

These rules are enforced by you and apply to all clusters in your ScaleGrid account based on database type. Cluster-Level rules override Global Rules and Account-Level rules.

MySQL Alert Types

ScaleGrid supports three top-level alert types:

  • Metrics
  • Disk Free (only for MySQL clusters)
  • Server Role Change

If you create an alert rule based on a specific metric, you have the option set conditions:

  • Threshold
  • Trigger if threshold greater than or less than the current value
  • Time for which the condition lasts for: 2 minutes, 6 minutes, or 1 hour

MySQL Metrics

Here is a list of MySQL metrics that you can use to create alerts:


CPU - User (%)
API Enum: CPU_USER
The percentage of time the CPU spent on user applications.


CPU - System (%)
API Enum: CPU_SYSTEM
The percentage of time the CPU spent in the operating system.


CPU - Nice (%)
API Enum: CPU_NICE
The percentage of time the CPU spent in nice mode.


CPU - IO Wait (%)
API Enum: CPU_IOWAIT
The percentage of time the CPU spent waiting for IO operations to complete.


CPU - Total (%)
API Enum: CPU_TOTAL
The total percentage of time the CPU spent on user applications, operating systems, nice mode, and IO wait.


Memory - Total (KB)
API Enum: MEM_TOTAL
Total available system memory in KB.


Memory - Used (KB)
API Enum: MEM_USED
KB of system memory used.


Memory - Free (KB)
API Enum: MEM_FREE
KB of system memory free.


Memory - Buffers (KB)
API Enum: MEM_BUFFERS
KB of system memory used for buffers


Memory - Cached (KB)
API Enum: MEM_CACHED
KB of system memory used for page cache


Disk - Read (KB/sec)
API Enum: DISK_READ
Total disk reads in KB/sec.


Disk - Write (KB/sec)
API Enum: DISK_WRITE
Total disk writes in KB/sec.


Operation - Select (per sec)
API Enum: MYSQL_OPCOUNTERS_SELECT
Number of Select operations/sec.


Operation - Insert (per sec)
API Enum: MYSQL_OPCOUNTERS_INSERT
Number of Insert operations/sec.


Operation - Insert Select (per sec)
API Enum: MYSQL_OPCOUNTERS_INSERT_SELECT
Number of Insert Select operations/sec.


Operation - Update (per sec)
API Enum: MYSQL_OPCOUNTERS_UPDATE
Number of Update operations/sec.


Operation - Update Multi (per sec)
API Enum: MYSQL_OPCOUNTERS_UPDATE_MULTI
Number of Multiple Row Updates operations/sec.


Operation - Delete (per sec)
API Enum: MYSQL_OPCOUNTERS_DELETE
Number of Delete operations/sec.


Operation - Delete Multi (per sec)
API Enum: MYSQL_OPCOUNTERS_DELETE_MULTI
Number of Multiple Row Deletes operations/sec.


Operation - Replace (per sec)
API Enum: MYSQL_OPCOUNTERS_REPLACE
Number of Replace operations/sec.


Operation - Replace Select (per sec)
API Enum: MYSQL_OPCOUNTERS_REPLACE_SELECT
Number of Replace Select operations/sec.


Operation - Commit (per sec)
API Enum: MYSQL_OPCOUNTERS_COMMIT
Number of Commit operations/sec.


Operation - Rollback (per sec)
API Enum: MYSQL_OPCOUNTERS_ROLLBACK
Number of Rollback operations/sec.


Operation - Flush (per sec)
API Enum: MYSQL_OPCOUNTERS_FLUSH
Number of Flush operations/sec.


Operation - Execute (per sec)
API Enum: MYSQL_OPCOUNTERS_EXECUTE
Number of Execute operations/sec.


Operation - Fetch (per sec)
API Enum: MYSQL_OPCOUNTERS_FETCH
Number of Fetch operations/sec.


Network - Inbound (KB/sec)
API Enum: MYSQL_NETWORK_INBOUND
Inbound Network usage in KB/sec.


Network - Outbound (KB/sec)
API Enum: MYSQL_NETWORK_OUTBOUND
Outbound Network usage in KB/sec.


Aborted Connections
API Enum: MYSQL_ABORTED_CONNECTION
The number of failed attempts to connect to the MySQL server.


Aborted Clients
API Enum: MYSQL_ABORTED_CLIENTS
The number of connections that were aborted because the client died without closing the connection properly (timeouts).


Threads - Connected
API Enum: MYSQL_THREADS_CONNECTED
Currently open connections.


Threads - Running
API Enum: MYSQL_THREADS_RUNNING
Number of threads not sleeping.


Threads - Created (Threads/sec)
API Enum: MYSQL_THREADS_CREATED
Number of threads created to handle connections.


Threads - Cached
API Enum: MYSQL_THREADS_CACHED
Number of threads waiting to be reused in the thread cache.


Total Queries (per sec)
API Enum: MYSQL_TOTAL_QUESTIONS
Number of statements executed by the server/sec.


Slow Queries (per sec)
API Enum: MYSQL_SLOW_QUERIES
The rate of queries that have taken more than long_query_time seconds.


Connections (per sec)
API Enum: MYSQL_CONNECTIONS
The rate of connection attempts (successful or not) to the MySQL server


Temp - Files Created (per sec)
API Enum: MYSQL_TEMPOBJECT_FILES
Number of temp files mysqld created/sec.


Temp - Tables Created (per sec)
API Enum: MYSQL_TEMPOBJECT_TABLES
Number of temp tables mysqld created/sec.


Temp - Disk Tables Created (per sec)
API Enum: MYSQL_TEMPOBJECT_DISKTABLES
Number of internal on-disk temp tables mysqld created/sec.


Files - Open
API Enum: MYSQL_FILES_OPEN
Number of files that are open.


Files - Opened (per sec)
API Enum: MYSQL_FILES_OPENED
Number of files opened/sec.


Tables - Open
API Enum: MYSQL_TABLES_OPEN
Number of tables that are open.


Tables - Opened (per sec)
API Enum: MYSQL_TABLES_OPENED
Number of tables that have been opened/sec.


TableDef - Open
API Enum: MYSQL_TABLEDEF_OPEN
Number of cached .frm files.


TableDef - Opened (per sec)
API Enum: MYSQL_TABLEDEF_OPENED
Number of .frm files that have been cached/sec.


Table Open Cache - Hit (per sec)
API Enum: MYSQL_TABLEOPENCACHE_HIT
Number of hits for open tables cache lookups/sec.


Table Open Cache - Miss (per sec)
API Enum: MYSQL_TABLEOPENCACHE_MISS
Number of misses for open tables cache lookups/sec.


Table Open Cache - Miss Overflow (per sec)
API Enum: MYSQL_TABLEOPENCACHE_MISSOVERFLOW
Number of overflows for the open tables cache/sec.


Table Open Cache - Hit Ratio
API Enum: MYSQL_TABLEOPENCACHE_HITRATIO
Hit ratio.


Buffer Pool - Total Data (KB)
API Enum: MYSQL_INNODB_BUFFERPOOL_DATA
Total number of KBs in the InnoDB buffer pool containing data - The number includes both dirty and clean pages.


Buffer Pool - Dirty (KB)
API Enum: MYSQL_INNODB_BUFFERPOOL_DIRTY
Total current number of KBs held in dirty pages in the InnoDB buffer pool.


Buffer Pool - Free (KB)
API Enum: MYSQL_INNODB_BUFFERPOOL_FREE
Total size of free pages in the InnoDB buffer pool.


Buffer Pool - Misc (KB)
API Enum: MYSQL_INNODB_BUFFERPOOL_MISC
Total size of the InnoDB buffer pool that has been allocated for administrative overhead, such as row locks or the adaptive hash index.


Buffer Pool - Pages Written (per sec)
API Enum: MYSQL_INNODB_BUFFERPOOLIO_PAGESWRITTEN
Number of pages written by operations on InnoDB tables/sec.


Buffer Pool - Pages Read (per sec)
API Enum: MYSQL_INNODB_BUFFERPOOLIO_PAGESREAD
Number of pages read from buffer pool by operations on tables/sec.


Buffer Pool - Pages Created (per sec)
API Enum: MYSQL_INNODB_BUFFERPOOLIO_PAGESCREATED
Number of pages created by operations on InnoDB tables/sec.


Buffer Pool - Read Requests (per sec)
API Enum: MYSQL_INNODB_BUFFERPOOL_READREQUESTS
Number of logical read requests/sec.


Buffer Pool - Write Requests (per sec)
API Enum: MYSQL_INNODB_BUFFERPOOL_WRITEREQUESTS
Number of writes done to the InnoDB buffer pool/sec.


I/O - Data Reads (per sec)
API Enum: MYSQL_INNODB_IO_DATAREAD
Number of data reads(OS files)/sec.


I/O - Data Writes (per sec)
API Enum: MYSQL_INNODB_IO_DATAWRITES
Number of data writes(OS files)/sec.


I/O - Log Writes (per sec)
API Enum: MYSQL_INNODB_IO_LOGWRITES
Number of physical writes to the InnoDB redo log file/sec.


I/O - Data Fsyncs (per sec)
API Enum: MYSQL_INNODB_IO_DATAFSYNC
Number of fsync() operations/sec.


Transactions - History Length
API Enum: MYSQL_INNODB_TRANSACTIONS_HISTORYLENGTH
Length of undo logs.


Replication Delay (sec)
API Enum: MYSQL_REPLICATION_REPLICATION_DELAY
Delay between an operation on the master and the application of that operation on the slave.


BinLog - Size (KB)
API Enum: MYSQL_REPLICATION_BINLOG_SIZE
Total size of binary log files.


BinLog - Count
API Enum: MYSQL_REPLICATION_BINLOG_COUNT
Number of binary log files.


RelayLog - Size (KB)
API Enum: MYSQL_REPLICATION_RELAYLOG_SPACE
The size of the relay log file in KB.


Age - Size of transaction logs since last checkpoint (KB)
API Enum: MYSQL_CHCKPT_AGE
KBs in transaction logs since last checkpoint.