root / plugins / mail / mixminion @ 31412baa
Historique | Voir | Annoter | Télécharger (3,38 ko)
| 1 |
#!/bin/sh |
|---|---|
| 2 |
# |
| 3 |
# plugin to monitor mixminion stats |
| 4 |
# pesco 2011, isc license |
| 5 |
|
| 6 |
# munin metadata: |
| 7 |
#%# capabilities=autoconf suggest |
| 8 |
|
| 9 |
PATH=/bin:/usr/bin:/usr/local/bin |
| 10 |
|
| 11 |
case $0 in |
| 12 |
*_relay) |
| 13 |
FIELDNAMES="AttemptedRelay SuccessfulRelay FailedRelay UnretriableRelay ReceivedPacket";; |
| 14 |
*_exit) |
| 15 |
FIELDNAMES="AttemptedDelivery SuccessfulDelivery FailedDelivery UnretriableDelivery";; |
| 16 |
*) |
| 17 |
FIELDNAMES="ReceivedConnection AttemptedConnect SuccessfulConnect FailedConnect";; |
| 18 |
esac |
| 19 |
|
| 20 |
case $1 in |
| 21 |
autoconf) |
| 22 |
# see if we got mixminion installed |
| 23 |
if which mixminiond >/dev/null; then |
| 24 |
echo "yes" |
| 25 |
else |
| 26 |
echo "no" |
| 27 |
fi |
| 28 |
exit 0;; |
| 29 |
suggest) |
| 30 |
desc="`cat /var/lib/mixminion/current-desc`" |
| 31 |
echo connections |
| 32 |
grep -q '^\[Incoming/MMTP\]' "$desc" && echo relay |
| 33 |
grep -q '^\[Delivery/SMTP\]' "$desc" && echo exit |
| 34 |
exit 0;; |
| 35 |
config) |
| 36 |
echo "graph_category mail" |
| 37 |
echo "graph_args --base 1000 -l 0" |
| 38 |
case $0 in |
| 39 |
*_relay) |
| 40 |
cat <<'EOM' |
| 41 |
graph_title Mixminion relay |
| 42 |
graph_vlabel packets per second |
| 43 |
|
| 44 |
AttemptedRelay.label packets to relay |
| 45 |
AttemptedRelay.info Total number of packets that we attempted to relay |
| 46 |
AttemptedRelay.draw LINE2 |
| 47 |
|
| 48 |
FailedRelay.label relay errors |
| 49 |
FailedRelay.info Number of packets that we (momentarily) failed to relay |
| 50 |
FailedRelay.draw AREASTACK |
| 51 |
|
| 52 |
UnretriableRelay.label permanent failures |
| 53 |
UnretriableRelay.info Number of packets that we permanently gave up trying to relay |
| 54 |
UnretriableRelay.draw AREASTACK |
| 55 |
|
| 56 |
SuccessfulRelay.label relay success |
| 57 |
SuccessfulRelay.info Number of packets that we successfully relayed |
| 58 |
SuccessfulRelay.draw AREASTACK |
| 59 |
SuccessfulRelay.graph no |
| 60 |
|
| 61 |
ReceivedPacket.label incoming packets |
| 62 |
ReceivedPacket.info Total number of packets that we received |
| 63 |
ReceivedPacket.draw LINE2 |
| 64 |
EOM |
| 65 |
;; |
| 66 |
*_exit) |
| 67 |
cat <<'EOM' |
| 68 |
graph_title Mixminion exit |
| 69 |
graph_vlabel messages per second |
| 70 |
|
| 71 |
AttemptedDelivery.label messages to deliver |
| 72 |
AttemptedDelivery.info Total number of emails that we tried to deliver |
| 73 |
AttemptedDelivery.draw LINE2 |
| 74 |
|
| 75 |
FailedDelivery.label delivery errors |
| 76 |
FailedDelivery.info Number of emails that we (momentarily) failed to deliver |
| 77 |
FailedDelivery.draw AREASTACK |
| 78 |
|
| 79 |
UnretriableDelivery.label permanent failures |
| 80 |
UnretriableDelivery.info Number of emails that we permanently gave up trying to deliver |
| 81 |
UnretriableDelivery.draw AREASTACK |
| 82 |
|
| 83 |
SuccessfulDelivery.label delivery successes |
| 84 |
SuccessfulDelivery.info Number of emails successfully delivered |
| 85 |
SuccessfulDelivery.draw AREASTACK |
| 86 |
SuccessfulDelivery.graph no |
| 87 |
EOM |
| 88 |
;; |
| 89 |
*) |
| 90 |
cat <<'EOM' |
| 91 |
graph_title Mixminion connections |
| 92 |
graph_vlabel connections in (-) / out (+) per second |
| 93 |
|
| 94 |
ReceivedConnection.label incoming |
| 95 |
ReceivedConnection.info number of successful incoming connections |
| 96 |
ReceivedConnection.graph no |
| 97 |
|
| 98 |
AttemptedConnect.label total conn's |
| 99 |
AttemptedConnect.info Total number of attempted outgoing connections |
| 100 |
AttemptedConnect.draw LINE2 |
| 101 |
AttemptedConnect.negative ReceivedConnection |
| 102 |
|
| 103 |
FailedConnect.label conn. failures |
| 104 |
FailedConnect.info Number of failed outgoing connections |
| 105 |
FailedConnect.draw AREASTACK |
| 106 |
|
| 107 |
SuccessfulConnect.label successful |
| 108 |
SuccessfulConnect.info Number of successful in-/outgoin connections |
| 109 |
SuccessfulConnect.draw AREASTACK |
| 110 |
SuccessfulConnect.graph no |
| 111 |
EOM |
| 112 |
;; |
| 113 |
esac |
| 114 |
for field in $FIELDNAMES; do |
| 115 |
echo "$field.type DERIVE" |
| 116 |
echo "$field.min 0" |
| 117 |
done |
| 118 |
exit 0;; |
| 119 |
esac |
| 120 |
|
| 121 |
mixminion server-stats 2>/dev/null | perl -e ' |
| 122 |
while(<STDIN>) {
|
| 123 |
if(/^ *([[:alnum:]]+): *([.[:digit:]]+)/ && |
| 124 |
grep {$_ eq $1} @ARGV) {
|
| 125 |
print "$1.value $2\n"; |
| 126 |
} |
| 127 |
} |
| 128 |
' $FIELDNAMES |
