From OpenNMS
Contents |
Blackberry Autoreply Mail Transport Monitoring
The existing Mail Transport Monitor, present in OpenNMS since release 1.3.10, is capable of submitting e-mail messages for delivery via the Simple Mail Transport Protocol (SMTP) and verifying the delivery of those messages via the Post Office Protocol, version 3 (POP3) or Internet Message Access Protocol, version 4 (IMAP4). For this deliverable, The OpenNMS Group proposes to enhance the Mail Transport Monitor to support recognition of messages that constitute replies to the test messages. In user's environment, a Blackberry handheld device will be configured to reply automatically to every received message that is recognized as a test message sent by OpenNMS.
Strategy
Configure the mail transport monitor. Configure a BlackBerry handheld to reply automatically to e-mails from the mail transport monitor.
Acceptance Criteria
User will verify the operation of this deliverable by configuring OpenNMS to send and receive e-mails from a test account and configuring a BlackBerry handheld to respond automatically to those e-mails when they arrive.
Create a service representing BlackBerry e-mail autoreply tests
Configure a service in OpenNMS that represents a BlackBerry autoreply mail transport monitor test. New services are created by adding a protocol-plugin definition to the capsd-configuration.xml file in the OPENNMS_HOME/etc directory. This file configures the OpenNMS capabilities scanning daemon, or Capsd, which is responsible for finding and provisioning services on managed interfaces.
To create a service called BBMAIL, add the following to the bottom of the capsd-configuration.xml file:
...
</protocol-plugin>
<protocol-plugin protocol="BBMAIL"
class-name="org.opennms.netmgt.capsd.plugins.LoopPlugin" scan="off"/>
</capsd-configuration>
Create a service monitoring definition for BlackBerry e-mail autoreply tests
Given the BBMAIL service defined above, and the following:
- An e-mail address, user@blackberry.example.com, that is delivered to a BlackBerry handheld
- An SMTP server, smtp.corp.example.com, through which the OpenNMS server is permitted to relay mail with neither authentication nor SSL/TLS required (the MailTransportMonitor does support both authentication and SSL/TLS operation, but these are left out of this example for the sake of simplicity.)
- A second e-mail address, user@corp.example.com, that is delivered to an IMAP4 mailbox on server imap.corp.example.com
- Username to authenticate for this IMAP mailbox is user@corp.example.com (Note that IMAP servers vary as to their use of fully-qualified e-mail addresses or bare usernames such as user when authenticating)
- Password to authenticate for this IMAP mailbox is supersecret
- SSL/TLS is not required to access this mailbox (the MailTransportMonitor does support SSL/TLS operation for both IMAP and POP3, but these are left out of this example for the sake of simplicity.)
You must now tell the OpenNMS service poller daemon to use the [Mail Transport Monitor] class to check the availability of the BBMAIL service. Service monitoring definitions are configured in the poller-configuration.xml file in OPENNMS_HOME/etc. The name of the service in this file must match the value of the protocol attribute used above in capsd-configuration.xml.
Create a service definition in poller-configuration.xml for the BBMAIL service that specifies a mail transport monitor test as follows:
<package name="example1">
...
</service>
<service name="BBMAIL" interval="300000" user-defined="false" status="on">
<parameter key="mail-transport-test">
<mail-transport-test>
<mail-test>
<sendmail-test attempt-interval="3000" debug="true" use-authentication="false" use-jmta="false">
<sendmail-host host="smtp.corp.example.com" port="25" />
<sendmail-protocol char-set="us-ascii" mailer="smtpsend" message-content-type="text/plain" message-encoding="7-bit"
quit-wait="true" ssl-enable="false" start-tls="false" transport="smtp" />
<sendmail-message to="user@blackberry.example.com" from="user@corp.example.com" subject="OpenNMS Test Message "
body="This is an OpenNMS test message." />
</sendmail-test>
<readmail-test attempt-interval="5000" debug="true" mail-folder="INBOX" subject-match="OpenNMS Test Message"
delete-all-mail="true">
<readmail-host host="imap.corp.example.com" port="143">
<readmail-protocol ssl-enable="false" start-tls="false" transport="imap" />
</readmail-host>
<user-auth user-name="user@corp.example.com" password="supersecret" />
</readmail-test>
</mail-test>
</mail-transport-test>
</parameter>
</service>
...
<monitor service="Windows-Task-Scheduler" class-name="org.opennms.netmgt.poller.monitors.Win32ServiceMonitor" />
<monitor service="BBMAIL" class-name="org.opennms.netmgt.poller.monitors.MailTransportMonitor" />
Restart OpenNMS
Restart OpenNMS so that the changes made in previous steps can take effect. To restart OpenNMS, log in to the OpenNMS server and issue the appropriate command to restart the OpenNMS daemons. If you are able to log in to the OpenNMS server as root or to substitute the root user's privileges via the su command, then this interaction will go as follows:
[root@opennms]# /etc/init.d/opennms restart Stopping OpenNMS... done. Starting OpenNMS... done.
If you are not able to log in as root or use the su command, you may be able to use the sudo command instead, in which case the interaction would be slightly different:
[user@opennms]$ sudo /etc/init.d/opennms restart Stopping OpenNMS... done. Starting OpenNMS... done.
If you are unable to achieve root access by using the sudo command, you may need to ask your system administrator to add your account to the /etc/sudoers file with permission to execute the command above.
Provision node, interface, and service
Before OpenNMS can monitor the Blackberry e-mail service, the service must be provisioned on one or more interfaces of one or more nodes. The easiest way to provision these items is to use a provisioning group, or requisition, from the OpenNMS web UI.
Log in to the OpenNMS web UI as a user with administrator privilege. Click on the Admin menu item near the right-hand side of the top navigation strip. In the administration menu, click on Manage Provisioning Groups under the Nodes section. Enter the name of the requisition you would like to create, e.g. BlackBerry Mail, in the top text field and then click the Add New Group button:
Under the header for the requisition you just created, click the EDIT link. This will take you to the editor for your new requisition.
In the requisition editor, click the Add Node button. You may use any value you like for the node label, e.g. bbtest. After entering the node label, leave the Foreign ID and Site fields at their default values and click the Save button. A new Add Interface link now appears next to the node you just added. Click the Add Interface link. Enter any IP address (it need not be valid or reachable) in the IP Interface text field. Leave the Description field blank or set it to a value that is meaningful to you. Set the SNMP Primary field to N. Click the Save button. A new Add Service link now appears next to the interface you just added. Click the Add Service link, select the BBMAIL service from the drop-down list, and click the Save button.
To save the requisition, click the Done button at the top of the page. This will take you back to the provisioning groups overview interface. Under the header for the new requisition, click the Import button. The provisioner will import your requisition; after a moment, the node you created will appear in the OpenNMS node list, and the availability of the BBMAIL service will be reflected there. Since no auto-replies are being sent yet, the service will show up initially in a down state with an active outage.
Configure BlackBerry to reply automatically
On a BlackBerry handheld configured to retrieve mail from the mailbox user@blackberry.example.com, install an application such as Ultimate Auto Responder that enables the device to reply automatically to incoming e-mail messages from user@corp.example.com.
Configure the application to reply automatically, with no delay, to all messages from e-mail address user@corp.example.com. Wait five minutes, then verify that the BBMAIL service shows as up on the bbtest node's interface. The previously created outage for the newly responsive service will resolve within a few minutes (depending on the downtime model in effect).









