Skip to content

Commit 5df9ff3

Browse files
committed
* fix(valkey-status|redis-status): improve --ignore-thp (closes #898)
1 parent f41fe64 commit 5df9ff3

File tree

3 files changed

+20
-16
lines changed

3 files changed

+20
-16
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ Assets:
1313

1414
* deb-updates: apt-get returns with an error ([#904](https://github.com/Linuxfabrik/monitoring-plugins/issues/904))
1515

16+
Monitoring Plugins:
17+
18+
* fix(valkey-status|redis-status): improve `--ignore-thp` ([#898](https://github.com/Linuxfabrik/lib/issues/898))
19+
1620

1721
### Changed ("refactor", "chore" etc.)
1822

check-plugins/redis-status/redis-status

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ from lib.globals import (STATE_CRIT, STATE_OK, # pylint: disable=C0413
2424
STATE_UNKNOWN, STATE_WARN)
2525

2626
__author__ = 'Linuxfabrik GmbH, Zurich/Switzerland'
27-
__version__ = '2025021501'
27+
__version__ = '2025062901'
2828

2929
DESCRIPTION = """Returns information and statistics about a Redis server. Alerts on memory
3030
consumption, memory fragmentation, hit rates and more."""
@@ -336,15 +336,15 @@ def main():
336336
msg += ', '
337337

338338
# kernel transparent_hugepage is not set to "madvise" or "never"
339-
thp_enabled = lib.base.coe(lib.disk.read_file('/sys/kernel/mm/transparent_hugepage/enabled'))
340-
if '[always]' in thp_enabled:
341-
# on systems in which kernel transparent huge pages is set to "always",
342-
# redis might have latency problems specifically with fork(2) and CoW
343-
msg += 'kernel transparent_hugepage is not set to "madvise" or "never"'
344-
if not args.IGNORE_THP:
339+
if not args.IGNORE_THP:
340+
thp_enabled = lib.base.coe(lib.disk.read_file('/sys/kernel/mm/transparent_hugepage/enabled'))
341+
if '[always]' in thp_enabled:
342+
# on systems in which kernel transparent huge pages is set to "always",
343+
# redis might have latency problems specifically with fork(2) and CoW
344+
msg += 'kernel transparent_hugepage is not set to "madvise" or "never"'
345345
msg += lib.base.state2str(STATE_WARN, prefix=' ')
346346
state = lib.base.get_worst(state, STATE_WARN)
347-
msg += ', '
347+
msg += ', '
348348

349349
# net.core.somaxconn (128) is lower than net.ipv4.tcp_max_syn_backlog (256)
350350
somaxconn = lib.base.coe(lib.disk.read_file('/proc/sys/net/core/somaxconn'))

check-plugins/valkey-status/valkey-status

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ from lib.globals import (STATE_CRIT, STATE_OK, # pylint: disable=C0413
2424
STATE_UNKNOWN, STATE_WARN)
2525

2626
__author__ = 'Linuxfabrik GmbH, Zurich/Switzerland'
27-
__version__ = '2025053001'
27+
__version__ = '2025062901'
2828

2929
DESCRIPTION = """Returns information and statistics about a Valkey server. Alerts on memory
3030
consumption, memory fragmentation, hit rates and more."""
@@ -337,15 +337,15 @@ def main():
337337
msg += ', '
338338

339339
# kernel transparent_hugepage is not set to "madvise" or "never"
340-
thp_enabled = lib.base.coe(lib.disk.read_file('/sys/kernel/mm/transparent_hugepage/enabled'))
341-
if '[always]' in thp_enabled:
342-
# on systems in which kernel transparent huge pages is set to "always",
343-
# valkey might have latency problems specifically with fork(2) and CoW
344-
msg += 'kernel transparent_hugepage is not set to "madvise" or "never"'
345-
if not args.IGNORE_THP:
340+
if not args.IGNORE_THP:
341+
thp_enabled = lib.base.coe(lib.disk.read_file('/sys/kernel/mm/transparent_hugepage/enabled'))
342+
if '[always]' in thp_enabled:
343+
# on systems in which kernel transparent huge pages is set to "always",
344+
# valkey might have latency problems specifically with fork(2) and CoW
345+
msg += 'kernel transparent_hugepage is not set to "madvise" or "never"'
346346
msg += lib.base.state2str(STATE_WARN, prefix=' ')
347347
state = lib.base.get_worst(state, STATE_WARN)
348-
msg += ', '
348+
msg += ', '
349349

350350
# net.core.somaxconn (128) is lower than net.ipv4.tcp_max_syn_backlog (256)
351351
somaxconn = lib.base.coe(lib.disk.read_file('/proc/sys/net/core/somaxconn'))

0 commit comments

Comments
 (0)