Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

You can select if you want to check your IMAP or POP3 login. It would be best to have your login credentials for your Email Mailbox.

Screenshot of New rule named Check Email. Imap Server enabled and set to imap.provider.com. TCP port enabled and set to 993.Image Modified


  • Forward emails as events to Event Console

    • Forwarding Method

      You can select if you want to send the events to the Event Console or a remote syslog host. If you want to send the events to the local EC, we recommend using the spooling mechanism.

      The check will store all collected events in one file in ~/var/mkeventd/spool using the spooling mechanism.


      Code Block
      languagebash
      themeRDark
      OMD[mysite]:~$ ll ~/var/mkeventd/spool/
      total 3600
      -rw-rw---- 1 mysite mysite 79124 Dec 7 15:36 mysite_407343_1607351778
      -rw-rw---- 1 mysite mysite 79124 Dec 7 15:37 mysite_408329_1607351841
      


...

You need to be aware that a subject field could contain line breaks. This is depending on your mail client and mail gateway. You could check the raw email to find out how many line breaks you have.

Screenshot of Email header informationImage Modified

.

Now you can use regex platforms like regex101.com to create a regex.

Screenshot of Regex examplesImage Modified

.

For advanced debugging:
.

...

The handled messages (see subject matching) can be cleaned up by deleting them or moving them to a subfolder. By default, nothing is cleaned up.

Screenshot of Forward mails as events to Event console enabled. Forward method set to send events to local event console.Image Modified



Debugging

Event Console Log

...

For debugging reasons, it could be helpful to run the check manually. Therefore, you need to open the service site of the Email service and search for 'Service check command'. Now you can use the command for executing the check manually.

Screenshot of Example of messages being set to the Event Console.Image Modified


Screenshot of Example of a service command checkImage Modified


Code Block
languagebash
themeRDark
title~/lib/nagios/plugins
OMD[mysite]:~/lib/nagios/plugins$ ./check_mail --pwstore=6@11@strato '--protocol=IMAP' '--server=imap.provider.de' '--ssl' '--port=993' '--username=user@provider.com' '--password=*************' '--forward-ec' '--forward-method=spool:' '--match-subject=Checkmk EC' '--forward-facility=2' '--forward-host=localhost' '--cleanup=delete'
OK - Forwarded 0 messages to event console | messages=0

...

The Event would look like this:

Screenshot of Example eventImage Modified

...