PluginCat: auth

File auth, 1.0 kB (added by jintxo, 6 years ago)

Extremely simple auth.log file parser

Line 
1 #!/bin/sh
2 #
3 #
4 # Script to show auth stuff
5 #
6 # Parameters understood:
7 #
8 #       config   (required)
9 #       autoconf (optional - used by munin-config)
10 #
11 #
12 # Magic markers (optional - used by munin-config and installation
13 # scripts):
14 #
15 #%# family=auto
16 #%# capabilities=autoconf
17
18 MAXLABEL=20
19
20 if [ "$1" = "autoconf" ]; then
21         echo yes
22         exit 0
23 fi
24
25 if [ "$1" = "config" ]; then
26
27         echo 'graph_title Auth Log Parser'
28         echo 'graph_args --base 1000 -l 0'
29         echo 'graph_vlabel days'
30         echo 'illegal_user.label Illegal Username'
31         echo 'possible_breakin.label Possible Breakin Attempt'
32         echo 'authentication_failure.label Authentication Failure'
33         exit 0
34 fi
35
36 echo -en "illegal_user.value "
37 echo $(grep -i "illegal user" /var/log/auth.log | grep "`date '+%b %d'`" | wc -l)
38 echo -n
39 echo -en "possible_breakin.value "
40 echo $(grep -i "breakin attempt" /var/log/auth.log | grep "`date '+%b %d'`" | wc -l)
41 echo -en "authentication_failure.value "
42 echo $(grep -i "authentication failure" /var/log/auth.log | grep "`date '+%b %d'`" | wc -l)