Microsoft Exchange

check_exchange_webmail.sh

Description:

This is a bash shell script that checks to see if it can access webmail provided by exchange. -> check_exchange_webmail.sh

Current Version

Last Release Date

June 18, 2009

Compatible With


Project Files
Project Notes
#! /bin/bash # VERSION 0.5 # This script checks to see if it can access webmail provided by exchange # At current, it only outputs OK or CRITICAL # Checked On: (If it works for you, please let me know so I can add it to the list) # - Exchange 2003 / Server 2003 R2 Standard # 1. First create a new email for performing your checks # 2. Send an email to your new email address with a 'key' in the subject # (The 'key' variable below must match your key you sent EXACTLY) # 3. Create a temp profile in Outlook and log into your check account # (I found I had to log into Outlook BEFORE I could log in via webmail.) # 4. Copy this script to your libexec folder and name it 'check_exchange_webmail.sh' # (Mine is located: /usr/local/nagios/libexec) # 5. chmod 755 /usr/local/nagios/libexec/check_exchange_webmail.sh (or wherever you put it) # 6. Change the below variables 'user', 'pass', & 'key' to reflect your setup # 7. Save and verify it works by running the script # (/usr/local/nagios/libexec/check_exchange_webmail.sh [server ip] # 8. If it works, create a new command for it in 'commands.cfg' # Example: # define command{ # command_name check_exchange_webmail # command_line $USER1$/check_exchange_webmail.sh $HOSTADDRESS$ # } # 9. Create a new service in 'services.cfg' (Or wherever your services are) # Example: # define service{ # use generic-service # host_name [your hostname] # service_description WEBMAIL # check_command check_exchange_webmail # } # 10. Run the nagios check. Mine is: # /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg # 11. If it shows everything ok, restart nagios # /etc/init.d/nagios restart user="[user]" pass="[pass]" key="[key]" gtc=`curl -s -k -u $user:$pass https://$1/exchange/$user/Inbox/?Cmd=contents&Page=1` chc=`echo "$gtc" | grep $key | cut -d" " -f1 | cut -d">" -f1 | cut -d"<" -f2` ins=`echo "$chc" | sed s/^/FOUND/g` if [ $ins = FOUNDTABLE ] then echo "OK - FOUND KEY: $key" exit 0 else echo "CRITICAL - CRAP, SOMETHING HAPPENED" exit 2 fi
Reviews (0) Add a Review
Add a Review

You must be logged in to submit a review.

Thank you for your review!

Your review has been submitted and is pending approval.

Recommend

To:


From:


Thank you for your recommendation!

Your recommendation has been sent.

Project Stats
Rating
0 (0)
Favorites
0
Views
103,357