Use comma-separated value text file

CSV is a well-supported standard and makes things more
predictable/easier to see where things go.
main
Alex Povel 2021-03-29 17:25:25 +02:00 committed by BDR
parent 5bba428b4c
commit 11bddbb4fa
4 changed files with 9 additions and 9 deletions

View File

@ -20,7 +20,7 @@ An example site is available [here](https://lab.bdro.fr/tinystatus/).
To install tinystatus:
* Clone the repository and go to the created directory
* Edit the checks file `checks.list`
* Edit the checks file `checks.csv`
* To add incidents or maintenance, edit `incidents.list`
* Generate status page `./tinystatus > index.html`
* Serve the page with your favorite web server

6
checks.csv 100644
View File

@ -0,0 +1,6 @@
http, 200, Google Website, https://google.com
http, 404, Google 404, https://google.com/dummy
http4, 200, Google website (IPv4), https://google.com
http6, 200, Google website (IPv6), https://google.com
ping, 0, Google ping, 8.8.8.8
port, 0, Google DNS, 8.8.8.8 53
1 http 200 Google Website https://google.com
2 http 404 Google 404 https://google.com/dummy
3 http4 200 Google website (IPv4) https://google.com
4 http6 200 Google website (IPv6) https://google.com
5 ping 0 Google ping 8.8.8.8
6 port 0 Google DNS 8.8.8.8 53

View File

@ -1,6 +0,0 @@
http | 200 | Google website | https://google.com
http4 | 200 | Google website (IPv4) | https://google.com
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

View File

@ -3,7 +3,7 @@
title=tinystatus
timeout=10
tmp="$(mktemp -d)"
checkfile="${1:-checks.list}"
checkfile="${1:-checks.csv}"
incidentsfile="${2:-incidents.list}"
useragent="User-Agent: Mozilla/5.0 (X11; Linux x86_64; Debian) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36"
@ -15,7 +15,7 @@ command_exists(){
}
get_element(){
echo "${2}" | awk -v col="${1}" -F'|' '{gsub(/^[ \t]+|[ \t]+$/, "", $col); print $col}'
echo "${2}" | awk -v col="${1}" -F',' '{gsub(/^[ \t]+|[ \t]+$/, "", $col); print $col}'
}
check(){