| 1 |
#!/usr/bin/perl |
|---|
| 2 |
# |
|---|
| 3 |
# simple monitor for use with monin & freeradius |
|---|
| 4 |
# |
|---|
| 5 |
# |
|---|
| 6 |
#%# family=auto |
|---|
| 7 |
#%# capabilities=autoconf |
|---|
| 8 |
|
|---|
| 9 |
my $ret = undef; |
|---|
| 10 |
|
|---|
| 11 |
if ( exists $ARGV[0] and $ARGV[0] eq "autoconf" ) { |
|---|
| 12 |
print "yes\n"; |
|---|
| 13 |
exit 0; |
|---|
| 14 |
} |
|---|
| 15 |
|
|---|
| 16 |
if ( exists $ARGV[0] and $ARGV[0] eq "config" ) |
|---|
| 17 |
{ |
|---|
| 18 |
|
|---|
| 19 |
print |
|---|
| 20 |
"graph_title FreeRADIUS Auth Log Parser\n", |
|---|
| 21 |
"graph_category FreeRADIUS\n", |
|---|
| 22 |
"graph_args --base 1000 -l 0\n", |
|---|
| 23 |
"graph_vlabel Auth Counters / \${graph_period}\n", |
|---|
| 24 |
|
|---|
| 25 |
"auth_request.label Authentication Requested\n", |
|---|
| 26 |
"auth_request.type DERIVE\n", |
|---|
| 27 |
"auth_request.max 3000\n", |
|---|
| 28 |
"auth_request.min 0\n", |
|---|
| 29 |
|
|---|
| 30 |
"auth_accept.label Authentication Accepted\n", |
|---|
| 31 |
"auth_accept.type DERIVE\n", |
|---|
| 32 |
"auth_accept.max 3000\n", |
|---|
| 33 |
"auth_accept.min 0\n", |
|---|
| 34 |
|
|---|
| 35 |
"auth_reject.label Authentication Rejected\n", |
|---|
| 36 |
"auth_reject.type DERIVE\n", |
|---|
| 37 |
"auth_reject.max 3000\n", |
|---|
| 38 |
"auth_reject.min 0\n"; |
|---|
| 39 |
|
|---|
| 40 |
exit 0; |
|---|
| 41 |
} |
|---|
| 42 |
|
|---|
| 43 |
open(LOG,"/var/log/radius/radius.log") or |
|---|
| 44 |
die "auth_request.value 0\nauth_accept.value 0\nauth_reject.value 0\n"; |
|---|
| 45 |
|
|---|
| 46 |
my ($auth_request,$auth_accept,$auth_accept) = (0,0,0); |
|---|
| 47 |
|
|---|
| 48 |
while (<LOG>){ |
|---|
| 49 |
|
|---|
| 50 |
if ( /Login/ ) { $auth_request ++ } |
|---|
| 51 |
if ( /Login OK/ ) { $auth_accept ++ } |
|---|
| 52 |
if ( /Login incorrect/ ) { $auth_reject ++ } |
|---|
| 53 |
|
|---|
| 54 |
} |
|---|
| 55 |
|
|---|
| 56 |
close (LOG); |
|---|
| 57 |
|
|---|
| 58 |
print "auth_request.value $auth_request\n", |
|---|
| 59 |
"auth_accept.value $auth_accept\n", |
|---|
| 60 |
"auth_reject.value $auth_reject\n"; |
|---|