mirror of
https://github.com/YunoHost/monitor-ynh.git
synced 2024-09-03 20:06:24 +02:00
[enh] Add reminder about previous failure
This commit is contained in:
parent
d5367a54fa
commit
0d8bb37353
1 changed files with 11 additions and 5 deletions
16
monitor-ynh
16
monitor-ynh
|
@ -97,9 +97,9 @@ register_event () {
|
||||||
else
|
else
|
||||||
local count=$(redis-cli --raw incr $var_name)
|
local count=$(redis-cli --raw incr $var_name)
|
||||||
local nb_ignored=$2
|
local nb_ignored=$2
|
||||||
local reminder=$(( $count - $nb_ignore + 1 ))
|
#local reminder=$(( $count - $nb_ignore + 1 ))
|
||||||
#echo "[KO] ${@: -1}"
|
reminder "${@: -1}"
|
||||||
reminder="$(echo obase=2\;$reminder | bc | tail -c +2)0"
|
#reminder="$(echo obase=2\;$reminder | bc | tail -c +2)0"
|
||||||
if [ $count -eq $2 ]; then
|
if [ $count -eq $2 ]; then
|
||||||
alert " ${@: -1}"
|
alert " ${@: -1}"
|
||||||
#elif [ $count -gt $nb_ignore ] && [ $reminder -eq 0 ]; then
|
#elif [ $count -gt $nb_ignore ] && [ $reminder -eq 0 ]; then
|
||||||
|
@ -107,8 +107,14 @@ register_event () {
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
alert_msg=""
|
reminder_msg=""
|
||||||
newline=$'\n'
|
newline=$'\n'
|
||||||
|
# Add to reminder
|
||||||
|
# Usage: reminder ID_TEXT
|
||||||
|
reminder() {
|
||||||
|
reminder_msg="${reminder_msg}[KO] $1${newline}"
|
||||||
|
}
|
||||||
|
alert_msg=""
|
||||||
# Send on alert
|
# Send on alert
|
||||||
# Usage: alert ID_TEXT
|
# Usage: alert ID_TEXT
|
||||||
alert() {
|
alert() {
|
||||||
|
@ -178,5 +184,5 @@ check_content 2 https://install.labriqueinter.net/ 7c2a6659857dcddee846403bdb10b
|
||||||
check_200 2 https://wiki.labriqueinter.net/doku.php
|
check_200 2 https://wiki.labriqueinter.net/doku.php
|
||||||
|
|
||||||
if [[ ! -z "$alert_msg" ]]; then
|
if [[ ! -z "$alert_msg" ]]; then
|
||||||
echo "$alert_msg" | mail -s "[$PSEUDO-MONITOR] !!!" $MAIL &> /dev/null
|
echo "$alert_msg$newline$reminder_msg" | mail -s "[$PSEUDO-MONITOR] !!!" $MAIL &> /dev/null
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue