Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ tinystatus generate an html status page via shell script.
## Features

* Parallel checks
* HTTP, ping, port checks
* HTTP, ping, port, dns checks
* HTTP expected status code (401, ...)
* Minimal dependencies (curl, nc and coreutils)
* Minimal dependencies (curl, nc, dig and coreutils)
* Easy configuration and customisation
* Incident history (manual)

Expand Down Expand Up @@ -36,6 +36,7 @@ Command can be:
* `http` - Check http status
* `ping` - Check ping status
* `port` - Check open port status
* `dns` - Check dns status

There are also `http4`, `http6`, `ping4`, `ping6`, `port4`, `port6` for IPv4 or IPv6 only check.
Note: `port4` and `port6` require OpenBSD `nc` binary.
There are also `http4`, `http6`, `ping4`, `ping6`, `port4`, `port6`, `dns4`, `dns6` for IPv4 or IPv6 only check.
Note: `port4` and `port6` require OpenBSD `nc` binary; `dns4` and `dns6` require Bind9 `dig` binary;
5 changes: 5 additions & 0 deletions checks.csv
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,8 @@ http6, 200, Google Website (IPv6), https://google.com
http, 404, Google 404, https://google.com/dummy
ping, 0, Google ping, 8.8.8.8
port, 0, Google DNS, 8.8.8.8 53
dns6, 0, Google DNS Test 1, AAAA;www.google.com;2001:4860:4860::8888
dns4, 0, Google DNS Test 2, AAAA;www.google.com;2001:4860:4860::8888
dns6, 0, Google DNS Test 3, AA;www.google.com;8.8.8.8
dns4, 0, Google DNS Test 4, AA;www.google.com;8.8.8.8
dns, 0, Google DNS Test 5, AA;www.google.com;8.8.8.8
12 changes: 12 additions & 0 deletions tinystatus
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ get_element(){
echo "${2}" | awk -v col="${1}" -F',' '{gsub(/^[ \t]+|[ \t]+$/, "", $col); print $col}'
}

get_item(){
echo "${2}" | awk -v col="${1}" -F';' '{gsub(/^[ \t]+|[ \t]+$/, "", $col); print $col}'
}

check(){
ctype="${1}"
host="${2}"
Expand All @@ -37,6 +41,13 @@ check(){
error="$(nc -${IPv}w "${timeout}" -zv ${host} 2>&1)"
statuscode=$?
[ "${statuscode}" -ne "${expectedcode}" ] && echo "${error}" > "${tmp}/ko/${name}.error";;
dns*)
rrtype=$(get_item 1 "${host}")
rrhost=$(get_item 2 "${host}")
dnsserver=$(get_item 3 "${host}")
dig +short -${IPv}u "${rrtype}" "${rrhost}" @"${dnsserver}" > "${tmp}/ko/${name}.tmp" 2>&1
statuscode=$?
[ "${statuscode}" -ne "${expectedcode}" ] && mv "${tmp}/ko/${name}.tmp" "${tmp}/ko/${name}.error";;
esac

# verity status and write files
Expand All @@ -55,6 +66,7 @@ check(){
command_exists 'curl'
command_exists 'nc'
command_exists 'ping'
command_exists 'dig'
mkdir -p "${tmp}/ok" "${tmp}/ko" || exit 1

while IFS="$(printf '\n')" read -r line; do
Expand Down