NAME

http_load_ Munin multigraph plugin to monitor websites's HTTP responses and performance

DESCRIPTION

The purpose of this plugin is to monitor several properties of a web page. All measurements are done for the complete web page, including images, css and other content a standard browser would download automatically.

This version supports monitoring: - loadtime: total time to download a complete web page (using serial GET requests) - size: total size of a web page - response: different response codes (200, 404, 500, etc) - tags: HTML tags (img src, a href, etc) - type: content types (image/png, text/css/, etc) - elements: source of elements loaded by the web page

REQUIREMENTS

 - The server running this plugin must be allowed  to connect to the web
   server(s) you are going to monitor.
 - Some perl modules:
   Time::HiRes, LWP::UserAgent, HTML::LinkExtor, LWP::ConnCache

CONFIGURATION

INITIAL SETUP

1. Copy this file to /usr/share/munin/plugins/

2. Create a file (/etc/munin/http_load_urls.txt) with one full url per line, as many as you want, i.e.: $ echo "http://www.dn.no/" >> /etc/munin/urls.txt $ echo "http://www.intrafish.no/" >> /etc/munin/urls.txt

3. Add a cron job running the plugin with cron as the argument: */15 * * * * <user> /usr/sbin/munin-run http_load_<site>_loadtime cron <user> should be the user that has write permission to the $cachedir directory set below. <site> should be any of the configured sites (all sites will get updated), likewise, you should replace loadtime by any metric that is enabled for that site (all metrics will get updated). Set the intervals to whatever you want.

   For verbose output (for debugging) you can do:
   sudo -u <user> /usr/share/munin/plugins/http_load_ cron verbose

4. Run munin-node-configure --suggest --shell and run the symlink commands manually to update the munin-node plugin list.xi

5. If you want to change the filter which the plugin uses to select which tags to follow in a web page, edit the subroutine called "filter" below.)

SPECIFY URLS TO MONITOR

1. Add a new line in /etc/munin/urls.txt with the full URL, i.e.: $ echo "http://www.linpro.no/" >> /etc/munin/http_load_urls.txt

2. Run munin-node-configure --suggest --shell and manually add the new symlink(s)

3. /etc/init.d/munin-node restart

REMOVE A URL

1. Remove it from /etc/munin/http_load_urls.txt

2. Remove ${cachedir}/http_load_<url_id>*

3. Remove /etc/munin/plugins/http_load_<url_id>*

4. /etc/init.d/munin-node restart

SINGLE GRAPH SUPPORT

The default behaviour is the multigraph mode: only the loadtime will be shown on the Munin summary page. The graphs there are linked to a second-level summary page that list all other metrics. It is also possible to create single graphs, that would show immediately on the summary page, by using symlinks with a different name, postfixed with the name of the metric:

 - http_load_hostname:          multigraph (default)
 - http_load_hostname_loadtime: loadtime only
 - http_load_hostname_size:     total page size
 - http_load_hostname_response: response code
 - http_load_hostname_tags:     HTML tags summary
 - http_load_hostname_type:     Content-Types
 - http_load_hostname_elements: source site of the loaded elements

Note that hostname is not the FQDN of the host, but rather the one given when running munin-node-configure --suggest --shell and run the symlink

MAGIC MARKERS

  #%# family=auto
  #%# capabilities=autoconf suggest

TODO

 - Specify URLs from a standard Munin plugins configuration file (e.g., env.urls)
 - Add support for forking to simulate real browsers

AUTHORS

 - Espen Braastad / Linpro AS <espen@linpro.no>, initial implementation
 - Olivier Mehani <shtrom+munin@ssji.net>, multigraph support