Debian Codegraph @

check_email_delivery/src/docs/check_email_delivery.pod

raw
1
2
3 =pod
4
5 =head1 NAME
6
7 check_email_delivery - sends email and verifies delivery
8
9 =head1 SYNOPSIS
10
11 check_email_delivery -vV
12 check_email_delivery --usage
13 check_email_delivery --help
14
15 =head1 OPTIONS
16
17 =over
18
19 =item --warning <seconds>[,<smtp_seconds>,<imap_seconds>]
20
21 Exit with WARNING if the most recent email found is older than <seconds>. The
22 optional <smtp_seconds> and <imap_seconds> parameters will be passed on to the
23 included plugins that are used for those tasks. If they are not
24 given then they will not be passed on and the default for that plugin will apply.
25 Also known as: -w <seconds>[,<send>[,<recv>]]
26
27 When using the --plugin option, only one parameter is supported (-w <seconds>) and it will apply
28 to the entire process. You can specify a warning threshold specific to each plugin in the
29 plugin command line.
30
31 When using the --plugin option, no measuring of "most recent email" is done because we would
32 not know how to read this information from receive plugins. This may be addressed in future versions.
33
34 =item --critical <seconds>[,<smtp_seconds>,<imap_seconds>]
35
36 Exit with CRITICAL if the most recent email found is older than <seconds>. The
37 optional <smtp_seconds> and <imap_seconds> parameters will be passed on to the
38 included plugins that are used for those tasks. If they are not
39 given then they will not be passed on and the default for that plugin will apply.
40 Also known as: -c <seconds>[,<send>[,<recv>]]
41
42 When using the --plugin option, only one parameter is supported (-c <seconds>) and it will apply
43 to the entire process. You can specify a critical threshold specific to each plugin in the
44 plugin command line.
45
46 When using the --plugin option, no measuring of "most recent email" is done because we would
47 not know how to read this information from receive plugins. This may be addressed in future versions.
48
49 =item --timeout <seconds>
50
51 =item --timeout <smtp_seconds>,<imap_seconds>
52
53 =item --timeout <plugin1_seconds>,<plugin2_seconds>,...
54
55 Exit with CRITICAL if the plugins do not return a status within the specified number of seconds.
56 When only one parameter is used, it applies to each plugin. When multiple parameters are used
57 (separated by commas) they apply to plugins in the same order the plugins were specified on the
58 command line. When using --timeout but not the --plugin option, the first parameter is for
59 check_smtp_send and the second is for check_imap_receive.
60
61 =item --alert <pluginN>
62
63 Exit with WARNING or CRITICAL only if a warning or error (--warning, --critical, or --timeout)
64 occurs for specified plugins. If a warning or error occurs for non-specified plugins that run
65 BEFORE the specified plugins, the exit status will be UNKNOWN. If a warning of error occurs
66 for non-specified plugins that run AFTER the specified plugins, the exit status will not be
67 affected.
68
69 You would use this option if you are using check_email_delivery with the --plugin option and
70 the plugins you configure each use different servers, for example different SMTP and IMAP servers.
71 By default, if you do not use the --alert option, if anything goes wrong during the email delivery
72 check, a WARNING or CRITICAL alert will be issued. This means that if you define check_email_delivery
73 for the SMTP server only and the IMAP server fails, Nagios will alert you for the SMTP server which
74 would be misleading. If you define it for both the SMTP server and IMAP server and just one of them
75 fails, Nagios will alert you for both servers, which would still be misleading. If you have this
76 situation, you may want to use the --alert option. You define the check_email_delivery check for
77 both servers: for the SMTP server (first plugin) you use --alert 1, and for for the IMAP server
78 (second plugin) you use --alert 2. When check_email_delivery runs with --alert 1 and the SMTP
79 server fails, you will get the appropriate alert. If the IMAP server fails it will not affect the
80 status. When check_email_delivery runs with --alert 2 and the SMTP server fails, you will get the
81 UNKNOWN return code. If the IMAP server generates an alert you will get a WARNING or CRITICAL as
82 appropriate.
83
84 You can repeat this option to specify multiple plugins that should cause an alert.
85 Do this if you have multiple plugins on the command line but some of them involve the same server.
86
87 See also: --plugin.
88 Also known as: -A <pluginN>
89
90
91 =item --wait <seconds>[,<seconds>,...]
92
93 How long to wait between sending the message and checking that it was received. View default with
94 the -vV option.
95
96 When using the --plugin option, you can specify as many wait-between times as you have plugins
97 (minus the last plugin, because it makes no sense to wait after running the last one). For
98 example, if you use the --plugin option twice to specify an SMTP plugin and an IMAP plugin, and
99 you want to wait 5 seconds between sending and receiving, then you would specify --wait 5. A second
100 example, if you are using the --plugin option three times, then specifying -w 5 will wait 5 seconds
101 between the second and third plugins also. You can specify a different wait time
102 of 10 seconds between the second and third plugins, like this: -w 5,10.
103
104 =item --hostname <server>
105
106 Address or name of the SMTP and IMAP server. Examples: mail.server.com, localhost, 192.168.1.100.
107 Also known as: -H <server>
108
109 =item --smtp-server <server>
110
111 Address or name of the SMTP server. Examples: smtp.server.com, localhost, 192.168.1.100.
112 Using this option overrides the hostname option.
113
114 =item --smtp-port <number>
115
116 Service port on the SMTP server. Default is 25.
117
118 =item --smtp-username <username>
119
120 =item --smtp-password <password>
121
122 Username and password to use when connecting to the SMTP server with the TLS option.
123 Use these options if the SMTP account has a different username/password than the
124 IMAP account you are testing. These options take precendence over the --username and
125 the --password options.
126
127 These are shell-escaped; special characters are ok.
128
129 =item --imap-server <server>
130
131 Address or name of the IMAP server. Examples: imap.server.com, localhost, 192.168.1.100.
132 Using this option overrides the hostname option.
133
134 =item --imap-port <number>
135
136 Service port on the IMAP server. Default is 143. If you use SSL the default is 993.
137
138 =item --imap-username <username>
139
140 =item --imap-password <password>
141
142 Username and password to use when connecting to the IMAP server.
143 Use these options if the IMAP account has a different username/password than the
144 SMTP account you are testing. These options take precendence over the --username and
145 the --password options.
146
147 These are shell-escaped; special characters are ok.
148
149 =item --username <username>
150
151 =item --password <password>
152
153 Username and password to use when connecting to IMAP server.
154 Also known as: -U <username> -P <password>
155
156 Also used as the username and password for SMTP when the TLS option is enabled.
157 To specify a separate set of credentials for SMTP authentication, see the
158 options --smtp-username and --smtp-password.
159
160 =item --imap-check-interval <seconds>
161
162 How long to wait between polls of the imap-server for the specified mail. Default is 5 seconds.
163
164 =item --imap-retries <times>
165
166 How many times to poll the imap-server for the mail, before we give up. Default is 10.
167
168 =item --body <message>
169
170 Use this option to specify the body of the email message.
171
172 =item --header <header>
173
174 Use this option to set an arbitrary header in the message. You can use it multiple times.
175
176 =item --mailto [email protected]
177
178 You can send a message to multiple recipients by repeating this option or by separating
179 the email addresses with commas (no whitespace allowed):
180
181 $ check_email_delivery ... --mailto [email protected],[email protected] --mailfrom [email protected]
182
183 This argument is shell-escaped; special characters or angle brackets around the address are ok.
184
185 =item --mailfrom [email protected]
186
187 Use this option to set the "from" address in the email.
188
189 =item --imapssl
190 =item --noimapssl
191
192 Use this to enable or disable SSL for the IMAP plugin.
193
194 This argument is shell-escaped; special characters or angle brackets around the address are ok.
195
196 =item --smtptls
197 =item --nosmtptls
198
199 Use this to enable or disable TLS/AUTH for the SMTP plugin.
200
201 =item --libexec
202
203 Use this option to set the path of the Nagios libexec directory. The default is
204 /usr/local/nagios/libexec. This is where this plugin looks for the SMTP and IMAP
205 plugins that it depends on.
206
207 =item --plugin <command>
208
209 This is a new option introduced in version 0.5 of the check_email_delivery plugin.
210 It frees the plugin from depending on specific external plugins and generalizes the
211 work done to determine that the email loop is operational. When using the --plugin
212 option, the following options are ignored: libexec, imapssl, smtptls, hostname,
213 username, password, smtp*, imap*, mailto, mailfrom, body, header, search.
214
215 Use this option multiple times to specify the complete trip. Typically, you would use
216 this twice to specify plugins for SMTP and IMAP, or SMTP and POP3.
217
218 The output will be success if all the plugins return success. Each plugin should be a
219 standard Nagios plugin.
220
221 A random token will be automatically generated and passed to each plugin specified on
222 the command line by substituting the string %TOKEN1%.
223
224 Example usage:
225
226 command_name check_email_delivery
227 command_line check_email_delivery
228 --plugin "$USER1$/check_smtp_send -H $ARG1$ --mailto [email protected] --mailfrom [email protected] --header 'Subject: Nagios Test %TOKEN1%.'"
229 --plugin "$USER1$/check_imap_receive -H $ARG1$ -U $ARG1$ -P $ARG2$ -s SUBJECT -s 'Nagios Test %TOKEN1%.'"
230
231 This technique allows for a lot of flexibility in configuring the plugins that test
232 each part of your email delivery loop.
233
234 See also: --token.
235 Also known as: -p <command>
236
237 =item --token <format>
238
239 This is a new option introduced in version 0.5 of the check_email_delivery plugin.
240 It can be used in conjunction with --plugin to control the tokens that are generated
241 and passed to the plugins, like %TOKEN1%.
242
243 Use this option multiple times to specify formats for different tokens. For example,
244 if you want %TOKEN1% to consist of only alphabetical characters but want %TOKEN2% to
245 consist of only digits, then you might use these options: --token aaaaaa --token nnnnn
246
247 Any tokens used in your plugin commands that have not been specified by --token <format>
248 will default to --token U-X-Y
249
250 Token formats:
251 a - alpha character (a-z)
252 n - numeric character (0-9)
253 c - alphanumeric character (a-z0-9)
254 h - hexadecimal character (0-9a-f)
255 U - unix time, seconds from epoch. eg 1193012441
256 X - a word from the pgp even list. eg aardvark
257 Y - a word from the pgp odd list. eg adroitness
258
259 Caution: It has been observed that some IMAP servers do not handle underscores well in the
260 search criteria. For best results, avoid using underscores in your tokens. Use hyphens or commas instead.
261
262 See also: --plugin.
263 Also known as: -T <format>
264
265 The PGP word list was obtained from http://en.wikipedia.org/wiki/PGP_word_list
266
267 =item --file <file>
268
269 Save (append) status information into the given tab-delimited file. Format used:
270
271 token start-time end-time status plugin-num output
272
273 Note: format may change in future versions and may become configurable.
274
275 This option available as of version 0.6.2.
276
277 Also known as: -F <file>
278
279 =item --hires
280
281 Use the Time::HiRes module to measure time, if available.
282
283 =item --verbose
284
285 Display additional information. Useful for troubleshooting. Use together with --version to see the default
286 warning and critical timeout values.
287 Also known as: -v
288
289 =item --version
290
291 Display plugin version and exit.
292 Also known as: -V
293
294 =item --help
295
296 Display this documentation and exit. Does not work in the ePN version.
297 Also known as: -h
298
299 =item --usage
300
301 Display a short usage instruction and exit.
302
303 =back
304
305 =head1 EXAMPLES
306
307 =head2 Send a message with custom headers
308
309 $ check_email_delivery -H mail.server.net --mailto [email protected] --mailfrom [email protected]
310 --username recipient --password secret
311
312 EMAIL DELIVERY OK - 1 seconds
313
314 =head2 Set warning and critical timeouts for receive plugin only:
315
316 $ check_email_delivery -H mail.server.net --mailto [email protected] --mailfrom [email protected]
317 --username recipient --password secret -w ,,5 -c ,,15
318
319 EMAIL DELIVERY OK - 1 seconds
320
321 =head1 EXIT CODES
322
323 Complies with the Nagios plug-in specification:
324 0 OK The plugin was able to check the service and it appeared to be functioning properly
325 1 Warning The plugin was able to check the service, but it appeared to be above some "warning" threshold or did not appear to be working properly
326 2 Critical The plugin detected that either the service was not running or it was above some "critical" threshold
327 3 Unknown Invalid command line arguments were supplied to the plugin or the plugin was unable to check the status of the given hosts/service
328
329 =head1 NAGIOS PLUGIN NOTES
330
331 Nagios plugin reference: http://nagiosplug.sourceforge.net/developer-guidelines.html
332
333 This plugin does NOT use Nagios DEFAULT_SOCKET_TIMEOUT (provided by utils.pm as $TIMEOUT) because
334 the path to utils.pm must be specified completely in this program and forces users to edit the source
335 code if their install location is different (if they realize this is the problem). You can view
336 the default timeout for this module by using the --verbose and --version options together. The
337 short form is -vV.
338
339 Other than that, it attempts to follow published guidelines for Nagios plugins.
340
341 =head1 CHANGES
342
343 Wed Oct 29 13:08:00 PST 2005
344 + version 0.1
345
346 Wed Nov 9 17:16:09 PST 2005
347 + updated arguments to check_smtp_send and check_imap_receive
348 + added eval/alarm block to implement -c option
349 + added wait option to adjust sleep time between smtp and imap calls
350 + added delay-warn and delay-crit options to adjust email delivery warning thresholds
351 + now using an inline PluginReport package to generate the report
352 + copyright notice and GNU GPL
353 + version 0.2
354
355 Thu Apr 20 14:00:00 CET 2006 (by Johan Nilsson <johann (at) axis.com>)
356 + version 0.2.1
357 + corrected bug in getoptions ($imap_server would never ever be set from command-line...)
358 + will not make $smtp_server and $imap_server == $host if they're defined on commandline
359 + added support for multiple polls of imap-server, with specified intervals
360 + changed default behaviour in check_imap_server (searches for the specific id in subject and deletes mails found)
361 + increased default delay_warn from 65 seconds to 95 seconds
362
363 Thu Apr 20 16:00:00 PST 2006 (by Geoff Crompton <[email protected]>)
364 + fixed a bug in getoptions
365 + version 0.2.2
366
367 Tue Apr 24 21:17:53 PDT 2007
368 + now there is an alternate version (same but without embedded perl POD) that is compatible with the new new embedded-perl Nagios feature
369 + version 0.2.3
370
371 Fri Apr 27 20:32:53 PDT 2007
372 + documentation now mentions every command-line option accepted by the plugin, including abbreviations
373 + changed connection error to display timeout only if timeout was the error
374 + default IMAP plugin is libexec/check_imap_receive (also checking for same but with .pl extension)
375 + default SMTP plugin is libexec/check_smtp_send (also checking for same but with .pl extension)
376 + removed default values for SMTP port and IMAP port to allow those plugins to set the defaults; so current behavior stays the same and will continue to make sense with SSL
377 + version 0.3
378
379 Thu Oct 11 10:00:00 EET 2007 (by Timo Virtaneva <timo (at) virtaneva dot com>
380 + Changed the header and the search criteria so that the same email-box can be used for all smtp-servers
381 + version 0.3.1
382
383 Sun Oct 21 11:01:03 PDT 2007
384 + added support for TLS options to the SMTP plugin
385 + version 0.4
386
387 Sun Oct 21 16:17:14 PDT 2007
388 + added support for arbitrary plugins to send and receive mail (or anthing else!). see the --plugin option.
389 + version 0.5
390
391 Tue Dec 4 07:36:20 PST 2007
392 + added --usage option because the official nagios plugins have both --help and --usage
393 + added --timeout option to match the official nagios plugins
394 + shortcut option for --token is now -T to avoid clash with standard shortcut -t for --timeout
395 + fixed some minor pod formatting issues for perldoc
396 + version 0.5.1
397
398 Sat Dec 15 07:39:59 PST 2007
399 + improved compatibility with Nagios embedded perl (ePN)
400 + version 0.5.2
401
402 Thu Jan 17 20:27:36 PST 2008 (by Timo Virtaneva <timo (at) virtaneva dot com> on Thu Oct 11 10:00:00 EET 2007)
403 + Changed the header and the search criteria so that the same email-box can be used for all smtp-servers
404 + version 0.5.3
405
406 Mon Jan 28 22:11:02 PST 2008
407 + fixed a bug, smtp-password and imap-password are now string parameters
408 + added --alert option to allow selection of which plugin(s) should cause a WARNING or CRITICAL alert
409 + version 0.6
410
411 Mon Feb 11 19:09:37 PST 2008
412 + fixed a bug for embedded perl version, variable "%status" will not stay shared in load_modules
413 + version 0.6.1
414
415 Mon May 26 10:39:19 PDT 2008
416 + added --file option to allow plugin to record status information into a tab-delimited file
417 + changed default token from U_X_Y to U-X-Y
418 + version 0.6.2
419
420 Wed Jan 14 08:29:35 PST 2009
421 + fixed a bug that the --header parameter was not being passed to the smtp plugin.
422 + version 0.6.3
423
424 Mon Jun 8 15:43:48 PDT 2009
425 + added performance data for use with PNP4Nagios! (thanks to Ben Ritcey for the patch)
426 + version 0.6.4
427
428 Wed Sep 16 07:10:10 PDT 2009
429 + added elapsed time in seconds to performance data
430 + version 0.6.5
431
432 Fri Oct 8 19:48:44 PDT 2010
433 + fixed uniform IMAP and SMTP username and password bug (thanks to Micle Moerenhout for pointing it out)
434 + version 0.6.6
435
436 Mon Jan 3 08:24:23 PST 2011
437 + added shell escaping for smtp-username, smtp-password, mailto, mailfrom, imap-username, and imap-password arguments
438 + version 0.7.0
439
440 Fri May 6 08:35:09 AST 2011
441 + added --hires option to enable use of Time::Hires if available
442 + version 0.7.1
443
444 Sun Jun 12 17:17:06 AST 2011
445 + added --imap-mailbox option to pass through to check_imap_receive --mailbox option
446 + added --ssl option to conveniently enable both --smtp-tls and --imap-ssl
447 + version 0.7.2
448
449 =head1 AUTHOR
450
451 Jonathan Buhacoff <[email protected]>
452
453 =head1 COPYRIGHT AND LICENSE
454
455 Copyright (C) 2005-2011 Jonathan Buhacoff
456
457 This program is free software; you can redistribute it and/or modify
458 it under the terms of the GNU General Public License as published by
459 the Free Software Foundation; either version 3 of the License, or
460 (at your option) any later version.
461
462 This program is distributed in the hope that it will be useful,
463 but WITHOUT ANY WARRANTY; without even the implied warranty of
464 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
465 GNU General Public License for more details.
466
467 You should have received a copy of the GNU General Public License
468 along with this program. If not, see <http://www.gnu.org/licenses/>.
469
470 http://www.gnu.org/licenses/gpl.txt
471
472 =cut