[Nagiosplug-devel] [ nagiosplug-New Plugins-1342716 ] email delivery plugin (smtp send and imap receive)

SourceForge.net noreply at sourceforge.net
Sun Oct 30 12:04:54 UTC 2005

New Plugins item #1342716, was opened at 2005-10-30 20:04
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Perl plugin
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Jonathan Buhacoff (jbuhacoff)
Assigned to: Nobody/Anonymous (nobody)
Summary: email delivery plugin (smtp send and imap receive)

Initial Comment:
The email delivery plugin I wrote uses two other plugins (smtp 
send and imap receive), also included, to send a message to an 
email account and then check that account for the message and 
delete it. The plugin times how long it takes for the message to be 
delivered and the warning and critical thresholds are for this 
elapsed time. 

A few notes:

1. I tried to use the check_smtp plugin for sending mail.  I can do 
it on the command line but I can't get the newlines to happen from 
the config file (\n doesn't seem to work so smtp server waits for 
the '.' but doesn't get it like it does when i use single quote and 
newlines from the command line).   So if you know how to get the 
check_smtp plugin to send a message from the nagios config, 
that one could be used instead of the check_smtp_send plugin 
included here (and also please let me know, jonathan at pnc.net)

2. The check_smtp_send plugin I included lets you specify 
custom headers and body, and this is used by email delivery 

3. The check_imap_receive plugin I included lets you search for a 
specific message in any mailbox via options, and this is used by 
email delivery plugin.  The email delivery plugin could also be 
modified to use a POP account with a suitable plugin for checking 
pop (see "pop3(s) email matching plugin" by kkvenkit).  If this is 
possible to do using the existing check_imap plugin please let me 
know how, I couldn't find any examples:   jonathan at pnc.net

4. I looked at check_mail.pl by bledi51 and its pretty good, and 
also conforms better to nagios perl plugin guidelnes than mine 
does.  So I'm going to be revising my plugins to conform more. 

5. I think I made a mistake in the concept of using the email 
delivery plugin's options.  Right now it takes very specific mail 
from / mail to options and connection options for the smtp and 
imap plugins.  Maybe it would be better to accept just two options 
that are long strings which actually specify a complete plugin 
command-line to run (with the $USER1$ macro of course) and 
then use them a little more blindly.  This might make it more 
difficult to generate unique id's for emails on the fly as is done 
now, but on the other hand I noticed after using the plugin for a 
while that using unique id's just means the email accumulates on 
the recipient account when a problem does occur.  So this might 
change and I'll provide both options.

6. The plugin fails with UNKNOWN status code when required perl 
modules are missing, and it prints a list of missing modules, but 
when I view this on my nagios website it says "no output!", and 
i've tried printing the missing modules list on stdout and stderr, 
without success.  So if anyone knows how to get status 
messages to show up when using UNKNOWN status code, please 
let me know:   jonathan at pnc.net

Finally, usage example from my own nagios config:

define command{
	command_name	check_email_delivery
	command_line	$USER1$/check_email_delivery -H 
$HOSTADDRESS$ --mailfrom $ARG3$ --mailto $ARG4$ --
username $ARG5$ --password $ARG6$ --libexec $USER1$ -w 
$ARG1$ -c $ARG2$

define service{
        use                             generic-service
        host_name                       mail.your.net
        service_description             EMAIL DELIVERY
        check_command                   check_email_delivery!5!120!
sender at your.net!recipient at your.net!recipient at your.net!password

References to similar plugins:

pop3(s) email matching plugin by kkvenkit
check_mail.pl by bledi51


You can respond by visiting: 

More information about the Nagiosplugin-devel mailing list