IMAP4 and POP3

check_imap_mailbox

Description:

Check a IMAP mailbox for new mails

Current Version

Last Release Date

June 18, 2009

Compatible With


Nagios CSP

Meet The New Nagios Core Services Platform

Built on over 25 years of monitoring experience, the Nagios Core Services Platform provides insightful monitoring dashboards, time-saving monitoring wizards, and unmatched ease of use. Use it for free indefinitely.

Monitoring Made Magically Better

  • Nagios Core on Overdrive
  • Powerful Monitoring Dashboards
  • Time-Saving Configuration Wizards
  • Open Source Powered Monitoring On Steroids
  • And So Much More!
Project Files
Project Notes
Check a IMAP mailbox for new mails
Reviews (2) Add a Review
Helpful, but expandable
by egalstad, September 30, 2012
Helpful plugin, I just expanded it to use starttls and with better output.

--- check_imap_mailbox.orig 2012-09-21 09:16:40.822833872 +0200
+++ check_imap_mailbox 2012-09-21 09:18:06.457602444 +0200
@@ -28,6 +28,7 @@
use strict;
use warnings;
use Mail::IMAPClient;
+use MIME::Base64;
use Getopt::Long;

## Print Usage if not all parameters are supplied
@@ -71,16 +72,17 @@
## Connect to server
$imap = Mail::IMAPClient->new (
Server => $options->{host},
- User => $options->{user},
- Password=> $options->{pass},
Clear => 5, # Unnecessary since '5' is the default
- ) or die "Cannot connect to $options->{host} as $options->{user}: $@";
+ ) or print "CRIT: Cannot connect to $options->{host}: $@n" and exit 2;

+$imap->has_capability("STARTTLS") and $imap->starttls();
+
+$imap->tag_and_run("AUTHENTICATE PLAIN " . encode_base64("" . $options->{user} . "" . $options->{pass})) or print "CRIT: Cannot login to $options->{host} as $options->{user}: $@n" and exit 2;

## Check if folder exists
if ( ! $imap->exists($options->{folder}) )
{
- print "CRIT: folder $options->{folder} doesn't exists";
+ print "CRIT: folder $options->{folder} doesn't existsn";
exit 2;
}

@@ -90,12 +92,12 @@
## Now check the results
if ( $unseen == 0 )
{
- print "OK: $unseen unread messages";
+ print "OK: $unseen unread messages|'messages'=$unseenn";
exit 0;
}
else
{
- print "CRIT: $unseen unread messages in $options->{folder}";
+ print "CRIT: $unseen unread messages in $options->{folder}|'messages'=$unseenn";
exit 2;
}
Helpful? Yes  No 
error
by sangayya.alagundimath, January 31, 2012
./check_imap_mailbox.pl --host= --user= --pass= --folder=Inbox

and getting the error
CRIT: folder Inbox doesn't exists

let me know if there is any solution for this
Helpful? Yes  No 
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
3.5 (2)
Favorites
0
Views
117,042