From 2e9e6dd66bff5a977372e8675b2f22db9e498c81 Mon Sep 17 00:00:00 2001 From: "Hahn Axel (hahn)" <axel.hahn@iml.unibe.ch> Date: Thu, 24 Jun 2021 15:44:25 +0200 Subject: [PATCH] mysql: check if query cache is enabled as a shared function --- check_mysqlserver | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/check_mysqlserver b/check_mysqlserver index 5a9912d..a6d58b2 100755 --- a/check_mysqlserver +++ b/check_mysqlserver @@ -187,10 +187,19 @@ function _mysqlrenderdelta() { } # helper function for caching checks -# The function aborts the check +# The function aborts the check ending with OK. function _verify_cache(){ - _mysqlgetvar "have_query_cache" | grep "YES" >/dev/null || ph.abort "Query cache (have_query_cache) is not active" - _mysqlgetvar "query_cache_type" | grep "OFF" >/dev/null && ph.abort "Query cache (have_query_cache) is active but query_cache_type is OFF" + local bCacheEnabled= + _mysqlgetvar "have_query_cache" | grep "YES" >/dev/null + if [ $? -ne 0 ]; then + _mysqlgetvar "query_cache_type" | grep "OFF" >/dev/null + if [ $? -eq 0 ]; then + echo "INFO: Query cache (have_query_cache) is active but query_cache_type is OFF." + else + echo "INFO: Query cache (have_query_cache) is not active." + fi + ph.exit + fi } # ---------------------------------------------------------------------- # MAIN -- GitLab