1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-22 02:51:03 +00:00

php_errors handle multiple logs

This commit is contained in:
Raphaël Droz 2016-03-23 22:33:22 -03:00
parent 65e4a94cea
commit c3cf6b45d3

View file

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
# #
# Plugin to monitor error.log from apache server. # Plugin to monitor error.log from apache server.
# Revision 0.1 2011/06/17 12:00:00 Ulrich Lusseau # Revision 0.1 2011/06/17 12:00:00 Ulrich Lusseau
@ -14,27 +14,28 @@
#%# capabilities=autoconf #%# capabilities=autoconf
# config example for /etc/munin/plugin-conf.d/munin-node # config example for /etc/munin/plugin-conf.d/munin-node
#[apache_log] #[apache_log]
#user root #user www-data
#env.logfile /home/newsite/logs/errors.log #env.logfile /home/newsite/logs/errors.log /var/log/php/otherlog.log
# #
LOG=${logfile:-/var/log/apache2/error.log} LOGS=${logfile:-/var/log/apache2/error.log}
if [ "$1" = "autoconf" ]; then if [ "$1" = "autoconf" ]; then
if [ -r "$LOG" ]; then for LOG in $LOGS; do
echo yes if [[ ! -r $LOGS ]]; then
exit 0
else
echo no echo no
exit 1 exit 1
fi fi
done
echo yes
exit 0
fi fi
if [ "$1" = "config" ]; then if [ "$1" = "config" ]; then
echo 'graph_title PHP Errors from ' $LOGS
echo 'graph_title PHP Errors from ' $LOG
echo 'graph_args --base 1000 -l 0' echo 'graph_args --base 1000 -l 0'
echo 'graph_vlabel Errors' echo 'graph_vlabel Errors'
echo 'LogWarning.label PHP Warning errors' echo 'LogWarning.label PHP Warning errors'
@ -49,4 +50,4 @@ awk 'BEGIN{c["LogWarning"]=0;c["LogNotice"]=0;c["LogFatal"]=0;c["LogFile"]=0; }
/PHP Notice/{c["LogNotice"]++} /PHP Notice/{c["LogNotice"]++}
/PHP Fatal error/{c["LogFatal"]++} /PHP Fatal error/{c["LogFatal"]++}
/File does not exist/{c["LogFile"]++} /File does not exist/{c["LogFile"]++}
END{for(i in c){print i".value " c[i]} }' < $LOG END{for(i in c){print i".value " c[i]} }' $LOGS