#!/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