Check mysql-open-files¶
Overview¶
Checks the open file usage in MySQL/MariaDB as a percentage of the configured open_files_limit. If the usage approaches the limit, the server may start refusing new connections or fail to open tables.
Important Notes:
Data Collection:
Queries
SHOW GLOBAL VARIABLESforopen_files_limitQueries
SHOW GLOBAL STATUSforOpen_filesCalculates the percentage of open files relative to the limit
Logic is taken from MySQLTuner script:mysql_stats(), v1.9.8
Fact Sheet¶
Fact |
Value |
|---|---|
Check Plugin Download |
https://github.com/Linuxfabrik/monitoring-plugins/tree/main/check-plugins/mysql-open-files |
Nagios/Icinga Check Name |
|
Check Interval Recommendation |
Every 5 minutes |
Can be called without parameters |
Yes |
Runs on |
Cross-platform |
Compiled for Windows |
No |
3rd Party Python modules |
|
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 as a percentage of the configured
open_files_limit. Alerts when the usage rate approaches the limit.
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
MySQL/MariaDB cnf file to read user, host and password
from. Example: `--defaults-
file=/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 the number of open files exceeds 85% of
open_files_limit.--always-oksuppresses all alerts and always returns OK.
Perfdata / Metrics¶
Name |
Type |
Description |
|---|---|---|
mysql_open_files |
Number |
Number of regular files currently opened by the server. Does not include sockets or pipes. |
mysql_open_files_limit |
Number |
The number of file descriptors available to MySQL/MariaDB. |
mysql_pct_files_open |
Percentage |
Open_files / open_files_limit * 100 |
Credits, License¶
Authors: Linuxfabrik GmbH, Zurich
License: The Unlicense, see LICENSE file.
Credits:
heavily inspired by MySQLTuner (https://github.com/major/MySQLTuner-perl)