Initial commit
We had a cheap and nasty script that could only dump a message onto a pts terminal. We have now partially set up to more sensibly send email instead.main
commit
6218e8534d
|
@ -0,0 +1,7 @@
|
||||||
|
Subject: [AUTOMATION TEST MAIL] [URGENT] Server Report
|
||||||
|
Priority: urgent
|
||||||
|
Importance: high
|
||||||
|
|
||||||
|
Status ${STATUS} detected on ${SERVER} server.
|
||||||
|
|
||||||
|
- OMN Watchdog
|
|
@ -0,0 +1,29 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#set -eux
|
||||||
|
|
||||||
|
BLUE='\e[1;38;5;33m'
|
||||||
|
GREEN='\e[0;38;5;64m'
|
||||||
|
ORANGE='\e[0;38;5;166m'
|
||||||
|
RED='\e[0;38;5;160m'
|
||||||
|
ITALIC='\e[1;3m'
|
||||||
|
RESET='\e[0m'
|
||||||
|
|
||||||
|
GITEA_STATUS="$(curl -s -o /dev/null -w "%{http_code}%{stdout}" https://unite.openworlds.info/)"
|
||||||
|
|
||||||
|
#GITEA_STATUS=$(echo ${CURL_RESULT} | grep HTTP | sed -E 's/HTTP\/[0-9]\.[0-9]\s([0-9]{3})\s/\1/')
|
||||||
|
|
||||||
|
send_mail() {
|
||||||
|
SERVER=$1
|
||||||
|
STATUS=$2
|
||||||
|
cat mail_template \
|
||||||
|
| sed "s/\${SERVER}/${SERVER}/g" \
|
||||||
|
| sed "s/\${STATUS}/${STATUS}/g" \
|
||||||
|
| msmtp -a omn_server_watch saunders@openworlds.info
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ "$GITEA_STATUS" -ne "200" ]; then
|
||||||
|
echo -e "[omn]${GREEN}gitea server: ${RED}error $GITEA_STATUS${RESET}" | tee /dev/pts/0
|
||||||
|
send_mail "GITEA" "${GITEA_STATUS}"
|
||||||
|
fi
|
||||||
|
send_mail "GITEA" "${GITEA_STATUS}"
|
Loading…
Reference in New Issue