move config to uptimeatomic.conf
This commit is contained in:
parent
dc7ffa7fa4
commit
d8d124d664
|
@ -1,2 +1,3 @@
|
||||||
high5*
|
high5*
|
||||||
obsdams*
|
obsdams*
|
||||||
|
uptimeatomic.conf
|
||||||
|
|
|
@ -23,7 +23,7 @@ An example site is available [here](https://ops.lowfive.nl/)
|
||||||
To install uptimeatomic:
|
To install uptimeatomic:
|
||||||
|
|
||||||
* Clone the repository and go to the created directory
|
* Clone the repository and go to the created directory
|
||||||
* Edit `uptimeatomic` variables to your liking
|
* Edit `uptimeatomic.conf` variables to your liking
|
||||||
* Edit the checks file `checks.csv`
|
* Edit the checks file `checks.csv`
|
||||||
* To add incidents or maintenance, edit `incidents.txt`
|
* To add incidents or maintenance, edit `incidents.txt`
|
||||||
* To add past incidents or maintenance, edit `pastincidents.txt`
|
* To add past incidents or maintenance, edit `pastincidents.txt`
|
||||||
|
|
48
uptimeatomic
48
uptimeatomic
|
@ -5,25 +5,8 @@
|
||||||
#
|
#
|
||||||
export PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
|
export PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
|
||||||
|
|
||||||
CHECKFILE="checks.csv"
|
CONFIGFILE="uptimeatomic.conf"
|
||||||
HEADER="Global Status"
|
WORKDIR="/home/mischa/uptimeatomic"
|
||||||
HTMLDIR="/var/www/htdocs/default"
|
|
||||||
HTMLFILE="index.html"
|
|
||||||
INCIDENTSFILE="incidents.txt"
|
|
||||||
PASTINCIDENTSFILE="pastincidents.txt"
|
|
||||||
PUSHOVER="/home/mischa/bin/pushover.pl"
|
|
||||||
PUSHOVER_CONF="/home/mischa/_pushover.conf"
|
|
||||||
PUSHOVER_STATUS="status"
|
|
||||||
RECIPIENT="alerts@high5.nl"
|
|
||||||
REFRESH=60
|
|
||||||
RSS_DESCRIPTION="Incidents and Maintenance Updates"
|
|
||||||
RSS_FILE=""
|
|
||||||
RSS_URL="https://ops.lowfive.nl"
|
|
||||||
SENDER="uptimeatomic@high5.nl"
|
|
||||||
TIMEOUT=10
|
|
||||||
TITLE="Uptime Atomic - OpenBSD Amsterdam"
|
|
||||||
USERAGENT="User-Agent: Mozilla/5.0 (OpenBSD; Intel OpenBSD 7.4; rv:109.0) Gecko/20100101 Firefox/113.0"
|
|
||||||
WORKDIR=/home/mischa/uptimeatomic
|
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
echo "usage: ${0##*/} [-c checksfile] [-i incidentsfile] [-p pastincidentsfile] [-o htmlfile]" 1>&2
|
echo "usage: ${0##*/} [-c checksfile] [-i incidentsfile] [-p pastincidentsfile] [-o htmlfile]" 1>&2
|
||||||
|
@ -135,27 +118,27 @@ check() {
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
process_health() {
|
process_status() {
|
||||||
_health=${1}
|
_status_files=${1}
|
||||||
|
|
||||||
ls ${_TMP}/${_health}/*.status 2>/dev/null | sort -V | while read file; do
|
ls ${_TMP}/${_status_files}/*.status 2>/dev/null | sort -V | while read file; do
|
||||||
[ -e "${file}" ] || continue
|
[ -e "${file}" ] || continue
|
||||||
_name="$(basename "${file%.status}")"
|
_name="$(basename "${file%.status}")"
|
||||||
_status="$(cat "${file}")"
|
_status="$(cat "${file}")"
|
||||||
|
|
||||||
if [ ${_health} == "ko" ]; then
|
if [ ${_status_files} == "ko" ]; then
|
||||||
echo "<li>${_name} <span class='small failed'>(${_status})</span><span class='status failed'>Disrupted</span></li>" >> ${_HTMLFILE}
|
echo "<li>${_name} <span class='small failed'>(${_status})</span><span class='status failed'>Disrupted</span></li>" >> ${_HTMLFILE}
|
||||||
if [ ! -e "${PUSHOVER_STATUS}/${_name}" ]; then
|
if [ ! -e "${PUSHOVER_STATUS}/${_name}" ]; then
|
||||||
notify "${_name}" "${status}" "${_health}"
|
notify "${_name}" "${status}" "${_status_files}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [ ${_health} == "maint" ]; then
|
if [ ${_status_files} == "maint" ]; then
|
||||||
echo "<li>${_name} <span class='status maint'>Maintenance</span></li>" >> ${_HTMLFILE}
|
echo "<li>${_name} <span class='status maint'>Maintenance</span></li>" >> ${_HTMLFILE}
|
||||||
fi
|
fi
|
||||||
if [ ${_health} == "ok" ]; then
|
if [ ${_status_files} == "ok" ]; then
|
||||||
echo "<li>${_name} <span class='status success'>Operational</span></li>" >> ${_HTMLFILE}
|
echo "<li>${_name} <span class='status success'>Operational</span></li>" >> ${_HTMLFILE}
|
||||||
if [ -e "${PUSHOVER_STATUS}/${_name}" ]; then
|
if [ -e "${PUSHOVER_STATUS}/${_name}" ]; then
|
||||||
notify "${_name}" "${_status}" "${_health}"
|
notify "${_name}" "${_status}" "${_status_files}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
@ -191,11 +174,16 @@ while getopts c:i:o:r:h arg; do
|
||||||
done
|
done
|
||||||
|
|
||||||
cd ${WORKDIR}
|
cd ${WORKDIR}
|
||||||
|
if [ ! -e "${CONFIGFILE}" ]; then
|
||||||
|
echo "Configfile ${WORKDIR}/${CONFIGFILE} doesn't exist."
|
||||||
|
exit
|
||||||
|
fi
|
||||||
if [ ! -e "${CHECKFILE}" ]; then
|
if [ ! -e "${CHECKFILE}" ]; then
|
||||||
echo "Checkfile ${WORKDIR}/${CHECKFILE} doesn't exist."
|
echo "Checkfile ${WORKDIR}/${CHECKFILE} doesn't exist."
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
. ${WORKDIR}/${CONFIGFILE}
|
||||||
_TMP="$(mktemp -d)"
|
_TMP="$(mktemp -d)"
|
||||||
mkdir -p "${_TMP}/ok" "${_TMP}/ko" "${_TMP}/maint" || exit 1
|
mkdir -p "${_TMP}/ok" "${_TMP}/ko" "${_TMP}/maint" || exit 1
|
||||||
_HTMLFILE="${_TMP}/${HTMLFILE}"
|
_HTMLFILE="${_TMP}/${HTMLFILE}"
|
||||||
|
@ -271,9 +259,9 @@ fi
|
||||||
echo "<h1>Services</h1>" >> ${_HTMLFILE}
|
echo "<h1>Services</h1>" >> ${_HTMLFILE}
|
||||||
echo "<ul>" >> ${_HTMLFILE}
|
echo "<ul>" >> ${_HTMLFILE}
|
||||||
|
|
||||||
process_health "ko"
|
process_status "ko"
|
||||||
process_health "maint"
|
process_status "maint"
|
||||||
process_health "ok"
|
process_status "ok"
|
||||||
|
|
||||||
echo "</ul>" >> ${_HTMLFILE}
|
echo "</ul>" >> ${_HTMLFILE}
|
||||||
echo "<p class=small>Last check: $(date -u '+%FT%T %Z')</p>" >> ${_HTMLFILE}
|
echo "<p class=small>Last check: $(date -u '+%FT%T %Z')</p>" >> ${_HTMLFILE}
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
CHECKFILE="checks.csv"
|
||||||
|
HEADER="Global Status"
|
||||||
|
HTMLDIR="/var/www/htdocs/default"
|
||||||
|
HTMLFILE="index.html"
|
||||||
|
INCIDENTSFILE="incidents.txt"
|
||||||
|
PASTINCIDENTSFILE="pastincidents.txt"
|
||||||
|
PUSHOVER="/home/root/bin/pushover.pl"
|
||||||
|
PUSHOVER_CONF="/home/root/_pushover.conf"
|
||||||
|
PUSHOVER_STATUS="status"
|
||||||
|
RECIPIENT="alerts@example.com"
|
||||||
|
REFRESH=60
|
||||||
|
RSS_DESCRIPTION="Incidents and Maintenance Updates"
|
||||||
|
RSS_FILE=""
|
||||||
|
RSS_URL="https://ops.example.com"
|
||||||
|
SENDER="uptimeatomic@example.com"
|
||||||
|
TIMEOUT=10
|
||||||
|
TITLE="Uptime Atomic"
|
||||||
|
USERAGENT="User-Agent: Mozilla/5.0 (OpenBSD; Intel OpenBSD 7.4; rv:109.0) Gecko/20100101 Firefox/113.0"
|
Loading…
Reference in New Issue