From abadf17eecf0853e75b5867cf40d390718c8f493 Mon Sep 17 00:00:00 2001 From: n Date: Sat, 20 Feb 2021 17:45:48 +0100 Subject: [PATCH] check_gemini.sh for capsule monitoring --- README.md | 1 + monitoring/check_gemini.sh | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100755 monitoring/check_gemini.sh diff --git a/README.md b/README.md index 7c384f7..3a754ad 100644 --- a/README.md +++ b/README.md @@ -40,6 +40,7 @@ Monitoring * [collectd_ntppool_score](https://forge.tourmentine.com/n/scripts/src/master/monitoring/collectd_ntppool_score) => Same as [check_ntppool_score](https://forge.tourmentine.com/n/scripts/src/master/monitoring/check_ntppool_score) but for collectd graphing. * [check_postgresql_replication.sh](https://forge.tourmentine.com/n/scripts/src/master/monitoring/check_postgresql_replication.sh) => check postgresql's replication lag. * [check_rspamc](https://forge.tourmentine.com/n/scripts/src/master/monitoring/check_rspamc) => Check rspamd status. Heavily based on [check_spamc](https://www.vanheusden.com/Linux/check_spamc-0.1.tgz). + * [check_gemini.sh](https://forge.tourmentine.com/n/scripts/src/master/monitoring/check_gemini.sh) => Nagios/Icinga check for Gemini capsule availability. Requires gnutls for now (not tested with other tls clients). * [GonKyrellM](https://forge.tourmentine.com/n/scripts/src/master/monitoring/GonKyrellM) => Conky, GKrellM style - with "invisible" theme (well, sort of) * [collectweather.sh](https://forge.tourmentine.com/n/scripts/src/master/monitoring/collectweather.sh) => get weather data from https://darksky.net/ and feed collectd with it. needs jq as Dark Sky provides data in json format. diff --git a/monitoring/check_gemini.sh b/monitoring/check_gemini.sh new file mode 100755 index 0000000..8b8b361 --- /dev/null +++ b/monitoring/check_gemini.sh @@ -0,0 +1,21 @@ +#!/bin/sh + +TLS_CLIENT="/usr/local/bin/gnutls-cli -p 1965" + +if [ "$1" = "-h" ] +then + echo "usage: $0 (without gemini:// scheme)" + echo + return 0 +fi + +errorOutput=$(echo -n "gemini://$1/\r\n" | ${TLS_CLIENT} $1 2>&1 > /dev/null) +errorCode=$? +if [ $errorCode -gt 0 ] +then + echo "ERROR: ${errorOutput}" + return 2 +else + echo "OK: capsule responding" + return 0 +fi