Projet

Général

Profil

Révision c3cf6b45

IDc3cf6b45d32725419d806a5f64bb08eadf7763a6
Parent 65e4a94c
Enfant c324c34e

Ajouté par Raphaël Droz il y a plus de 9 ans

php_errors handle multiple logs

Voir les différences:

plugins/php/php_errors
1
#!/bin/sh
1
#!/bin/bash
2 2
#
3 3
# Plugin to monitor error.log from apache server.
4 4
# Revision 0.1  2011/06/17 12:00:00  Ulrich Lusseau
......
14 14
#%# capabilities=autoconf
15 15
# config example for /etc/munin/plugin-conf.d/munin-node
16 16
#[apache_log]
17
#user root
18
#env.logfile /home/newsite/logs/errors.log
17
#user www-data
18
#env.logfile /home/newsite/logs/errors.log /var/log/php/otherlog.log
19 19
#
20 20
 
21 21
 
22
LOG=${logfile:-/var/log/apache2/error.log}
22
LOGS=${logfile:-/var/log/apache2/error.log}
23 23
 
24 24
 
25 25
if [ "$1" = "autoconf" ]; then
26
        if [ -r "$LOG" ]; then
27
                echo yes
28
                exit 0
29
        else
30
                echo no
31
                exit 1
26
    for LOG in $LOGS; do
27
	if [[ ! -r $LOGS ]]; then
28
            echo no
29
            exit 1
32 30
        fi
31
    done
32

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

Formats disponibles : Unified diff