Zimbra Web login Monitoring script

This is my second blog for testing weblogin the first one was for testing moodle http://xeois.com/blog/moodle-check-web-login-script and this one is for Zimbra. I have written a custom script which I want to share with you that helps us check the login in Zimbra and escalate it via Nagios in case it fails. Some users ask me if they are using Nagios they can easily monitor all the services for zimbra and i totally agree with them. But not everyone is having the same level of knowledge as you geeks are having. This script can be easily used with nagios or without nagios for your convenience. You can take of the highlighted part of the script to remove the nagios bit out of it. You may have to modify the script if you are not using it for nagios for escalation type you want to use. The answer is as simple as to make sure all the service Zimbra depends upon are functioning properly like (mysql, ldap, webserver, postfix etc). Please find the script below to check the Zimbra login.

We will use curl to check the web login for zimbra.







#removes any cookies

rm -f /tmp/$2

#create a cookie entry in the cookie file for that site

curl -b $2 -c /tmp/$2 $1 > /dev/null

#gets the auth token in cookies

curl -b /tmp/$2 -c /tmp/$2 “$1/zimbra/?loginOp=login&username=$3&password=$4” > /dev/null

#use the cookie files to lookup the address book for user@example.com

curl –cookie  /tmp/$2 –data “zimbra/h/search?sq=$3&st=contact&search=Search” $1   | grep $3@$5 >/dev/null

if [ $? -eq 0 ]; then


/bin/echo “OK: Authentication Successfull \n”

exit $STATE_OK

elif [ $? -eq 1 ]; then


/bin/echo ” Critical: Authentication Failure \n”



Please feel free to contact for more information and do give us your feedback.

Original post is on http://xeois.com/blog/zimbra-web-login-monitoring-script

Leave a Reply

Your email address will not be published.