The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.


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


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 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 for more info.


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().


    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.*".


    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.


  • 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.


Barbie, <> for Miss Barbell Productions,


  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.