Imap Monitoring
Ability to monitor your IMAP inbox and for instance, be alerted when the count of unread email exceeds a predefined threshold.
Configuring an IMAP Monitor
1) Start “Imap Monitor Deployment” wizard
Go to the Wizards screen for germain APM and search for “IMAP”:
http://[server.domain.com:port]/germainapm/workspace/app/#Wizards
Click “Add” on the IMAP Monitor Deployment tile

2) Enter monitoring details
Select “IMAP Monitor” for “Component Type” or Create your own (See below '(Optional): Creating a custom “IMAP Monitor Component”')
Select or create then select entries for “Monitored Server”, “Monitored Application”, and “Credentials”
Click Next

(Optional) Creating a custom “IMAP Monitor Component”
Click the + button to the right of “Component Type” on the screen above
Name the new Component then Click + to create a new rule.

If you have not already: You will need to create a rule that is specific to your needs. You can base this off this sample code.
//
// Sample IMAP monitoring rules.
//
package com.germainsoftware.apm;
dialect "mvel"
import javax.mail.*;
import com.germainsoftware.apm.config.data.*;
import com.germainsoftware.apm.converter.*;
import com.germainsoftware.apm.data.*;
import com.germainsoftware.apm.data.model.*;
import com.germainsoftware.apm.message.*;
import com.germainsoftware.apm.router.*;
global org.slf4j.Logger logger;
global com.germainsoftware.apm.converter.DatamartConverter datamart;
global com.germainsoftware.apm.router.RouterContext context;
rule "Unread folder count"
when
$m : IMAPMessage( )
then
logger.info("Received message for: {}", $m.name);
GenericMetric m = new GenericMetric();
m.type = "IMAP:Unread Count";
m.name = $m.name;
m.timestamp = $m.timestamp;
m.value = (double)$m.folder.getUnreadMessageCount();
datamart.insert(m, context);
retract($m);
end
Once you have written your rule, hit validate. If it passes validation, hit “Finish”.

You will be back at “IMAP Monitor Component Step” 1. Hit Next
Add all folders you would like to be checked to the list. Add entries to the list by hitting +
Hit Finish

3) Enter Port Number
Choose “Use SSL” setting
Click Next

4) Deploy
Enter a name in “Monitor Name”
Choose the “Monitoring Node”
Choose the “Engine”
Set your monitoring “Interval”
Click Finish
