Read number of mails unread

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
FCC_Nagios_Support
Posts: 161
Joined: Tue Mar 10, 2020 11:07 am

Read number of mails unread

Post by FCC_Nagios_Support »

Hello,

Can you explain me how this plugin works. How to open an SSL connection and IMAP session.

Main functions :
1 - Open a SSL connection with the mail server
2 - Open an IMAPS connection to the mail server with uer,password
3 - Check connection establishment time and, if necessary, raise an appropriate alarm
4 - For each folder given as input parameter, count mails (unseen or present) and raise an appropriate alarm is necessary.

Each mesure and count is treated as a nagios performance value.

Input parameters
-u : this user must be present in the file /usr/local/nagios/libexec/mdp.txt. The associated password is stored encrypted in the same file
-l : comma separated list of folders to analyze
-w : in number of unread mails
-c : in number of unread mails
-D [P|U] P: count mails present in the folder
U: count unseen mails in the folder

A specific option allows the creation of the user,password file
./check_unread_mails.pl -u -g

Thanks and Regards
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Read number of mails unread

Post by ssax »

This is a 3rd party plugin. It looks like you need to edit the plugin directly in a lot of places throughout to set the mailserver/port/protocol values you want, it doesn't look like it supports you passing them in as arguments. It's a mix of arguments and editing the plugin directly, you would need multiple copies of the modified plugin to check both.

I would recommend you also take a look at some of the existing plugins on the XI system:

Code: Select all

/usr/local/nagios/libexec/check_smtp -h
/usr/local/nagios/libexec/check_smtp_send -h
/usr/local/nagios/libexec/check_imap -h
/usr/local/nagios/libexec/check_imap_receive -h
/usr/local/nagios/libexec/check_email_delivery -h
What specifically are you trying to do?
FCC_Nagios_Support
Posts: 161
Joined: Tue Mar 10, 2020 11:07 am

Re: Read number of mails unread

Post by FCC_Nagios_Support »

Many Thanks

I am trying to read a remote mailbox

KR
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Read number of mails unread

Post by ssax »

I tried the one you found and could not get it to work, this one I was able to get working:

https://exchange.nagios.org/directory/P ... ox/details

Code: Select all

perl check_imap_mailbox --host=imap.gmail.com [email protected] --pass='XXXX' --folder=INBOX
Locked