Projet

Général

Profil

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

root / plugins / php / php_errors @ c3cf6b45

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

1
#!/bin/bash
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 www-data
18
#env.logfile /home/newsite/logs/errors.log /var/log/php/otherlog.log
19
#
20
 
21
 
22
LOGS=${logfile:-/var/log/apache2/error.log}
23
 
24
 
25
if [ "$1" = "autoconf" ]; then
26
    for LOG in $LOGS; do
27
	if [[ ! -r $LOGS ]]; then
28
            echo no
29
            exit 1
30
        fi
31
    done
32

    
33
    echo yes
34
    exit 0
35
fi
36
 
37
if [ "$1" = "config" ]; then
38
        echo 'graph_title PHP Errors from ' $LOGS
39
        echo 'graph_args --base 1000 -l 0'
40
        echo 'graph_vlabel Errors'
41
        echo 'LogWarning.label PHP Warning errors'
42
        echo 'LogNotice.label PHP Notice errors'
43
        echo 'LogFatal.label PHP Fatal errors'
44
        echo 'LogFile.label File does not exist errors'
45
        exit 0
46
fi
47
 
48
awk 'BEGIN{c["LogWarning"]=0;c["LogNotice"]=0;c["LogFatal"]=0;c["LogFile"]=0; }
49
     /PHP Warning/{c["LogWarning"]++}
50
     /PHP Notice/{c["LogNotice"]++}
51
     /PHP Fatal error/{c["LogFatal"]++}
52
     /File does not exist/{c["LogFile"]++}
53
     END{for(i in c){print i".value " c[i]} }' $LOGS