]>
git.r.bdr.sh - rbdr/r.bdr.sh/blob - swiftbar/monitorcito.1m.sh
2 # This plugin lists your monitorcito entries, with an overview if they're ok or
5 # <xbar.title>Monitorcito Status</xbar.title>
6 # <xbar.version>v1.0.0</xbar.version>
7 # <xbar.author>Rubén Beltrán del Río</xbar.author>
8 # <xbar.desc>Shows the status of your running services via monitorcito.</xbar.desc>
9 # <xbar.dependencies>curl,jq</xbar.dependencies>
10 # <xbar.abouturl>https://r.bdr.sh/swiftbar_scripts.html</xbar.abouturl>
11 # <xbar.var>string(VAR_MONITORCITO_URL): Your monitorcito API URL.</xbar.var>
12 # <swiftbar.hideRunInTerminal>true</swiftbar.hideRunInTerminal>
13 # <swiftbar.environment>VAR_MONITORCITO_URL=no</swiftbar.environment>
15 ###############################################################################
17 ###############################################################################
18 VAR_MONITORCITO_URL
=${VAR_MONITORCITO_URL:-'https://monitor.srv.bdr.sh/api'}
20 ###############################################################################
22 ###############################################################################
25 -H 'Content-Type: application/json' \
26 $VAR_MONITORCITO_URL 2>/dev
/null
| \
27 jq
-r '(if (. | to_entries | map(.value) | all) then ":circle:" else ":xmark:" end), "---",
28 (to_entries | .[] | "\(.key) \(if .value then ":circle:" else ":xmark:" end)" + " | refresh=true")'