19 | | # |
---|
20 | | # Plugin to monitor the load on a cyrus imapd server |
---|
21 | | # |
---|
22 | | # Usage: Link or copy into the munin-node plugin directory |
---|
23 | | # |
---|
24 | | # Installation node: Should most likely run as root: |
---|
25 | | # [cyrus-imapd] |
---|
26 | | # user root |
---|
27 | | # |
---|
28 | | # |
---|
29 | | # Magic markers (optional - only used by munin-config and some |
---|
30 | | # installation scripts): |
---|
31 | | # |
---|
32 | | #%# family=contrib |
---|
33 | | #%# capabilities=autoconf |
---|
| 19 | : <<=cut |
---|
| 20 | |
---|
| 21 | =head1 NAME |
---|
| 22 | |
---|
| 23 | cyrus-imapd - Munin plugin to monitor the load on a cyrus imapd server |
---|
| 24 | |
---|
| 25 | =head1 CONFIGURATION |
---|
| 26 | |
---|
| 27 | The user running this plugin needs read and write access to the |
---|
| 28 | cyrus-imapd proc directory. You will need to add the following to the |
---|
| 29 | munin-node/plugin configuration: |
---|
| 30 | |
---|
| 31 | [cyrus-imapd] |
---|
| 32 | user root |
---|
| 33 | |
---|
| 34 | =head1 INTERPRETATION |
---|
| 35 | |
---|
| 36 | This plugin should be pretty self explanatory. |
---|
| 37 | |
---|
| 38 | It displays the following three datapoints: |
---|
| 39 | |
---|
| 40 | - Total number of open connections (both in authenticated and |
---|
| 41 | non-authenticated state) |
---|
| 42 | - Number of authenticated sessions |
---|
| 43 | - Number of unique users |
---|
| 44 | |
---|
| 45 | =head1 MAGIC MARKERS |
---|
| 46 | |
---|
| 47 | #%# family=contrib |
---|
| 48 | #%# capabilities=autoconf suggest |
---|
| 49 | |
---|
| 50 | =head1 VERSION |
---|
| 51 | |
---|
| 52 | $Id$ |
---|
| 53 | |
---|
| 54 | =head1 BUGS |
---|
| 55 | |
---|
| 56 | None known. If you find any, please put in a ticket at <https://trac.bawue.org/munin/newticket>. |
---|
| 57 | |
---|
| 58 | =head1 AUTHOR |
---|
| 59 | |
---|
| 60 | Andreas Thienemann <andreas@bawue.net> |
---|
| 61 | |
---|
| 62 | =head1 LICENSE |
---|
| 63 | |
---|
| 64 | GPLv2 |
---|
| 65 | |
---|
| 66 | =cut |
---|
| 122 | if [ $cons -lt 0 ]; then |
---|
| 123 | # Print the number of connections to the imap server |
---|
| 124 | echo "connections.value $cons" |
---|
| 125 | |
---|
| 126 | # Read the proc files and get the logged in users |
---|
| 127 | echo -n "authenticated_users.value " |
---|
| 128 | awk '{ split(substr($0, match($0, "]")+1), a); if (a[1] != "") print a[1] }' ${PROCDIR}/* | wc -l |
---|
| 129 | |
---|
| 130 | # Read the proc files and get the number of unique users |
---|
| 131 | echo -n "unique_users.value " |
---|
| 132 | awk '{ split(substr($0, match($0, "]")+1), a); if (a[1] != "") print a[1] }' ${PROCDIR}/* | sort -u | wc -l |
---|
| 133 | else |
---|
| 134 | echo "connections.value 0" |
---|
| 135 | echo "authenticated_users.value 0" |
---|
| 136 | echo "unique_users.value 0" |
---|
| 137 | fi |
---|