Browse Source

redis: check maxmemory in NRPE check

If "maxmemory" is set and "maxmemory-policy" is missing or set to 
"noeviction" then we enforce the "maxmemory" limit
pull/119/head
Jérémy Lecour 11 months ago
committed by Jérémy Lecour
parent
commit
18ac1e7279
  1. 1
      CHANGELOG.md
  2. 10
      redis/files/check_redis_instances.sh

1
CHANGELOG.md

@ -18,6 +18,7 @@ The **patch** part changes incrementally at each release.
* mysql: install save_mysql_processlist script
* nextcloud: New role to setup a nextcloud instance
* redis: variable to force use of port 6379 in instances mode
* redis: check maxmemory in NRPE check
* lxc-php: Allow php containers to contact local MySQL with localhost
### Changed

10
redis/files/check_redis_instances.sh

@ -30,11 +30,21 @@ check_server() {
host=$(config_var "bind" "${conf_file}")
port=$(config_var "port" "${conf_file}")
pass=$(config_var "requirepass" "${conf_file}")
maxmemory=$(config_var "maxmemory" "${conf_file}")
maxmemory_policy=$(config_var "maxmemory-policy" "${conf_file}")
cmd="${check_bin} -H ${host} -p ${port}"
# If "requirepass" is set we add the password to the check
if [ -n "${pass}" ]; then
cmd="${cmd} -x ${pass}"
fi
# If "maxmemory" is set and "maxmemory-policy" is missing or set to "noeviction"
# then we enforce the "maxmemory" limit
if [ -n "${maxmemory}" ]; then
if [ -z "${maxmemory_policy}" ] || [ "${maxmemory_policy}" = "noeviction" ]; then
cmd="${cmd} --total_memory ${maxmemory} --memory_utilization 80,90"
fi
fi
result=$($cmd)
ret="${?}"
if [ "${ret}" -ge 2 ]; then

Loading…
Cancel
Save