root / plugins / other / horde @ e5ce7492
Historique | Voir | Annoter | Télécharger (1,63 ko)
| 1 | d5275a01 | Patrick | #!/bin/bash |
|---|---|---|---|
| 2 | # |
||
| 3 | # Script to show number of logins, errors and failed logins in horde3 |
||
| 4 | # |
||
| 5 | # |
||
| 6 | # by Patrick Z. |
||
| 7 | # Comments and improvements can be sent to (admin<AT>tournament'dot'DE) |
||
| 8 | # |
||
| 9 | # possible problems: |
||
| 10 | # - horde3.log isn't readable by user munin (see |
||
| 11 | # /var/log/munin/munin-node.log for errors) |
||
| 12 | # |
||
| 13 | # -to solve, copy this in /etc/munin/plugin-conf.d/munin-node |
||
| 14 | # [horde3] |
||
| 15 | # user root |
||
| 16 | # |
||
| 17 | # |
||
| 18 | # formely known as postfix_mail_stats by: |
||
| 19 | # Boudewijn Ector, for Boudewijn Ector IT. |
||
| 20 | # Loosely based on http://munin.projects.linpro.no/attachment/wiki/PluginCat/postfix_messages_hourly.txt |
||
| 21 | # |
||
| 22 | # |
||
| 23 | # Parameters understood: |
||
| 24 | # |
||
| 25 | # config (required) |
||
| 26 | # autoconf (optional - used by munin-config) |
||
| 27 | # |
||
| 28 | # |
||
| 29 | # Magic markers (optional - used by munin-config and installation |
||
| 30 | # scripts): |
||
| 31 | # |
||
| 32 | #%# family=auto |
||
| 33 | #%# capabilities=autoconf |
||
| 34 | |||
| 35 | |||
| 36 | LOGFILE=/var/log/horde/horde3.log |
||
| 37 | DATE=`date '+%b %d %H'` |
||
| 38 | MAXLABEL=20 |
||
| 39 | |||
| 40 | if [ "$1" = "autoconf" ]; then |
||
| 41 | echo yes |
||
| 42 | exit 0 |
||
| 43 | fi |
||
| 44 | |||
| 45 | if [ "$1" = "config" ]; then |
||
| 46 | |||
| 47 | echo 'graph_title horde3' |
||
| 48 | echo 'graph_info This graph shows Horde3 logins, logouts and errors.' |
||
| 49 | echo 'graph_vlabel per hour' |
||
| 50 | echo 'logins.label logins' |
||
| 51 | echo 'failedlogins.label failed logins' |
||
| 52 | echo 'allerrors.label errors' |
||
| 53 | echo 'logouts.label logouts' |
||
| 54 | exit 0 |
||
| 55 | fi |
||
| 56 | |||
| 57 | echo -en "logins.value " |
||
| 58 | echo $(grep "Login success for" $LOGFILE | grep "$DATE" | wc -l) |
||
| 59 | echo -n |
||
| 60 | echo -en "failedlogins.value " |
||
| 61 | echo $(grep "FAILED LOGIN" $LOGFILE | grep "$DATE" | wc -l) |
||
| 62 | echo -en "allerrors.value " |
||
| 63 | echo $(grep "error" $LOGFILE | grep "$DATE" | wc -l) |
||
| 64 | echo -en "logouts.value " |
||
| 65 | echo $(grep "Logout for" $LOGFILE | grep "$DATE" | wc -l) |
