The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Munin::Plugin::ApacheRequest - Monitor Apache requests with Munin

SYNOPSIS

This is the contents of a apache_request_$VHOST file, stored in the /etc/munin/plugins directory.

    #!/usr/bin/perl -w
    use strict;

    use Munin::Plugin::ApacheRequest;

    my ($VHOST) = ($0 =~ /_([^_]+)$/);
    Munin::Plugin::ApacheRequest::Run($VHOST,1000);

DESCRIPTION

Munin::Plugin::ApacheRequest provides the mechanism to trigger Apache request monitoring for a specific VHOST, using Munin.

This distribution is based on a script written by Nicolas Mendoza.

NOTE: In order to use this module, you will need to add a field in your Apache logs showing time executed. This is normally done using the %T (seconds) or %D (microseconds). For instance:

    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\" %T %v"

See http://httpd.apache.org/docs/2.2/mod/mod_log_config.html#formats for more info.

VARIABLES

By default several variables are set by default, based on traditional paths and log format orders. However, should you need to amend these, you can amend them with in the calling script, before calling Run().

  • ACCESS_LOG_PATTERN

    The sprintf format string. If this selects the path based on the named VHOST. By default this is "/var/www/logs/%s-access.log", where your access log uses a VHOST prefix. If you don't require this, simple change this to the explicit path, e.g. "/var/www/logs/access.log".

    If you have several log files, which are rotated and/or gzipped, you can include a catchall in the path such as: "/var/www/logs/%s-access.log.*".

  • TIME_FIELD_INDEX

    By default this assumes the second to last field of the output line of the log, which is set as '-2'. Setting this to a positive value, will select the respective field from left to right.

FUNCTIONS

  • Run

    This is used to call the underlying plugin process. If the script is called with the 'config' argument, the configuration details are returned, otherwise the current values are calculated and returned.

AUTHOR

Barbie, <barbie@missbarbell.co.uk> for Miss Barbell Productions, http://www.missbarbell.co.uk/

COPYRIGHT & LICENSE

  Copyright (C) 2008-2014 Barbie for Miss Barbell Productions
  All Rights Reserved.

  This distribution is free software; you can redistribute it and/or
  modify it under the Artistic Licence v2.