blob: 6367b93109b80b14928205bf0d20b1a60107b972 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
This file was updated on Sun Oct 21 21:32:12 PDT 2007.
Developer guidelines:
http://nagiosplug.sourceforge.net/developer-guidelines.html
Nagios Plugins:
http://nagiosplugins.org/
Nagios: http://nagios.org and http://nagiosplug.sourceforge.net
Perl library:
http://search.cpan.org/dist/Nagios-Plugin/lib/Nagios/Plugin.pm
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 nagios 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 please let me know)
2. 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.
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 mail_redacted_for_webmail_redacted_for_webmail_redacted_for_web!password
}
A new usage example equivalent to the old one but using the new --plugins and --token options:
define command{
command_name check_email_delivery
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$
}
define service{
use generic-service
host_name mail.your.net
service_description EMAIL DELIVERY
check_command mail_redacted_for_webmail_redacted_for_webmail_redacted_for_web!password
}
References to similar plugins:
pop3(s) email matching plugin by kkvenkit
check_mail.pl by bledi51
check_email_loop.pl by ryanwilliams
check_pop.pl and check_imap.pl by http://www.jhweiss.de/software/nagios.html
|