]> git.r.bdr.sh - rbdr/r.bdr.sh/blame - swiftbar/monitorcito.1m.sh
Fix odd line breaks
[rbdr/r.bdr.sh] / swiftbar / monitorcito.1m.sh
CommitLineData
5564aa18
RBR
1#!/usr/bin/env bash
2# This plugin lists your monitorcito entries, with an overview if they're ok or
3# not.
4#
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>
14
15###############################################################################
16# The Variables
17###############################################################################
18VAR_MONITORCITO_URL=${VAR_MONITORCITO_URL:-'https://monitor.srv.bdr.sh/api'}
19
20###############################################################################
21# The Code
22###############################################################################
23
24curl \
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")'