root / plugins / mail / nullmailer_queue @ 17f78427
Historique | Voir | Annoter | Télécharger (1,84 ko)
| 1 | 4ca4e8d9 | Bert Peters | #!/bin/sh |
|---|---|---|---|
| 2 | 0d775b28 | Bert Peters | |
| 3 | : <<=cut |
||
| 4 | |||
| 5 | =head1 NAME |
||
| 6 | |||
| 7 | nullmailer_queue - monitor for nullmailer's send queue. |
||
| 8 | |||
| 9 | =head1 APPLICABLE SYSTEMS |
||
| 10 | |||
| 11 | This plugin is applicable to any system running the nullmailer MTA. |
||
| 12 | |||
| 13 | =head1 CONFIGURATION |
||
| 14 | |||
| 15 | This plugin needs to be able to read the nullmailer queue, so it |
||
| 16 | will need to run as that user or root. |
||
| 17 | |||
| 18 | Additionally, the nullmailer queue directory may vary; in that case you |
||
| 19 | can specify it with the "queuedir" and "errordir" environment variables. |
||
| 20 | |||
| 21 | Example: |
||
| 22 | |||
| 23 | [nullmailer_queue] |
||
| 24 | user nullmail |
||
| 25 | env.queuedir /var/spool/nullmailer/queue |
||
| 26 | env.errordir /var/spool/nullmailer/failed |
||
| 27 | |||
| 28 | =head1 INTERPRETATION |
||
| 29 | |||
| 30 | This plugin will draw a stack of 2: the number of emails in the queue, and |
||
| 31 | the number of emails that have permanently failed sending. The latter has |
||
| 32 | a warning attached, since those should never happen. |
||
| 33 | |||
| 34 | =head1 MAGIC MARKERS |
||
| 35 | |||
| 36 | #%# family=auto |
||
| 37 | #%# capabilities=autoconf |
||
| 38 | |||
| 39 | =head1 VERSION |
||
| 40 | |||
| 41 | 1.0.0 |
||
| 42 | |||
| 43 | =head1 AUTHOR |
||
| 44 | |||
| 45 | Bert Peters <bert@bertptrs.nl> |
||
| 46 | |||
| 47 | =head1 LICENSE |
||
| 48 | |||
| 49 | GPLv2 |
||
| 50 | |||
| 51 | =cut |
||
| 52 | |||
| 53 | queuedir=${queuedir:-/var/spool/nullmailer/queue}
|
||
| 54 | errordir=${errordir:-/var/spool/nullmailer/failed}
|
||
| 55 | |||
| 56 | case $1 in |
||
| 57 | autoconf) |
||
| 58 | 189c3953 | Lars Kruse | if command -v nullmailer-queue >/dev/null 2>/dev/null; then |
| 59 | 4ca4e8d9 | Bert Peters | [ -r "$queuedir" ] && echo yes || echo "no (queue dir not readable)" |
| 60 | 0d775b28 | Bert Peters | else |
| 61 | echo "no (nullmailer not installed)" |
||
| 62 | fi |
||
| 63 | ;; |
||
| 64 | |||
| 65 | config) |
||
| 66 | cat <<-EOF |
||
| 67 | graph_args -l 0 |
||
| 68 | graph_title Nullmailer queue |
||
| 69 | graph_vlabel emails |
||
| 70 | graph_total total |
||
| 71 | graph_category mail |
||
| 72 | |||
| 73 | queue.label queued |
||
| 74 | queue.draw AREASTACK |
||
| 75 | queue.info Number of emails currently in the queue |
||
| 76 | |||
| 77 | failed.label failed |
||
| 78 | failed.draw AREASTACK |
||
| 79 | failed.warning 0:0 |
||
| 80 | failed.info Number of emails that have permanently failed to send |
||
| 81 | EOF |
||
| 82 | ;; |
||
| 83 | |||
| 84 | *) |
||
| 85 | echo "queue.value $(find "$queuedir" -type f | wc -l)" |
||
| 86 | # Failed does not exist until there has been a failure, so mute the "file not found" |
||
| 87 | echo "failed.value $(find "$errordir" -type f 2> /dev/null | wc -l)" |
||
| 88 | ;; |
||
| 89 | esac |
