Check mysql-open-files

Overview

Checks the open file usage in MySQL/MariaDB. Logic is taken from MySQLTuner script:mysql_stats(), v1.9.8.

Hints:

Fact Sheet

Check Plugin Download

https://github.com/Linuxfabrik/monitoring-plugins/tree/main/check-plugins/mysql-open-files

Check Interval Recommendation

Every 5 minutes

Can be called without parameters

Yes

Compiled for

Linux, Windows

Requirements

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.

3rd Party Python modules

pymysql

Help

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

Checks the open file 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-open-files --defaults-file=/var/spool/icinga2/.my.cnf

Output:

0.2% of open_files_limit used (80.0/32.8K).

States

  • WARN if amount of open files is > 85%.

Perfdata / Metrics

Name

Type

Description

mysql_open_files

Number

Number of regular files currently opened by the server. Does not include sockets or pipes, or storage engines using internal functions.

mysql_open_files_limit

Number

The number of file descriptors available to MariaDB. If you are getting the Too many open files error, then you should increase this limit.

mysql_pct_files_open

Percentage

Open_files / open_files_limit * 100

Credits, License