Commit 8406cbed authored by Dominika Liberda's avatar Dominika Liberda 💽
Browse files

+ configurable color values for bars

parent 363946c9
## app config
## your application-specific config goes here!
## DownTimeRobot app config
# DO NOT MODIFY THIS FILE!
# This file can be changed upstream as new features get added in. Instead,
# please use files under ../config/, especially master.sh.
cfg[useragent]="dtr/1.0 (https://git.sakamoto.pl/domi/dtr)"
cfg[bar_ok]=70 # below this level, pings are shown as green
cfg[bar_info]=200 # below this, they're yellow
cfg[bar_warn]=500 # below this, they're orange, and above, they're red (fail)
worker_add every_1min 60
worker_add every_5min 300
worker_add every_30min 1800
......
......@@ -60,21 +60,21 @@ for i in $timedata; do
if [[ "$type" != "ping" ]]; then
echo -n '<div class="bar '
if [[ "$i" == 1 ]]; then
echo "green"
echo -n "green"
elif [[ "$i" == 0 ]]; then
echo "vermillion"
echo -n "vermillion"
else
echo "vermillion"
echo -n "vermillion"
fi
echo '" title=""></div>'
else
n="$(sed -E 's/\..*//' <<< "$i")"
echo -n '<div class="bar '
if [[ "$n" -lt 75 ]]; then
if [[ "$n" -lt "${cfg[bar_ok]}" ]]; then
echo -n "green"
elif [[ "$n" -lt 250 ]]; then
elif [[ "$n" -lt "${cfg[bar_info]}" ]]; then
echo -n "yellow"
elif [[ "$n" -lt 500 ]]; then
elif [[ "$n" -lt "${cfg[bar_warn]}" ]]; then
echo -n "orange"
else
echo -n "vermillion"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment