Introduction
The email delivery custom monitor provides us with metrics to show how long it takes to deliver each outbound message, as well as providing performance insights for the entire email-delivery process. Additionally, this custom monitor will monitor the availability of both inbound and outbound email servers.
Once enabled, it will start sending test emails to the specified email server using SMTP protocol, retrieving emails using IMAP protocol, and measuring the round-trip time.

Prerequisites
- NodeJS v10 installed on Enterprise Node.
Installation and Configuration
-
Navigate to
sandboxdirectory.
$ cd /opt/3genlabs/hawk/syntheticnode/service/shellmonitor/sandbox -
Install all the required NodeJS dependencies using NPM.
$ npm i nodemailer
$ npm i imap
$ npm i execution-time
$ npm i moment
$ npm i async
$ npm i util
Implementation
Place the custom script:
-
Download and copy all the attached files to the
sandboxdirectory. (email_monitoring.shemail_monitoring.js,email_index.js) -
Run these commands to change file permission and owner.
$ cd /opt/3genlabs/hawk/syntheticnode/service/shellmonitor/sandbox
$ chmod 500 email_monitoring.sh
$ chown serveruser email_monitoring.sh
$ chmod 500 email_monitoring.js
$ chown serveruser email_monitoring.js
$ chmod 500 email_index.js
$ chown serveruser email_index.js
Note: The script will check for arriving email under the folder in the mailbox.
Create the Custom Test
To configure the script in Catchpoint Portal, navigate to the test module and create a Custom Test. This will open the test configuraion blade.
The script file name should be the same as the file placed in the sandbox folder. This file would be the first point of execution when the run is triggered. In our example, it would be email_monitoring.sh.

We need to add the following custom fields to this script:
- SMTP Host
- SMTP Username
- SMTP Password
- SMTP port (Optional) uses port 465 if not given.
- IMAP Host
- IMAP Username
- IMAP Password
- IMAP port (Optional) uses port 987 if not given.

Result
Based on the output that gets printed in the console, you can create Indicators to capture the metrics and analyse it in the Portal.

The image below displays results of the test. Now we can set up Insight to capture and analyse the results.
| Indicator Name | Format |
|---|---|
| email response time | Total\ Response\ Time\ :\ (\d+(\.\d{1,5})?) |
| email round trip time | Email\ Round\ Trip\ Time\ :\ (\d+(\.\d{1,5})?) |
