check_gemini.sh for capsule monitoring

This commit is contained in:
n 2021-02-20 17:45:48 +01:00
parent d7dfde7e83
commit abadf17eec
Signed by: n
GPG Key ID: E96086FC951DAE30
2 changed files with 22 additions and 0 deletions

View File

@ -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.

21
monitoring/check_gemini.sh Executable file
View File

@ -0,0 +1,21 @@
#!/bin/sh
TLS_CLIENT="/usr/local/bin/gnutls-cli -p 1965"
if [ "$1" = "-h" ]
then
echo "usage: $0 <capsule name> (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