I made a datasource to retrieve alert emails with certain key words in it and then it will run a script specified in the body of the email. To prevent security problems, it only processes emails that match your specification.

This video shows an example and explains briefly how it works: ( link to video )


This assumes you have some experience with LogicMonitor and are familiar with datasources and how to apply them etc.

  1. Download this DataSource file and add it into your LogicMonitor account (Settings > DataSources > Add > From file )
  2. Since PowerShell doesn’t natively support IMAP retrieval, you must also put the IMAPX.DLL and 2 other files in \Program Files\LogicMonitor\agent\bin. You might have to right click on each of these 3 files and click “unblock” since Windows tags any file downloaded from internet with “blocked”.
  3. Set the settings near the top of the script for your mailbox and preferences for key words and script folder. Set logging=false after you verify it works.
  4. Set properties on your collector for  “imap.pass”, “mail_username” and “mail_server” These settings are used in the script and used to apply the datasource to a device. I recommend you apply this datasource to the collector since that’s where it runs anyways.
  5. Setup a separate dedicated mailbox (e.g. alert.script@acme.com) and add a folder called ARCHIVE because the script needs to move the emails to this folder after they are ‘processed’.
  6. Add a “custom email delivery” under Settings > Integration. Set the destination to the email address mentioned above. The subject should contain “run this script” and body should contain “run this script: myscript.ps1” (where myscript.ps1 is the name of your ‘fix-it’ script. You can use different words as long as they match your settings in the script.
  7. Use an “Alert Rule” in LogicMonitor that sends an alert email to the address above.
  8. Put your “fix-it” script on your collector in the folder that matches your setting in the script. In my example, The default is c:\scripts
  9. Test – test – test (by triggering the alert and making sure the script datasource works). The script can write to a log file to see details.


imapx.dll and related


Currently, this is not officially a feature of LogicMonitor so you probably cannot get help from tech support.