Page 1 of 1

help troubleshooting check_imap_receive and office365

Posted: Fri Aug 16, 2013 5:02 pm
by uidaho
I'm working on mail loop monitors. I am having a problem getting check_imap_receive to log into office 365.
I've configured thunderbird to connect to
outlook.office365.com:993 (SSL imap)
This all works fine, and I have a message sitting in the inbox with subject "Testing check_imap_receive"

Check_imap_receive fails:
$ ./check_imap_receive --hostname outlook.office365.com --username '############' --password '###########' --search -s SUBJECT -s "Testing check_imap_receive" --ssl
IMAP RECEIVE CRITICAL - Could not connect to outlook.office365.com port 993: IO::Socket::INET6 configuration failederror:00000000:lib(0):func(0):reason(0) at ./check_imap_receive line 121.

Here is a snippet of check_imap_receive (which is perl), near line 121:
114 eval {
115 local $SIG{ALRM} = sub { die "exceeded timeout $timeout seconds\n" }; # NB: \n required, see `perldoc -f alarm`
116 alarm $timeout;
117
118 if( $ssl ) {
119 $imap_port = $default_imap_ssl_port unless $imap_port;
120 my $socket = IO::Socket::SSL->new("$imap_server:$imap_port");
121 die IO::Socket::SSL::errstr() unless $socket;
122 $socket->autoflush(1);
123 $imap = Mail::IMAPClient->new(Socket=>$socket, Debug => 0 );
124 $imap->State(Mail::IMAPClient->Connected);
125 $imap->_read_line() if "$Mail::IMAPClient::VERSION" le "2.2.9"; # necessary to remove the server's "ready" line from the input buffer for old versions of Mail:: IMAPClient. Using string comparison for the version check because the numeric didn't work on Darwin and for Mail::IMAPClient the next version is 2.3.0 and then 3.00 so string comparison works

Perl-IO-Socket-SSL in installed, per yum (this is on rhel6).

Does anyone have advice on how to troubleshoot this?

Thank you!
David Summers

Re: help troubleshooting check_imap_receive and office365

Posted: Mon Aug 19, 2013 10:04 am
by lmiltchev
Try adding the following line in the "check_imap_receive":

Code: Select all

use IO::Socket::SSL 'inet4';
right above the

Code: Select all

# look for required modules
line (in the beginning of the script).

Let us know if this helps.

Re: help troubleshooting check_imap_receive and office365

Posted: Mon Aug 19, 2013 12:12 pm
by uidaho
Thank you!

That did get me past the connect error. I am now getting a new error:
Cannot search messages: Invalid search parameters: 4 BAD The specified message set is invalid. at ./check_imap_receive line 194.

But I will troubleshoot that and append to this thread what I find.

Thanks again.

David

Re: help troubleshooting check_imap_receive and office365

Posted: Mon Aug 19, 2013 12:16 pm
by uidaho
My error was a simple syntax error. I was specifying --search and -s. This command is working for me after modifying search_imap_receive as suggested:

./check_imap_receive --hostname outlook.office365.com --username '#####' --password '########' -s SUBJECT -s "Testing check_smtp_send from monitor01p" --ssl

Re: help troubleshooting check_imap_receive and office365

Posted: Mon Aug 19, 2013 1:03 pm
by lmiltchev
I am locking this thread as "resolved". Thanks for the feedback!