DESCRIPTION:
Sometimes a device or app sends email alerts but you want to see it and alert on it within LogicMonitor. So, I built a script EventSource to retrieve emails from a specified mailbox and alert if it has a keyword in subject (or body). It retrieves one email at a time from the mailbox using IMAP or secure IMAP. The alert looks like the screenshot below.
INSTRUCTIONS:
- Download the EventSource and add it into your LogicMonitor account (Settings > EventSources > Add > From file )
- Set a property on any device to specify the IMAP mail password. The EventSource will show in the device tree where this device is.
imap.pass = ******** (whatever your password is) - Set/change the email settings at the beginning of the Groovy script:
imapUsername = the username of the mailbox you’re retrieving from (e.g. ‘acme.slurp@gmail.com’ )
imapServer = the name of your imap server (e.g. ‘imap.gmail.com’ )
imapPort = usually ‘993’ for SSL secure or ‘143’ if not secure. - Set/change the keyword in the ‘Filters’ section of the EventSource screen. My example uses ‘purple’ in the subject.
- Create a folder in your mailbox called “DONE” so the script can move the messages it processes into this folder. If you want some other folder name, just change the name in the script to match.
- Test by sending an email with your keyword and watch for the alert in the “Alerts” tab.
DISCLAIMER: Like most of my creations, this is not officially supported by LogicMonitor tech support.
No comments