add option for past incidents at the bottom of the page
This commit is contained in:
parent
74d31c0f73
commit
d458e344ef
26
tinystatus
26
tinystatus
|
@ -7,10 +7,12 @@ HEADER="Global Status"
|
||||||
HTMLDIR="/var/www/htdocs/default"
|
HTMLDIR="/var/www/htdocs/default"
|
||||||
HTMLFILE="index.html"
|
HTMLFILE="index.html"
|
||||||
INCIDENTSFILE="incidents.txt"
|
INCIDENTSFILE="incidents.txt"
|
||||||
|
PASTINCIDENTSFILE="pastincidents.txt"
|
||||||
PUSHOVER="/home/mischa/bin/pushover.pl"
|
PUSHOVER="/home/mischa/bin/pushover.pl"
|
||||||
PUSHOVER_CONF="/home/mischa/_pushover.conf"
|
PUSHOVER_CONF="/home/mischa/_pushover.conf"
|
||||||
PUSHOVER_STATUS="status"
|
PUSHOVER_STATUS="status"
|
||||||
RECIPIENT="alerts@high5.nl"
|
RECIPIENT="alerts@high5.nl"
|
||||||
|
REFRESH=60
|
||||||
SENDER="tinystatus@high5.nl"
|
SENDER="tinystatus@high5.nl"
|
||||||
TIMEOUT=10
|
TIMEOUT=10
|
||||||
TITLE="Tiny Status"
|
TITLE="Tiny Status"
|
||||||
|
@ -18,7 +20,7 @@ USERAGENT="User-Agent: Mozilla/5.0 (OpenBSD; Intel OpenBSD 7.4; rv:109.0) Gecko/
|
||||||
WORKDIR=/home/mischa/tinystatus
|
WORKDIR=/home/mischa/tinystatus
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
echo "usage: ${0##*/} [-c checksfile] [-i incidentsfile] [-o htmlfile]" 1>&2
|
echo "usage: ${0##*/} [-c checksfile] [-i incidentsfile] [-p pastincidentsfile] [-o htmlfile]" 1>&2
|
||||||
exit
|
exit
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,6 +96,7 @@ while getopts c:i:o:h arg; do
|
||||||
case ${arg} in
|
case ${arg} in
|
||||||
c) CHECKFILE=${OPTARG};;
|
c) CHECKFILE=${OPTARG};;
|
||||||
i) INCIDENTSFILE=${OPTARG};;
|
i) INCIDENTSFILE=${OPTARG};;
|
||||||
|
p) PASTINCIDENTSFILE=${OPTARG};;
|
||||||
o) HTMLFILE=${OPTARG};;
|
o) HTMLFILE=${OPTARG};;
|
||||||
h) usage;;
|
h) usage;;
|
||||||
*) usage;;
|
*) usage;;
|
||||||
|
@ -120,7 +123,14 @@ done < "${CHECKFILE}"
|
||||||
wait
|
wait
|
||||||
|
|
||||||
cat << EOF >> ${_htmlfile}
|
cat << EOF >> ${_htmlfile}
|
||||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><title>${TITLE}</title><style>
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta http-equiv="refresh" content="${REFRESH}">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||||
|
<title>${TITLE}</title>
|
||||||
|
<style>
|
||||||
body { font-family: segoe ui,Roboto,Oxygen-Sans,Ubuntu,Cantarell,helvetica neue,Verdana,sans-serif; }
|
body { font-family: segoe ui,Roboto,Oxygen-Sans,Ubuntu,Cantarell,helvetica neue,Verdana,sans-serif; }
|
||||||
h1 { margin-top: 30px; }
|
h1 { margin-top: 30px; }
|
||||||
ul { padding: 0px; }
|
ul { padding: 0px; }
|
||||||
|
@ -135,7 +145,8 @@ li { list-style: none; margin-bottom: 2px; padding: 5px; border-bottom: 1px soli
|
||||||
.maint { color: #5DADE2; }
|
.maint { color: #5DADE2; }
|
||||||
.small { font-size: 80%; }
|
.small { font-size: 80%; }
|
||||||
.status { float: right; }
|
.status { float: right; }
|
||||||
</style></head>
|
</style>
|
||||||
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class='container'>
|
<div class='container'>
|
||||||
<h1>${HEADER}</h1>
|
<h1>${HEADER}</h1>
|
||||||
|
@ -189,8 +200,15 @@ done
|
||||||
cat << EOF >> ${_htmlfile}
|
cat << EOF >> ${_htmlfile}
|
||||||
</ul>
|
</ul>
|
||||||
<p class=small> Last check: $(date +%FT%T%z) <a href="https://git.high5.nl/tinystatus/">Tinystatus</a> loosely based on <a href="https://github.com/bderenzo/tinystatus">Tinystatus</a></p>
|
<p class=small> Last check: $(date +%FT%T%z) <a href="https://git.high5.nl/tinystatus/">Tinystatus</a> loosely based on <a href="https://github.com/bderenzo/tinystatus">Tinystatus</a></p>
|
||||||
|
EOF
|
||||||
|
if [ -s "${PASTINCIDENTSFILE}" ]; then
|
||||||
|
echo '<h1>Past Incidents</h1>' >> ${_htmlfile}
|
||||||
|
sed 's|^\(.*\)$|<p>\1</p>|' "${PASTINCIDENTSFILE}" >> ${_htmlfile}
|
||||||
|
fi
|
||||||
|
cat << EOF >> ${_htmlfile}
|
||||||
</div>
|
</div>
|
||||||
</body></html>
|
</body>
|
||||||
|
</html>
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
cp ${_htmlfile} ${HTMLDIR}/${HTMLFILE}
|
cp ${_htmlfile} ${HTMLDIR}/${HTMLFILE}
|
||||||
|
|
Loading…
Reference in New Issue