Check mysql-storage-engines

Overview

Checks storage engines, fragmented tables and autoindex usage in MySQL/MariaDB. Logic is taken from MySQLTuner script.

User account requires:

  • Access to INFORMATION_SCHEMA (user with no privileges is sufficient).

  • SELECT privileges on all schemas and tables to provide accurate results.

Hints:

Fact Sheet

Check Plugin Download

https://github.com/Linuxfabrik/monitoring-plugins/tree/main/check-plugins/mysql-storage-engines

Check Interval Recommendation

Once a day

Can be called without parameters

Yes

Compiled for

Linux, Windows

3rd Party Python modules

pymysql

Help

usage: mysql-storage-engines [-h] [-V] [--always-ok]
                             [--defaults-file DEFAULTS_FILE]
                             [--defaults-group DEFAULTS_GROUP]
                             [--timeout TIMEOUT]

Checks storage engines, fragmented tables and autoindex usage in
MySQL/MariaDB.

options:
  -h, --help            show this help message and exit
  -V, --version         show program's version number and exit
  --always-ok           Always returns OK.
  --defaults-file DEFAULTS_FILE
                        Specifies a cnf file to read parameters like user,
                        host and password from (instead of specifying them on
                        the command line), for example
                        `/var/spool/icinga2/.my.cnf`. Default:
                        /var/spool/icinga2/.my.cnf
  --defaults-group DEFAULTS_GROUP
                        Group/section to read from in the cnf file. Default:
                        client
  --timeout TIMEOUT     Network timeout in seconds. Default: 3 (seconds)

Usage Examples

./mysql-storage-engines --defaults-file=/var/spool/icinga2/.my.cnf

Output:

There are warnings.

* 1 fragmented table
* OPTIMIZE TABLE `backup20190815`.`docs`; -- can free 2.6GiB
* Total freed space after all OPTIMIZE TABLEs: 2.6GiB
* accounting.contact has an autoincrement value near max capacity (97.0%)

States

  • WARN if InnoDB is enabled but isn’t being used

  • WARN if BDB is enabled but isn’t being used

  • WARN if MYISAM is enabled but isn’t being used

  • WARN if fragmented tables are found

  • WARN if a table’s autoincrement value is >= 75% max capacity

Perfdata / Metrics

There is no perfdata.

Troubleshooting

InnoDB is enabled but isn’t being used. Add skip-innodb to MySQL configuration to disable InnoDB

But InnoDB is enabled? You must use a user with the sufficiently high permissions to access the MySQL/MariaDB internals for this check to work properly.

Credits, License