Projet

Général

Profil

Paste
Télécharger au format
Statistiques
| Branche: | Révision:

root / plugins / php / php_errors @ ec4951b7

Historique | Voir | Annoter | Télécharger (1,31 ko)

1 7f0db9e8 metfan
#!/bin/sh
2
#
3
# Plugin to monitor error.log from apache server.
4
# Revision 0.1  2011/06/17 12:00:00  Ulrich Lusseau
5
# Initial revision
6
#
7
# Parameters:
8
#
9
#       config   (required)
10
#       autoconf (optional - used by munin-config)
11
#
12
# Magick markers (optional):
13
#%# family=auto
14
#%# capabilities=autoconf
15
# config example for /etc/munin/plugin-conf.d/munin-node
16
#[apache_log]
17
#user root
18
#env.logfile /home/newsite/logs/errors.log
19
#
20
 
21
 
22
LOG=${logfile:-/var/log/apache2/error.log}
23
 
24
 
25
if [ "$1" = "autoconf" ]; then
26
        if [ -r "$LOG" ]; then
27
                echo yes
28
                exit 0
29
        else
30
                echo no
31
                exit 1
32
        fi
33
fi
34
 
35
if [ "$1" = "config" ]; then
36
 
37
        echo 'graph_title PHP Errors from ' $LOG
38
        echo 'graph_args --base 1000 -l 0'
39
        echo 'graph_vlabel Errors'
40
        echo 'LogWarning.label PHP Warning errors'
41
        echo 'LogNotice.label PHP Notice errors'
42
        echo 'LogFatal.label PHP Fatal errors'
43
        echo 'LogFile.label File does not exist errors'
44
        exit 0
45
fi
46
 
47
awk 'BEGIN{c["LogWarning"]=0;c["LogNotice"]=0;c["LogFatal"]=0;c["LogFile"]=0; }
48
     /PHP Warning/{c["LogWarning"]++}
49
     /PHP Notice/{c["LogNotice"]++}
50
     /PHP Fatal error/{c["LogFatal"]++}
51
     /File does not exist/{c["LogFile"]++}
52
     END{for(i in c){print i".value " c[i]} }' < $LOG