| 1 |
This file was updated on Sun Oct 21 21:32:12 PDT 2007. |
| 2 |
|
| 3 |
Developer guidelines: |
| 4 |
http://nagiosplug.sourceforge.net/developer-guidelines.html |
| 5 |
|
| 6 |
Nagios Plugins: |
| 7 |
http://nagiosplugins.org/ |
| 8 |
Nagios: http://nagios.org and http://nagiosplug.sourceforge.net |
| 9 |
|
| 10 |
Perl library:
http://search.cpan.org/dist/Nagios-Plugin/lib/Nagios/Plugin.pm |
| 11 |
|
| 12 |
The email delivery plugin I wrote uses two other plugins |
| 13 |
(smtp send and imap receive), also included, to send a message |
| 14 |
to an email account and then check that account for the message |
| 15 |
and delete it. The plugin times how long it takes for the |
| 16 |
message to be delivered and the warning and critical thresholds |
| 17 |
are for this elapsed time. |
| 18 |
|
| 19 |
A few notes: |
| 20 |
|
| 21 |
1. I tried to use the check_smtp plugin for sending mail. I |
| 22 |
can do it on the command line but I can't get the newlines to |
| 23 |
happen from the nagios config file (\n doesn't seem to work so smtp |
| 24 |
server waits for the '.' but doesn't get it like it does when I |
| 25 |
use single quote and newlines from the command line). So if |
| 26 |
you know how to get the check_smtp plugin to send a message from |
| 27 |
the nagios config, that one could be used instead of the |
| 28 |
check_smtp_send plugin included here (and please let me know) |
| 29 |
|
| 30 |
|
| 31 |
2. I looked at check_mail.pl by bledi51 and its pretty good, |
| 32 |
and also conforms better to nagios perl plugin guidelnes than |
| 33 |
mine does. So I'm going to be revising my plugins to conform |
| 34 |
more. |
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
Finally, usage example from my own nagios config: |
| 42 |
|
| 43 |
define command{ |
| 44 |
command_name check_email_delivery |
| 45 |
command_line $USER1$/check_email_delivery -H $HOSTADDRESS$ --mailfrom $ARG3$ --mailto $ARG4$ --username $ARG5$ --password $ARG6$ --libexec $USER1$ -w $ARG1$ -c $ARG2$ |
| 46 |
} |
| 47 |
|
| 48 |
define service{ |
| 49 |
use generic-service |
| 50 |
host_name mail.your.net |
| 51 |
service_description EMAIL DELIVERY |
| 52 |
check_command [email protected][email protected][email protected]!password |
| 53 |
} |
| 54 |
|
| 55 |
|
| 56 |
A new usage example equivalent to the old one but using the new --plugins and --token options: |
| 57 |
|
| 58 |
define command{ |
| 59 |
command_name check_email_delivery |
| 60 |
command_line $USER1$/check_email_delivery -p '$USER1$/check_smtp_send -H $HOSTADDRESS$ --mailfrom $ARG3$ --mailto $ARG4$ -U $ARG5$ -P $ARG6$ --subject "Nagios %TOKEN1%" -w $ARG1$ -c $ARG2$' -p '$USER1$/check_imap_receive -H $HOSTADDRESS$ -U $ARG5$ -P $ARG6$ -s SUBJECT -s "Nagios %TOKEN1%" -w $ARG1$ -c $ARG2$' -w $ARG1$,$ARG1$ -c $ARG2$,$ARG2$ |
| 61 |
} |
| 62 |
|
| 63 |
define service{ |
| 64 |
use generic-service |
| 65 |
host_name mail.your.net |
| 66 |
service_description EMAIL DELIVERY |
| 67 |
check_command [email protected][email protected][email protected]!password |
| 68 |
} |
| 69 |
|
| 70 |
|
| 71 |
References to similar plugins: |
| 72 |
|
| 73 |
pop3(s) email matching plugin by kkvenkit |
| 74 |
check_mail.pl by bledi51 |
| 75 |
check_email_loop.pl by ryanwilliams |
| 76 |
check_pop.pl and check_imap.pl by http://www.jhweiss.de/software/nagios.html |
| 77 |
|