beta
This commit is contained in:
@@ -442,7 +442,6 @@ STATUS_NODE(){
|
||||
fi
|
||||
if [ "${checkhost}" != "false" ] && [ "${checkhostssl}" == "ok" ]; then
|
||||
[ "${NODETYPE}" != "OFW" ] && cpu_usage=$(ssh -q -o ConnectTimeout=1 -o ConnectionAttempts=1 root@${nip} "/opt/idssys/defaults/get-data.sh cpu-usage") || cpu_usage=""
|
||||
|
||||
|
||||
if [ "${STATUS_ACTION}" != "check" ]; then
|
||||
if ([ "${STATUS_ACTION}" == "report" ] && [ "${2}" == "email" ]) || [ "${STATUS_ACTION}" != "report" ]; then
|
||||
@@ -475,6 +474,35 @@ STATUS_NODE(){
|
||||
rm -f ${NM_TMPFOLDER}/${nip}.*
|
||||
fi
|
||||
|
||||
if [ "${cpu_usage}" != "" ]; then
|
||||
if [ $(ROUND_NUMBER ${cpu_usage}) < 40 ]; then
|
||||
if [ -f ${NM_TMPFOLDER}/${nip}.cpu_usage.warn ] || [ -f ${NM_TMPFOLDER}/${nip}.cpu_usage.warn ]; then
|
||||
if [ ! -f ${NM_TMPFOLDER}/${nip}.cpu_usage.norm ]; then
|
||||
touch ${NM_TMPFOLDER}/${nip}.cpu_usage.norm
|
||||
elif [ $(expr $(date +%s) - $(stat -c %Y ${NM_TMPFOLDER}/${nip}.cpu_usage.norm)) -ge 180 ]; then
|
||||
SENDNOTICE "${NM_HOSTNAMES[${nip}]}[${nip}] NORMAL CPU USAGE" "${NM_HOSTNAMES[${nip}]}[${nip}] has returned to normal cpu usage: ${cpu_usage}%"
|
||||
rm -f ${NM_TMPFOLDER}/${nip}.cpu_usage.*
|
||||
fi
|
||||
fi
|
||||
elif [ $(ROUND_NUMBER ${cpu_usage}) < 80 ]; then
|
||||
[ -f ${NM_TMPFOLDER}/${nip}.cpu_usage.norm ] && rm -f ${NM_TMPFOLDER}/${nip}.cpu_usage.norm
|
||||
if [ ! -f ${NM_TMPFOLDER}/${nip}.cpu_usage.warn ]; then
|
||||
touch ${NM_TMPFOLDER}/${nip}.cpu_usage.warn
|
||||
elif [ $(expr $(date +%s) - $(stat -c %Y ${NM_TMPFOLDER}/${nip}.cpu_usage.warn)) -ge 180 ]; then
|
||||
SENDNOTICE "${NM_HOSTNAMES[${nip}]}[${nip}] WARNING HIGH CPU USAGE" "${NM_HOSTNAMES[${nip}]}[${nip}] has high cpu usage: ${cpu_usage}%"
|
||||
touch ${NM_TMPFOLDER}/${nip}.cpu_usage.warn
|
||||
fi
|
||||
else
|
||||
[ -f ${NM_TMPFOLDER}/${nip}.cpu_usage.norm ] && rm -f ${NM_TMPFOLDER}/${nip}.cpu_usage.norm
|
||||
if [ ! -f ${NM_TMPFOLDER}/${nip}.cpu_usage.crit ]; then
|
||||
touch ${NM_TMPFOLDER}/${nip}.cpu_usage.crit
|
||||
elif [ $(expr $(date +%s) - $(stat -c %Y ${NM_TMPFOLDER}/${nip}.cpu_usage.crit)) -ge 60 ]; then
|
||||
SENDNOTICE "${NM_HOSTNAMES[${nip}]}[${nip}] CRITICAL HIGH CPU USAGE" "${NM_HOSTNAMES[${nip}]}[${nip}] has CRITICALLY high cpu usage: ${cpu_usage}%" 1
|
||||
touch ${NM_TMPFOLDER}/${nip}.cpu_usage.crit
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
########################
|
||||
## SERVICES CHECK
|
||||
########################
|
||||
|
||||
Reference in New Issue
Block a user