2
0
mirror of https://github.com/munin-monitoring/contrib.git synced 2018-11-08 00:59:34 +01:00

Merge pull request #655 from drzraf/patch-1

Ability to configure Apache access_log field number
This commit is contained in:
Kenyon Ralph 2015-10-27 11:05:54 -07:00
commit 03aa3e1f37

View File

@ -1,5 +1,4 @@
#!/usr/bin/perl -w
# $Id$
# Author: Nicolas Mendoza <nicolasm@opera.com> - 2008-06-18
#
# Monitors the average time requests matching a custom regexp takes
@ -16,12 +15,17 @@
# For instance:
# LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\" %T %v"
# Check http://httpd.apache.org/docs/2.2/mod/mod_log_config.html#formats for more info
#
# Configurable variables
# fieldno - Override the default field number
# linecount - How many last request to consider
#%# family=auto
use strict;
my $LAST_N_REQUESTS = 100000; # calculate based on this amount of requests
my $LAST_N_REQUESTS = exists $ENV{'linecount'} ? $ENV{'linecount'} : 100000; # calculate based on this amount of requests
my $TIME_FIELD_INDEX = exists $ENV{'fieldno'} ? $ENV{'fieldno'} : -2; # second last field
my $ACCESS_LOG_PATTERN = '/var/log/apache2/access.log.*'; # log pattern, if many it will take the last one.
my $TIME_FIELD_INDEX = -2; # second last field
my $config =<< "CONFIG"
graph_title Apache average seconds last $LAST_N_REQUESTS requests