Check mysql-table-indexes

Overview

Checks for missing indexes in MySQL/MariaDB tables. Logic is taken from MySQLTuner script, v1.9.8.

Hints:

Fact Sheet

Check Plugin Download

https://github.com/Linuxfabrik/monitoring-plugins/tree/main/check-plugins/mysql-table-indexes

Check Interval Recommendation

Once a day

Can be called without parameters

Yes

Available for

Python 3, Windows

Requirements

Python module pymysql; User with no privileges, locked down to 127.0.0.1 - for example monitoring@127.0.0.1. Usernames in MySQL/MariaDB are limited to 16 chars in specific versions.

Help

usage: mysql-table-indexes [-h] [-V] [--always-ok] [-H HOSTNAME]
                           [-p PASSWORD] [--port PORT] [-u USERNAME]

Checks for missing indexes in MySQL/MariaDB tables.

options:
  -h, --help            show this help message and exit
  -V, --version         show program's version number and exit
  --always-ok           Always returns OK.
  -H HOSTNAME, --hostname HOSTNAME
                        MySQL/MariaDB hostname. Default: 127.0.0.1
  -p PASSWORD, --password PASSWORD
                        Use the indicated password to authenticate the
                        connection. Default:
  --port PORT           MySQL/MariaDB port. Default: 3306
  -u USERNAME, --username USERNAME
                        MySQL/MariaDB username. Default: root

Usage Examples

./mysql-table-indexes --hostname localhost --username root --password mypassword

Output:

Tables without indexes: employees.current_dept_emp, employees.dept_emp_latest_date [WARNING]

States

  • WARN if tables without indexes are found.

Perfdata / Metrics

There is no perfdata.

Credits, License