mirror of
https://github.com/munin-monitoring/contrib.git
synced 2018-11-08 00:59:34 +01:00
commit
779d9831ec
@ -1,52 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Plugin to monitor error.log from apache server.
|
||||
# Revision 0.1 2011/06/17 12:00:00 Ulrich Lusseau
|
||||
# Initial revision
|
||||
#
|
||||
# Parameters:
|
||||
#
|
||||
# config (required)
|
||||
# autoconf (optional - used by munin-config)
|
||||
#
|
||||
# Magick markers (optional):
|
||||
#%# family=auto
|
||||
#%# capabilities=autoconf
|
||||
# config example for /etc/munin/plugin-conf.d/munin-node
|
||||
#[apache_log]
|
||||
#user root
|
||||
#env.logfile /home/newsite/logs/errors.log
|
||||
#
|
||||
|
||||
|
||||
LOG=${logfile:-/var/log/apache2/error.log}
|
||||
|
||||
|
||||
if [ "$1" = "autoconf" ]; then
|
||||
if [ -r "$LOG" ]; then
|
||||
echo yes
|
||||
exit 0
|
||||
else
|
||||
echo no
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$1" = "config" ]; then
|
||||
|
||||
echo 'graph_title PHP Errors from ' $LOG
|
||||
echo 'graph_args --base 1000 -l 0'
|
||||
echo 'graph_vlabel Errors'
|
||||
echo 'LogWarning.label PHP Warning errors'
|
||||
echo 'LogNotice.label PHP Notice errors'
|
||||
echo 'LogFatal.label PHP Fatal errors'
|
||||
echo 'LogFile.label File does not exist errors'
|
||||
exit 0
|
||||
fi
|
||||
|
||||
awk 'BEGIN{c["LogWarning"]=0;c["LogNotice"]=0;c["LogFatal"]=0;c["LogFile"]=0; }
|
||||
/PHP Warning/{c["LogWarning"]++}
|
||||
/PHP Notice/{c["LogNotice"]++}
|
||||
/PHP Fatal error/{c["LogFatal"]++}
|
||||
/File does not exist/{c["LogFile"]++}
|
||||
END{for(i in c){print i".value " c[i]} }' < $LOG
|
66
plugins/php/php_errors_
Normal file
66
plugins/php/php_errors_
Normal file
@ -0,0 +1,66 @@
|
||||
#!/bin/bash
|
||||
|
||||
: << =cut
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Plugin to monitor error.log from apache server
|
||||
|
||||
=head1 CONFIGURATION
|
||||
|
||||
[php_errors_newsite]
|
||||
user www-data
|
||||
env.logfile /home/newsite/logs/errors.log /var/log/php/otherlog.log
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Raphaël Droz <raphael.droz+floss@gmail.com>
|
||||
|
||||
Revision 0.2 2016/03/23 22:00:00 Raphaël Droz
|
||||
Revision 0.1 2011/06/17 12:00:00 Ulrich Lusseau
|
||||
|
||||
=head1 MAGICK MARKERS
|
||||
|
||||
#%# family=auto
|
||||
#%# capabilities=autoconf
|
||||
|
||||
=cut
|
||||
|
||||
|
||||
. $MUNIN_LIBDIR/plugins/plugin.sh
|
||||
|
||||
LOGS=${logfile:-/var/log/apache2/error.log}
|
||||
|
||||
|
||||
if [[ $1 == autoconf ]]; then
|
||||
for LOG in $LOGS; do
|
||||
if [[ ! -r $LOGS ]]; then
|
||||
echo no
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
echo yes
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [[ $1 == config ]]; then
|
||||
echo 'graph_title PHP Errors from ' $LOGS
|
||||
echo 'graph_args --base 1000 -l 0'
|
||||
echo 'graph_vlabel Errors'
|
||||
echo 'LogWarning.label PHP Warning errors'
|
||||
echo 'LogNotice.label PHP Notice errors'
|
||||
echo 'LogFatal.label PHP Fatal errors'
|
||||
echo 'LogFile.label File does not exist errors'
|
||||
exit 0
|
||||
fi
|
||||
|
||||
awk -f - $LOGS <<EOF
|
||||
BEGIN { c["LogWarning"]=0; c["LogNotice"]=0; c["LogFatal"]=0; c["LogFile"]=0; }
|
||||
/PHP Warning/{ c["LogWarning"]++ }
|
||||
/PHP Notice/{ c["LogNotice"]++ }
|
||||
/PHP Fatal error/{ c["LogFatal"]++ }
|
||||
/File does not exist/{ c["LogFile"]++ }
|
||||
|
||||
END{ for(i in c) { print i".value " c[i] } }
|
||||
EOF
|
Loading…
Reference in New Issue
Block a user