root / plugins / other / freeradius @ 7da1b039
Historique | Voir | Annoter | Télécharger (3,04 ko)
| 1 | 0397aff3 | Daniele Albrizio | #!/bin/sh |
|---|---|---|---|
| 2 | # This program is free software; you can redistribute it and/or modify |
||
| 3 | # it under the terms of the GNU General Public License as published by |
||
| 4 | # the Free Software Foundation; either version 2 of the License, or |
||
| 5 | # (at your option) any later version. |
||
| 6 | # |
||
| 7 | # This program is distributed in the hope that it will be useful, |
||
| 8 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
| 9 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
| 10 | # GNU General Public License for more details. |
||
| 11 | # |
||
| 12 | # You should have received a copy of the GNU General Public License |
||
| 13 | # along with this program; if not, write to the Free Software |
||
| 14 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
||
| 15 | # |
||
| 16 | # Written by Daniele Albrizio <daniele@albrizio.dyndns.org> maj 2007 |
||
| 17 | # Based upon Lasse Karstensen <lkarsten@hyse.org> june 2006 bash plugin foor the main structure and |
||
| 18 | # mike@gaertner.cc 2006 perl plugin for the "total requests graph" idea |
||
| 19 | # |
||
| 20 | #### |
||
| 21 | # Shell plugin to graph the daily amount of per second or per minute freeradius login requests. |
||
| 22 | # |
||
| 23 | # Plugin Configuration for your munin plugins conf (/etc/munin/plugin-conf.d/munin-node in Debian) |
||
| 24 | # |
||
| 25 | # [freeradius] |
||
| 26 | # user <a user that can read freeradius logfiles> |
||
| 27 | # env.radius_log=/where/your/freeradius/log.is (if not set defaults to syslog) |
||
| 28 | # env.graph_period=<minute|second> (if not set defaults to second) |
||
| 29 | # |
||
| 30 | # |
||
| 31 | # Magic markers - optional - used by installation scripts and |
||
| 32 | # munin-config: |
||
| 33 | # |
||
| 34 | #%# family=manual |
||
| 35 | #%# capabilities=autoconf |
||
| 36 | |||
| 37 | if [ "$1" = "autoconf" ]; then |
||
| 38 | echo yes |
||
| 39 | exit 0 |
||
| 40 | fi |
||
| 41 | |||
| 42 | if [ "$1" = "config" ]; then |
||
| 43 | echo 'graph_title freeradius requests' |
||
| 44 | echo 'graph_args --base 1000 -l 0 ' |
||
| 45 | if [ -n ${graph_period} ]; then
|
||
| 46 | echo 'graph_period '${graph_period}
|
||
| 47 | fi |
||
| 48 | echo 'graph_vlabel requests / ${graph_period}'
|
||
| 49 | echo 'graph_category Other' |
||
| 50 | |||
| 51 | echo 'requests.label Authentication requests' |
||
| 52 | echo 'requests.info freeRADIUS authentication requests' |
||
| 53 | echo 'requests.type DERIVE' |
||
| 54 | echo 'requests.min 0' |
||
| 55 | |||
| 56 | echo 'success.label Login OK' |
||
| 57 | echo 'success.info Successful freeRADIUS authentications' |
||
| 58 | echo 'success.type DERIVE' |
||
| 59 | echo 'success.min 0' |
||
| 60 | |||
| 61 | echo 'failed.label Login FAILED' |
||
| 62 | echo 'failed.info Failed freeRADIUS authentications' |
||
| 63 | echo 'failed.type DERIVE' |
||
| 64 | echo 'failed.min 0' |
||
| 65 | |||
| 66 | exit 0 |
||
| 67 | fi |
||
| 68 | |||
| 69 | |||
| 70 | if [ -z ${radius_log} ]; then
|
||
| 71 | echo -n "requests.value " && egrep "`date +%b\ %e`.*radiusd.*Login" /var/log/messages|wc -l |
||
| 72 | echo -n "success.value " && egrep "`date +%b\ %e`.*radiusd.*Login OK" /var/log/messages|wc -l |
||
| 73 | echo -n "failed.value " && egrep "`date +%b\ %e`.*radiusd.*Login incorrect" /var/log/messages|wc -l |
||
| 74 | else |
||
| 75 | echo -n "requests.value " && egrep "`date +%b\ %e`.*Login" ${radius_log}|wc -l
|
||
| 76 | echo -n "success.value " && egrep "`date +%b\ %e`.*Login OK" ${radius_log}|wc -l
|
||
| 77 | echo -n "failed.value " && egrep "`date +%b\ %e`.*Login incorrect" ${radius_log}|wc -l
|
||
| 78 | fi |
