initial commit
This commit is contained in:
commit
a0f31b1439
7
README.md
Normal file
7
README.md
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
Simple nagios monitoring scripts.
|
||||||
|
|
||||||
|
`check_ircd` attempts to connect to an IRC server.
|
||||||
|
|
||||||
|
`check_senderscore` checks the senderscore (a metric for whether an IP address
|
||||||
|
tends to send spam email) of an IP address.
|
||||||
|
|
47
check_ircd
Executable file
47
check_ircd
Executable file
@ -0,0 +1,47 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
botname=nagiosbot
|
||||||
|
host=localhost
|
||||||
|
port=6667
|
||||||
|
warn=10
|
||||||
|
crit=15
|
||||||
|
|
||||||
|
while getopts 'H:p:w:c:' opt
|
||||||
|
do
|
||||||
|
case "$opt" in
|
||||||
|
H) host="$OPTARG";;
|
||||||
|
p) port="$OPTARG";;
|
||||||
|
w) warn="$OPTARG";;
|
||||||
|
c) crit="$OPTARG";;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
# if your netcat does not have the -i <interval> flag, modify the script below,
|
||||||
|
# putting this function in the pipeline between echo and nc
|
||||||
|
function delay {
|
||||||
|
while read line
|
||||||
|
do
|
||||||
|
sleep 1
|
||||||
|
echo $line
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
SECONDS=0
|
||||||
|
echo "NICK $botname
|
||||||
|
USER $botname 8 * : $botname" | nc -i 1 -q $crit -w $crit $host $port 2>&1 > /dev/null
|
||||||
|
exit=$?
|
||||||
|
if [ ! "$exit" == 0 ]; then
|
||||||
|
echo "IRCd CRITICAL: $host: connection failed"
|
||||||
|
exit $exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$SECONDS" -ge "$crit" ]; then
|
||||||
|
echo "IRCd CRITICAL: $host: check took $SECONDS"
|
||||||
|
exit 2
|
||||||
|
elif [ "$SECONDS" -ge "$warn" ]; then
|
||||||
|
echo "IRCd WARNING: $host: check took $SECONDS"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
echo "IRCd OK: $host: check took $SECONDS"
|
||||||
|
exit 0
|
||||||
|
fi
|
36
check_senderscore
Executable file
36
check_senderscore
Executable file
@ -0,0 +1,36 @@
|
|||||||
|
#!/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
|
Reference in New Issue
Block a user