This repository has been archived on 2025-03-03. You can view files and clone it, but cannot push or open issues or pull requests.
nagios-scripts/check_senderscore
2020-08-26 12:45:51 -07:00

37 lines
782 B
Bash
Executable File

#!/bin/sh
# bare-bones check_senderscore plugin for nagios
# default thresholds
warn=95
crit=90
while getopts 'H:w:c:' opt
do
case "$opt" in
H) host="$OPTARG";;
w) warn="$OPTARG";;
c) crit="$OPTARG";;
esac
done
revip=`echo $host | awk -F . '{print $4"."$3"."$2"."$1".score.senderscore.com"}'`
score=`dig a $revip +short | awk -F . '{print $4""}'`
if [ -z "$score" ]; then
echo 'SenderScore OK:' "$host" '(no score yet)'
exit 0 # ok
elif [ "$score" -gt "$warn" ]; then
echo 'SenderScore OK:' "$host:" $score
exit 0 # ok
elif [ $score -gt $crit ]; then
echo 'SenderScore WARNING:' "$host:" $score
exit 1 # warning
elif [ $score -le $crit ]; then
echo 'SenderScore CRITICAL:' "$host:" $score
exit 2 # critical
else
echo 'SenderScore UNKNOWN'
exit 3 # unknown
fi