Skip to content

Commit 08191f5

Browse files
committed
docs(mysql-table-cache): document why Table_open_cache_overflows is not tracked
Closes #968
1 parent fcd3a21 commit 08191f5

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ Monitoring Plugins:
9595
* file-ownership: `--filename` now merges with the default file list instead of replacing it; use `--no-default-files` to check only user-supplied files
9696
* file-ownership: extend default file list with CIS benchmark-relevant files (login.defs, sudoers, sysctl, systemd, PAM, etc.)
9797
* file-ownership: use `os.stat()` instead of shelling out to `stat`, improving performance and robustness
98+
* mysql-table-cache: document in the plugin README why `Table_open_cache_overflows` is intentionally not tracked (it is routine cache housekeeping, not a pass/fail signal) and link to the MariaDB KB for tuning guidance; the check logic itself is unchanged and remains in sync with MySQLTuner v2.8.38 ([#968](https://github.com/Linuxfabrik/monitoring-plugins/issues/968))
9899
* nextcloud-version: modernize code
99100
* php-status: always assume http://localhost/monitoring.php and, if not found, be tolerant
100101
* redis-status, valkey-status: modernize code and unify both plugins again after [PR #954](https://github.com/Linuxfabrik/monitoring-plugins/pull/954)

check-plugins/mysql-table-cache/README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@
33

44
## Overview
55

6-
Checks the hit rate for open table cache lookups in MySQL/MariaDB. A low hit rate indicates that `table_open_cache` may need to be increased. Logic is taken from [MySQLTuner script](https://github.com/major/MySQLTuner-perl):mysql_stats(), v1.9.8.
6+
Checks the hit rate for open table cache lookups in MySQL/MariaDB. A low hit rate indicates that `table_open_cache` may need to be increased. Logic is taken from [MySQLTuner](https://github.com/jmrenouard/MySQLTuner-perl):mysql_stats() and has been verified in sync with MySQLTuner v2.8.38.
77

88
**Important Notes:**
99

1010
* Requires MySQL/MariaDB v5.1+
1111
* See [additional notes for all mysql monitoring plugins](https://linuxfabrik.github.io/monitoring-plugins/plugins-mysql/)
12+
* `Table_open_cache_overflows` is intentionally not tracked. The MySQL reference manual describes it as "the number of times, after a table is opened or closed, a cache instance has an unused entry and the size of the instance is larger than `table_open_cache / table_open_cache_instances`" ([MySQL Server Status Variables](https://docs.oracle.com/cd/E17952_01/mysql-5.7-en/server-status-variables.html)). In other words, it is a routine cache-housekeeping counter that increments whenever MySQL temporarily extends a per-instance cache bucket above its allocated share, so a non-zero value is not by itself a problem. A [MySQL 5.6 benchmark by Dimitri Kravtchuk](https://planet.mysql.com/entry/?id=34237) shows healthy servers running with non-zero overflows for hours. The existing `table_cache_hit_rate < 20%` warn threshold already covers the "table_open_cache is too small" signal and matches the same heuristic MySQLTuner v2.8.38 still uses. See [MariaDB KB: Optimizing table_open_cache](https://mariadb.com/kb/en/library/optimizing-table_open_cache/) for further tuning guidance.
1213

1314
**Data Collection:**
1415

@@ -98,4 +99,4 @@ Output:
9899
* License: The Unlicense, see [LICENSE file](https://unlicense.org/).
99100
* Credits:
100101

101-
* heavily inspired by MySQLTuner (<https://github.com/major/MySQLTuner-perl>)
102+
* heavily inspired by MySQLTuner (<https://github.com/jmrenouard/MySQLTuner-perl>)

check-plugins/mysql-table-cache/mysql-table-cache

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import lib.human
2020
from lib.globals import STATE_OK, STATE_UNKNOWN, STATE_WARN
2121

2222
__author__ = 'Linuxfabrik GmbH, Zurich/Switzerland'
23-
__version__ = '2026040801'
23+
__version__ = '2026041401'
2424

2525
DESCRIPTION = """Checks the hit rate for open table cache lookups in MySQL/MariaDB. A low hit rate
2626
indicates that table_open_cache may need to be increased.
@@ -109,8 +109,13 @@ def get_status(conn):
109109
def main():
110110
"""The main function. This is where the magic happens."""
111111

112-
# logic taken from mysqltuner.pl:mysql_stats(), section # Table cache, v1.9.8
113-
# including variable names
112+
# logic taken from mysqltuner.pl:mysql_stats(), section # Table cache,
113+
# verified in sync with MySQLTuner v2.8.38 (the hit-rate formula, the
114+
# `Opened_tables > 0` calc guard, the `Open_tables > 0` check guard,
115+
# the `< 20%` warn threshold and the "Increase table_open_cache
116+
# gradually" / "open_files_limit must be greater than
117+
# table_open_cache" recommendation are unchanged upstream since the
118+
# original port).
114119

115120
# parse the command line, exit with UNKNOWN if it fails
116121
try:

0 commit comments

Comments
 (0)