Add health check email notifications
This commit is contained in:
parent
6de11f09db
commit
fc33ec11cb
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "reminder-rs"
|
||||
version = "1.6.17-1"
|
||||
version = "1.6.18"
|
||||
authors = ["Jude Southworth <judesouthworth@pm.me>"]
|
||||
edition = "2021"
|
||||
license = "AGPL-3.0 only"
|
||||
@ -44,6 +44,8 @@ assets = [
|
||||
["conf/Rocket.toml", "etc/reminder-rs/Rocket.toml", "600"],
|
||||
["web/static/**/*", "lib/reminder-rs/static", "644"],
|
||||
["web/templates/**/*", "lib/reminder-rs/templates", "644"],
|
||||
["healthcheck", "lib/reminder-rs/healthcheck", "755"],
|
||||
["cron.d/reminder_health", "etc/cron.d", "644"],
|
||||
# ["nginx/reminder-rs", "etc/nginx/sites-available/reminder-rs", "755"]
|
||||
]
|
||||
conf-files = [
|
||||
|
@ -14,3 +14,5 @@ REMIND_INTERVAL=
|
||||
OAUTH2_DISCORD_CALLBACK=
|
||||
OAUTH2_CLIENT_ID=
|
||||
OAUTH2_CLIENT_SECRET=
|
||||
|
||||
REPORT_EMAIL=
|
||||
|
1
cron.d/reminder_health
Normal file
1
cron.d/reminder_health
Normal file
@ -0,0 +1 @@
|
||||
*/10 * * * * reminders /lib/reminder-rs/healthcheck
|
10
healthcheck
Executable file
10
healthcheck
Executable file
@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
|
||||
export $(grep -v '^#' /etc/reminder-rs/config.env | xargs -d '\n')
|
||||
|
||||
VAR=$(mysql -N -D reminders -e "SELECT COUNT(1) FROM reminders WHERE utc_time < NOW() - INTERVAL 10 MINUTE AND enabled = 1")
|
||||
|
||||
if [ "$VAR" -gt 0 ]
|
||||
then
|
||||
echo "This is to inform that there is a reminder backlog which must be resolved." | mail -s "Backlog: $VAR" "$REPORT_EMAIL"
|
||||
fi
|
Loading…
Reference in New Issue
Block a user