monit issueshttps://gitserver.mba.ac.uk/docker/monit/-/issues2019-03-21T15:43:49+00:00https://gitserver.mba.ac.uk/docker/monit/-/issues/2Add check for correct content of MBA web page2019-03-21T15:43:49+00:00Derek Broughtonderbro@mba.ac.ukAdd check for correct content of MBA web pageThe www.mba.ac.uk page will return a "200 OK" response even when PHP complains about not enough connections, so we need to test for actual content.
From https://www.linuxjournal.com/content/bare-bones-monitoring-monit-and-rrdtool:
```
ch...The www.mba.ac.uk page will return a "200 OK" response even when PHP complains about not enough connections, so we need to test for actual content.
From https://www.linuxjournal.com/content/bare-bones-monitoring-monit-and-rrdtool:
```
check host linuxjournal-website with address www.linuxjournal.com
if failed
port 443 protocol https
with request / with content = "Become a Patron"
then alert
```
@dbleDerek Broughtonderbro@mba.ac.ukDerek Broughtonderbro@mba.ac.ukhttps://gitserver.mba.ac.uk/docker/monit/-/issues/1Check for expiring SSL certificates2019-03-21T15:42:13+00:00Derek Broughtonderbro@mba.ac.ukCheck for expiring SSL certificatesFrom https://www.linuxjournal.com/content/bare-bones-monitoring-monit-and-rrdtool:
*"Here's an example of a script that alerts when an SSL certificate expiration date is within a specified number of days:"*
```
#!/bin/bash
domainexpire...From https://www.linuxjournal.com/content/bare-bones-monitoring-monit-and-rrdtool:
*"Here's an example of a script that alerts when an SSL certificate expiration date is within a specified number of days:"*
```
#!/bin/bash
domainexpiredate() {
openssl x509 -text -in <(echo -n | \
openssl s_client -connect $1:$2 2>/dev/null | \
sed -n '/-*BEGIN/,/-*END/p') 2>/dev/null | sed -n 's/
↪*Not After : *//p'
}
daysleft() {
echo "((($(date -d "$(domainexpiredate $1 $2)" +%s)-$(date
↪+%s))/24)/60)/60" | bc
}
defaultport() {
if [ -z "$1" ]; then
echo "443"
else
echo "$1"
fi
}
[[ $(daysleft $2 $(defaultport $3)) -le $1 ]] && exit 1 ||
↪exit 0
```Derek Broughtonderbro@mba.ac.ukDerek Broughtonderbro@mba.ac.uk