1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-21 18:41:03 +00:00

[http_load_] Use perldoc

Signed-off-by: Olivier Mehani <shtrom@ssji.net>
This commit is contained in:
Olivier Mehani 2017-07-23 13:44:48 +10:00
parent ece1c2b024
commit f4e73b807f

View file

@ -1,106 +1,114 @@
#!/usr/bin/perl #!/usr/bin/perl
# -*- perl -*- # -*- perl -*-
#
# Plugin to graph http performance =head1 NAME
# Version: 0.8.7
# http_load_ Munin multigraph plugin to monitor websites's HTTP responses and performance
# 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 =head1 DESCRIPTION
# and other content a standard browser would download automatically.
# The purpose of this plugin is to monitor several properties of a web page.
# This version supports monitoring: All measurements are done for the complete web page, including images, css
# * The total time to download a complete web page (using serial GET requests) and other content a standard browser would download automatically.
# * The total size of a web page
# * The different response codes (200, 404, 500, etc) This version supports monitoring:
# * The different tags (img src, a href, etc) - loadtime: total time to download a complete web page (using serial GET requests)
# * The the different content types (image/png, text/css/, etc) - size: total size of a web page
# * The number of elements the web page consists of - response: different response codes (200, 404, 500, etc)
# - tags: HTML tags (img src, a href, etc)
# Author: Espen Braastad / Linpro AS - type: content types (image/png, text/css/, etc)
# espen@linpro.no - elements: source of elements loaded by the web page
# Olivier Mehani (multigraph support)
# shtrom+munin@ssji.net =head1 REQUIREMENTS
#
##### Short usage guide: ##### - The server running this plugin must be allowed to connect to the web
# server(s) you are going to monitor.
# Requirements: - Some perl modules:
# * The server running this plugin must be allowed to connect to the web Time::HiRes, LWP::UserAgent, HTML::LinkExtor, LWP::ConnCache
# server(s) you are going to monitor.
# * Some perl modules: =head1 CONFIGURATION
# Time::HiRes, LWP::UserAgent, HTML::LinkExtor, LWP::ConnCache
# =head2 INITIAL SETUP
# Initial configuration:
# 1. Copy this file to /usr/share/munin/plugins/ 1. Copy this file to /usr/share/munin/plugins/
#
# 2. Create a file (/etc/munin/http_load_urls.txt) with one 2. Create a file (/etc/munin/http_load_urls.txt) with one
# full url per line, as many as you want, i.e.: full url per line, as many as you want, i.e.:
# $ echo "http://www.dn.no/" >> /etc/munin/urls.txt $ echo "http://www.dn.no/" >> /etc/munin/urls.txt
# $ echo "http://www.intrafish.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: 3. Add a cron job running the plugin with cron as the argument:
# */15 * * * * <user> /usr/sbin/munin-run http_load_<site>_loadtime cron */15 * * * * <user> /usr/sbin/munin-run http_load_<site>_loadtime cron
# <user> should be the user that has write permission to the $cachedir <user> should be the user that has write permission to the $cachedir
# directory set below. <site> should be any of the configured sites (all directory set below. <site> should be any of the configured sites (all
# sites will get updated), likewise, you should replace loadtime by any sites will get updated), likewise, you should replace loadtime by any
# metric that is enabled for that site (all metrics will get updated). metric that is enabled for that site (all metrics will get updated).
# Set the intervals to whatever you want. Set the intervals to whatever you want.
#
# For verbose output (for debugging) you can do: For verbose output (for debugging) you can do:
# sudo -u <user> /usr/share/munin/plugins/http_load_ cron verbose sudo -u <user> /usr/share/munin/plugins/http_load_ cron verbose
#
# 4. Run munin-node-configure --suggest --shell and run the symlink 4. Run munin-node-configure --suggest --shell and run the symlink
# commands manually to update the munin-node plugin list.xi 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 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.) tags to follow in a web page, edit the subroutine called "filter" below.)
#
# Add a new url to monitor: =head2 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 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) 2. Run munin-node-configure --suggest --shell and manually
# add the new symlink(s)
# 3. /etc/init.d/munin-node restart
# 3. /etc/init.d/munin-node restart
# Remove a url from monitoring:
# 1. Remove it from /etc/munin/http_load_urls.txt =head2 REMOVE A URL
#
# 2. Remove ${cachedir}/http_load_<url_id>* 1. Remove it from /etc/munin/http_load_urls.txt
#
# 3. Remove /etc/munin/plugins/http_load_<url_id>* 2. Remove ${cachedir}/http_load_<url_id>*
#
# 4. /etc/init.d/munin-node restart 3. Remove /etc/munin/plugins/http_load_<url_id>*
#
# Single graph support 4. /etc/init.d/munin-node restart
#
# The default behaviour is the multigraph mode: only the loadtime will be shown =head2 SINGLE GRAPH SUPPORT
# 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 The default behaviour is the multigraph mode: only the loadtime will be shown
# single graphs, that would show immediately on the summary page, by using on the Munin summary page. The graphs there are linked to a second-level
# symlinks with a different name, postfixed with the name of the metric: summary page that list all other metrics. It is also possible to create
# * http_load_hostname: multigraph (default) single graphs, that would show immediately on the summary page, by using
# * http_load_hostname_loadtime: loadtime only symlinks with a different name, postfixed with the name of the metric:
# * http_load_hostname_size: total page size
# * http_load_hostname_response: response code - http_load_hostname: multigraph (default)
# * http_load_hostname_tags: HTML tags summary - http_load_hostname_loadtime: loadtime only
# * http_load_hostname_type: Content-Types - http_load_hostname_size: total page size
# * http_load_hostname_elements: source site of the loaded elements - http_load_hostname_response: response code
# - http_load_hostname_tags: HTML tags summary
# Note that hostname is not the FQDN of the host, but rather the one given when - http_load_hostname_type: Content-Types
# running munin-node-configure --suggest --shell and run the symlink - 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
# Todo:
# * Add support for forking to simulate real browsers =head1 MAGIC MARKERS
# * Use checksums as fieldnames
# #%# family=auto
# $Id: $ #%# capabilities=autoconf suggest
#
# Magic markers: =head1 TODO
#%# family=auto
#%# capabilities=autoconf suggest - Specify URLs from a standard Munin plugins configuration file (e.g., env.urls)
- Add support for forking to simulate real browsers
=head1 AUTHORS
- Espen Braastad / Linpro AS <espen@linpro.no>, initial implementation
- Olivier Mehani <shtrom+munin@ssji.net>, multigraph support
=cut
use strict; use strict;
use Time::HiRes qw( gettimeofday tv_interval ); use Time::HiRes qw( gettimeofday tv_interval );