22 lines
556 B
Bash
22 lines
556 B
Bash
#!/bin/bash
|
|
STATUSURL=https://obelisk.ilabt.imec.be/api/v2/status
|
|
STATUS=$(curl -s $STATUSURL | jq -r '.status')
|
|
|
|
# colors
|
|
HEALTHY="#b8bb26"
|
|
DEGRADED="#fe8019"
|
|
FAILED="#fb4934"
|
|
UNKNOWN="#928374"
|
|
|
|
# echo the status in polybar format
|
|
# the {F}x{F-} syntax allows you to color stuff
|
|
if [ $STATUS = "healthy" ]; then
|
|
echo "%{F$HEALTHY} %{F-} obelisk"
|
|
elif [ $STATUS = "degraded" ]; then
|
|
echo "%{F$DEGRADED} %{F-} obelisk"
|
|
elif [ $STATUS = "failed" ]; then
|
|
echo "%{F$FAILED} %{F-} obelisk"
|
|
else
|
|
echo "%{F$UNKNOWN} %{F-} obelisk"
|
|
fi
|