Quantcast
Channel: iRedMail
Viewing all articles
Browse latest Browse all 14109

[contribution] A check_mk local-check-script for iRedmail

$
0
0

Returns OK if all 14 indicated ports are listening according to a locally ran netstat, otherwise critical. (Assumes mysql version, adjust as needed.) Tested on CentOS 6.


#!/bin/sh
#PUPPET MANAGED FILE
#/usr/lib/check_mk_agent/local/mailportchecker.sh
PORTS="25 443 80 993 995 3306 10024 10025 587 9998 110 143"
TOTALCOUNT=`netstat -aunt|grep LISTEN|grep -E '25|80|443|993|995|3306|10024|10025|587|9998|110|143' -c`

if [ $TOTALCOUNT -ne 14 ] ; then
        status=2
        statustxt=CRITICAL
else
        status=0
        statustxt=OK
fi

for thisport in $PORTS; do
        netstat -aunt|grep LISTEN | grep $thisport > /dev/null 2>&1
        if [ $? -eq 0 ] ; then
                listeners="$listeners $thisport"
        fi
done

echo "$status iRedmail_ports iRedmail_ports=$TOTALCOUNT;13;12;14;14 $listeners"


Viewing all articles
Browse latest Browse all 14109

Trending Articles