diff --git a/monitor-ynh b/monitor-ynh index 2bf5ab9..fee5119 100644 --- a/monitor-ynh +++ b/monitor-ynh @@ -1,8 +1,6 @@ #!/bin/bash -# Email of each admin -# MAIL="admin1@example.tld admin2@example.tld" -MAIL="" +MAIL="root@yunohost.org org+monitor-ynh@grimaud.me" #============================================================================== # Monitoring code @@ -18,7 +16,7 @@ check_content () { hash="$(curl -$1 -s $3 | md5sum | cut -d ' ' -f1)" [ "$hash" == "$4" ] register_event $? $2 "${FUNCNAME[0]} $*" "[ipv$1] Content of $3 has changed" - sleep 3s + sleep 2s fi } @@ -45,7 +43,7 @@ check_200 () { else [ "$(curl -$1 -s -I -w '%{http_code}' -o /dev/null $3)" == "200" ] register_event $? $2 "${FUNCNAME[0]} $*" "[ipv$1] $3 call fails" - sleep 3s + sleep 2s fi } @@ -56,8 +54,13 @@ check_ping () { check_ping 4 $@ check_ping 6 $@ else - ping -$1 -c 1 $3 > /dev/null - register_event $? $2 "${FUNCNAME[0]} $*" "[ipv$1] $3 no ping" + if [ "$1" -eq "4" ]; then + ping -c 1 $3 > /dev/null + register_event $? $2 "${FUNCNAME[0]} $*" "[ipv$1] $3 no ping" + else + ping6 -c 1 $3 > /dev/null + register_event $? $2 "${FUNCNAME[0]} $*" "[ipv$1] $3 no ping" + fi fi } @@ -85,11 +88,12 @@ register_event () { local count=$(redis-cli --raw incr $var_name) local nb_ignored=$2 local reminder=$(( $count - $nb_ignore + 1 )) + echo "[KO] ${@: -1}" reminder="$(echo obase=2\;$reminder | bc | tail -c +2)0" if [ $count -eq $2 ]; then alert " ${@: -1}" - elif [ $count -gt $nb_ignore ] && [ $reminder -eq 0 ]; then - alert "[Reminder] ${@: -1}" + #elif [ $count -gt $nb_ignore ] && [ $reminder -eq 0 ]; then + # alert "[Reminder] ${@: -1}" fi fi } @@ -97,16 +101,19 @@ register_event () { # Send on alert # Usage: alert ID_TEXT alert() { + echo "[mail] $1" echo "$1" | mail -s "[ljf-MONITOR]$1" $MAIL &> /dev/null } -ping -c 1 9.8.9.8 > /dev/null || dig +short A wikipedia.fr > /dev/null || exit 1 +#ping -c 1 9.9.9.9 > /dev/null || dig +short A wikipedia.fr > /dev/null || exit 1 #============================================================================== # Configuration #============================================================================== + # Check All server ping check_ping 2 bearnaise.yunohost.org +check_ping 2 samurai.yunohost.org check_ping 2 aioli.yunohost.org check_ping 2 demo.yunohost.org check_ping 2 forum.yunohost.org @@ -115,8 +122,8 @@ check_ping 2 forum.yunohost.org # Check critic services (needed for yunohost instances works correctly) check_dig 2 ns0.yunohost.org toto.noho.st 81.57.118.36 check_dig 2 ns0.yunohost.org toto.nohost.me 162.243.7.71 -#check_dig 2 ns1.yunohost.org toto.noho.st 81.57.118.36 -#check_dig 2 ns1.yunohost.org toto.nohost.me 162.243.7.71 +check_dig 2 ns1.yunohost.org toto.noho.st 81.57.118.36 +check_dig 2 ns1.yunohost.org toto.nohost.me 162.243.7.71 check_content 2 https://repo.yunohost.org/ 1477866e988c7180d486afec7bd4341c check_content 2 https://dyndns.yunohost.org/ c9b426d468e2145a212032c16bebc26f check_content 4 2 https://ip.yunohost.org/ 32453f31e928721f8c272c6dda5f86e6 @@ -125,39 +132,40 @@ check_content 6 2 https://ipv6.yunohost.org/ 0340bdddba91963e24f153adaf3c4570 check_200 2 https://app.yunohost.org/official.json check_200 2 https://app.yunohost.org/community.json check_200 2 https://app.yunohost.org/list.json +check_200 2 http://forge.yunohost.org/ # Check for install resources check_content 2 https://install-app.yunohost.org/ b215745d9fdd5302d2b1f95083d74604 -check_content 2 https://paste.yunohost.org/ 6d6f3a20399719cd0cfbd4f165de076c +check_content 2 https://paste.yunohost.org/ ef72468ae6b07f66b3e1ff69bb73f074 check_200 2 https://install.yunohost.org/ -check_content 2 https://install.yunohost.org/install_yunohost 4c53314cd822fff7423821e08f0c850d -check_content 2 https://build.yunohost.org/ 207d7c46e03352d98dd533fe38f9bb4c -check_content 2 https://build.yunohost.org/yunohost-jessie-201701261126-sdraspi-stable.zip.sum cf2e8d4c40fbee7bb57ac4541751e989 -check_content 2 https://build.yunohost.org/yunohost-jessie-0127171259-amd64-stable.iso.sum 6d07211e77e4051b880925719d8bb314 -check_content 2 https://build.yunohost.org/yunohost-jessie-0127171609-i386-stable.iso.sum 2bebadec817843b942a5bf4a7b7b8c7e +#check_content 2 https://install.yunohost.org/ 4c53314cd822fff7423821e08f0c850d +#check_content 2 https://build.yunohost.org/ 207d7c46e03352d98dd533fe38f9bb4c +#check_content 2 https://build.yunohost.org/yunohost-jessie-201701261126-sdraspi-stable.zip.sum cf2e8d4c40fbee7bb57ac4541751e989 +#check_content 2 https://build.yunohost.org/yunohost-jessie-0127171259-amd64-stable.iso.sum 6d07211e77e4051b880925719d8bb314 +#check_content 2 https://build.yunohost.org/yunohost-jessie-0127171609-i386-stable.iso.sum 2bebadec817843b942a5bf4a7b7b8c7e # Check for public website, support tools check_200 2 https://forum.yunohost.org/ check_200 2 https://yunohost.org/ -check_content 2 https://www.yunohost.org/ a718c83022dda2cc03813d97ea9f3a9a +check_200 2 https://www.yunohost.org/ check_content 2 https://ports.yunohost.org/ ffc3113a26780253c9f005523dc39fc8 check_content 2 https://im.yunohost.org/logs/ 4b0a139edf5c86f2e0e5f5b915082a0d check_content 2 https://chat.yunohost.org/ feafc193207604dc21bd20ca2077a7ce -#check_content 2 https://demo.yunohost.org/yunohost/sso/ c4cb70333b081ebef35ab2d32e941d9e +check_200 4 https://demo.yunohost.org/yunohost/sso/ # Check for contribution tools #check_200 2 https://dev.yunohost.org/ -check_200 2 http://vinaigrette.yunohost.org/ check_200 2 https://dash.yunohost.org/ -check_200 2 https://ci-apps.yunohost.org/jenkins/ +check_200 2 https://ci-apps.yunohost.org/ #check_200 2 https://ci-core.yunohost.org/ -check_content 2 https://list.yunohost.org/listinfo d1f6166e91acbbb75dbee8f6db472e4d -check_200 2 https://wekan.yunohost.org/b/ufMZHMyRpfCqssFY5/yunohost +check_200 2 https://ci-apps-arm.yunohost.org/ check_200 2 https://translate.yunohost.org/ # Check for internetcube services check_200 2 https://repo.internetcu.be/ check_200 2 https://labriqueinter.net/ check_200 2 https://repo.labriqueinter.net/ -check_content 2 https://install.labriqueinter.net/ 8535d71123c772afaf708de02ce97d30 +check_content 2 https://install.labriqueinter.net/ 7c2a6659857dcddee846403bdb10b7fe check_200 2 https://wiki.labriqueinter.net/doku.php + +