visio.chapril.org-tools/monitoring/check_visio_certificate.sh

42 lines
805 B
Bash
Raw Normal View History

2022-12-19 12:53:57 +01:00
#! /bin/sh
CHECK="/usr/lib/nagios/plugins/check_http"
CHECK_OPTS="-S --sni -H visio.chapril.org"
2022-12-19 23:35:36 +01:00
IP_FRONT='192.168.1.93'
THRESHOLDS='20,10'
2022-12-19 12:53:57 +01:00
usage() {
echo
echo "SYNTAX"
echo "`basename ${0}` -h"
echo "`basename ${0}` -i <IP> -C <warning,critical>"
echo
echo "EXAMPLE"
echo "`basename ${0}` -i 192.168.0.254 -C 30,14"
echo
}
2022-12-19 12:55:52 +01:00
optstring=":hi:t:"
2022-12-19 12:53:57 +01:00
while getopts ${optstring} arg; do
case ${arg} in
h)
usage
exit 0
;;
:)
echo "$0: Must supply an argument to -$OPTARG." >&2
exit 1
;;
i)
2022-12-19 23:35:36 +01:00
IP_FRONT="${OPTARG}"
2022-12-19 12:53:57 +01:00
;;
C)
2022-12-19 23:35:36 +01:00
THRESHOLDS="${OPTARG}"
2022-12-19 12:53:57 +01:00
;;
esac
done
2022-12-19 23:35:36 +01:00
res="`${CHECK} ${CHECK_OPTS} -I ${IP_FRONT} -C ${THRESHOLDS}`"
2022-12-19 12:53:57 +01:00
ret=${?}
echo "${res}"
exit ${ret}