From: Ruben Beltran del Rio Date: Thu, 26 Dec 2024 15:41:33 +0000 (+0100) Subject: Add monitorcito X-Git-Url: https://git.r.bdr.sh/rbdr/r.bdr.sh/commitdiff_plain/5564aa18a0c6249d647d1f2802abf92cab0e20df Add monitorcito --- diff --git a/swiftbar/monitorcito.1m.sh b/swiftbar/monitorcito.1m.sh new file mode 100755 index 0000000..ff083f9 --- /dev/null +++ b/swiftbar/monitorcito.1m.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env bash +# This plugin lists your monitorcito entries, with an overview if they're ok or +# not. +# +# Monitorcito Status +# v1.0.0 +# Rubén Beltrán del Río +# Shows the status of your running services via monitorcito. +# curl,jq +# https://r.bdr.sh/swiftbar_scripts.html +# string(VAR_MONITORCITO_URL): Your monitorcito API URL. +# true +# VAR_MONITORCITO_URL=no + +############################################################################### +# The Variables +############################################################################### +VAR_MONITORCITO_URL=${VAR_MONITORCITO_URL:-'https://monitor.srv.bdr.sh/api'} + +############################################################################### +# The Code +############################################################################### + +curl \ + -H 'Content-Type: application/json' \ + $VAR_MONITORCITO_URL 2>/dev/null | \ + jq -r '(if (. | to_entries | map(.value) | all) then ":circle:" else ":xmark:" end), "---", + (to_entries | .[] | "\(.key) \(if .value then ":circle:" else ":xmark:" end)" + " | refresh=true")' diff --git a/swiftbar_scripts.gmi b/swiftbar_scripts.gmi index 826e6fa..f07d7d9 100644 --- a/swiftbar_scripts.gmi +++ b/swiftbar_scripts.gmi @@ -19,3 +19,12 @@ can also control how many builds to show by changing the VAR_BUILD_COUNT variable (defaults to 5) => ./swiftbar/sourcehut-builds.1m.sh ⧇ source + +## Monitorcito Bar + +View your monitorcito[2] tracked services at a glance.  is shown if everything +is OK, and ╳ if at least one service is failing. Clicking on an item refreshes +the status. + +=> https://git.sr.ht/~rbdr/monitorcito [1] Monitorcito +=> ./swiftbar/monitorcito.1m.sh ⧇ source