Check IMAP and IMAPS
You will probably want to check to see if your IMAP server is working properly. There are several plugins that are options. These two options presented next are straightforward and easy to use. One plugin for IMAP and one plugin for IMAPS. Nagios provides an excellent way to keep in touch with your Ubuntu server, checking IMAP is just one option.
Of course you need to set up the hosts for the mail servers that you want to monitor. The first service is a check on IMAP port 143 with a timeout of five seconds and it searches for a text string “OK” which is part of the response of the IMAP server to a connection request. The second service is for IMAPS and it shows the port listing there as port 993 while it searches for a more detailed text string in “Dovecot ready”. That search string specifically indicates that Dovecot, the MDA (Mail Delivery Agent), is ready to communicate. Searches are case sensitive and you will need to place specific text in these searches that relate to your MDA and the ports you are using.
We do provide live Nagios training for those who prefer demonstrations and like to ask questions.
Here is an example of several service checks.
service_description IMAP4 Response Check
check_command check_imap!-t 5 -e “OK”
service_description IMAPS Check
check_command check_simap!-p 993 -t 5 -e “Dovecot ready”
command_line $USER1$/check_imap -H $HOSTADDRESS$ $ARG1$
command_line $USER1$/check_simap -H $HOSTADDRESS$ $ARG1$
Here you can see a response from a mail server in the logs, that you can scan for a text string you want to test for.
nagios: SERVICE ALERT: lts;IMAP4 Dovecot Check;OK;SOFT;2;IMAP OK – 0.002 second response time on port 143 [* OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE STARTTLS LOGINDISABLED] Dovecot ready.]