Whitespace cleanup to get in sync with AniNIX/Uniglot hooks
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
## performed should a test fail.
|
||||
check system $HOST
|
||||
if loadavg (1min) per core > 2 for 25 times within 30 cycles then exec "/etc/monit.d/scripts/critical Load average is high"
|
||||
if memory usage > 75% for 8 times within 10 cycles then exec "/etc/monit.d/scripts/critical Memory is overused."
|
||||
if memory usage > 90% for 8 times within 10 cycles then exec "/etc/monit.d/scripts/critical Memory is overused."
|
||||
if swap usage > 25% for 8 times within 10 cycles then exec "/etc/monit.d/scripts/critical Swap is overused."
|
||||
group system
|
||||
#
|
||||
|
2
roles/Sharingan/files/monit/checks/warrant-canary
Normal file
2
roles/Sharingan/files/monit/checks/warrant-canary
Normal file
@@ -0,0 +1,2 @@
|
||||
check program warrant_canary with path "/etc/monit.d/scripts/check-warrant-canary"
|
||||
if status != 0 then exec "/etc/monit.d/scripts/critical Warrant Canary needs to be updated"
|
@@ -1 +1,2 @@
|
||||
include "/etc/monit.d/checks/system"
|
||||
include "/etc/monit.d/checks/warrant-canary"
|
||||
|
27
roles/Sharingan/files/monit/scripts/check-warrant-canary
Executable file
27
roles/Sharingan/files/monit/scripts/check-warrant-canary
Executable file
@@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
|
||||
daysinadvance=14
|
||||
url=https://aninix.net/AniNIX/WarrantCanary/raw/branch/main/canary
|
||||
|
||||
# ID the update expected date
|
||||
canarydate="$(curl -s "$url" | grep -A 1 'next two updates' | tail -n 1 | sed 's/^..//' )"
|
||||
if [ -z "$canarydate" ]; then
|
||||
echo "Cannot identify the canary's next time."
|
||||
exit 2
|
||||
fi
|
||||
epochcanarydate="$(date -d "$canarydate" +%s)"
|
||||
|
||||
# Remove a one-month padding
|
||||
updatecanarydate=$(( $epochcanarydate - 2592000 ))
|
||||
|
||||
# ID today
|
||||
today="$(date +%s)"
|
||||
|
||||
|
||||
if [[ $today -gt $updatecanarydate ]]; then
|
||||
echo Time to reseed the warrant canary.
|
||||
exit 2
|
||||
else
|
||||
echo Warrant canary seems to have the right time.
|
||||
exit 0
|
||||
fi
|
Reference in New Issue
Block a user