forked from evolix/ansible-roles
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
This commit is contained in:
parent
ae07d508cf
commit
18ac1e7279
|
@ -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
|
||||
|
|
|
@ -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…
Reference in a new issue