+ configurable color values for bars
This commit is contained in:
parent
363946c9a5
commit
8406cbedf8
11
config.sh
11
config.sh
|
@ -1,8 +1,15 @@
|
||||||
## app config
|
## DownTimeRobot app config
|
||||||
## your application-specific config goes here!
|
|
||||||
|
# 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[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_1min 60
|
||||||
worker_add every_5min 300
|
worker_add every_5min 300
|
||||||
worker_add every_30min 1800
|
worker_add every_30min 1800
|
||||||
|
|
|
@ -60,21 +60,21 @@ for i in $timedata; do
|
||||||
if [[ "$type" != "ping" ]]; then
|
if [[ "$type" != "ping" ]]; then
|
||||||
echo -n '<div class="bar '
|
echo -n '<div class="bar '
|
||||||
if [[ "$i" == 1 ]]; then
|
if [[ "$i" == 1 ]]; then
|
||||||
echo "green"
|
echo -n "green"
|
||||||
elif [[ "$i" == 0 ]]; then
|
elif [[ "$i" == 0 ]]; then
|
||||||
echo "vermillion"
|
echo -n "vermillion"
|
||||||
else
|
else
|
||||||
echo "vermillion"
|
echo -n "vermillion"
|
||||||
fi
|
fi
|
||||||
echo '" title=""></div>'
|
echo '" title=""></div>'
|
||||||
else
|
else
|
||||||
n="$(sed -E 's/\..*//' <<< "$i")"
|
n="$(sed -E 's/\..*//' <<< "$i")"
|
||||||
echo -n '<div class="bar '
|
echo -n '<div class="bar '
|
||||||
if [[ "$n" -lt 75 ]]; then
|
if [[ "$n" -lt "${cfg[bar_ok]}" ]]; then
|
||||||
echo -n "green"
|
echo -n "green"
|
||||||
elif [[ "$n" -lt 250 ]]; then
|
elif [[ "$n" -lt "${cfg[bar_info]}" ]]; then
|
||||||
echo -n "yellow"
|
echo -n "yellow"
|
||||||
elif [[ "$n" -lt 500 ]]; then
|
elif [[ "$n" -lt "${cfg[bar_warn]}" ]]; then
|
||||||
echo -n "orange"
|
echo -n "orange"
|
||||||
else
|
else
|
||||||
echo -n "vermillion"
|
echo -n "vermillion"
|
||||||
|
|
Loading…
Reference in a new issue