7 http_loadtime
- Plugin to graph the HTTP response
times of specific pages
11 The following environment variables are used by this plugin
13 target
- comma separated URL
(s
) to fetch
(default
: "http://localhost/")
16 env.target http
://localhost.de
,http
://localhost.de
/some
-site.html
19 Do not
enable the download of page requisites
(env.requisites
) for https
20 sites since wget needs incredible long to perform this on big sites...
34 #%# capabilities=autoconf
38 target
=${target:-"http://localhost/"}
39 requisites
=${requisites:-"false"}
41 urls
=$(echo "$target" | tr ',' '\n')
45 wget
--user-agent "Munin - http_loadtime" --no-cache --quiet --output-document=/dev
/null
"$@" 2>/dev
/null
50 echo "$1" | sed 's!^\(https\?://\)\?[^/]\+/!!;s/[:/.-]/_/g'
54 echo "$1" | sed 's!^http\(s\)\?://!\1:!;s!\.simplynuc\.!...!'
58 if [ "$1" = "autoconf" ]; then
60 command -v tr >/dev
/null
2>&1 || result
=1
61 command -v wget
>/dev
/null
2>&1 || result
=1
62 if [ "$result" != "yes" ]; then
63 echo "no (programs wget and tr required)"
67 # check if urls respond
71 if ! request_url
--spider "$uri"; then
72 echo "no (Cannot run wget against \"$uri\")"
82 if [ "$1" = "config" ]; then
83 echo "graph_title HTTP loadtime of a page"
84 echo "graph_args --base 1000 -l 0"
85 echo "graph_vlabel Load time in seconds"
86 echo "graph_category apache"
87 echo "graph_info This graph shows the load time in seconds"
90 uri_short
=$(echo "$(shortenUri "$uri")" | cut -c 1-30)
91 if [ "$uri_short" != "$(shortenUri "$uri")" ]; then uri_short="${uri_short}...
"; fi
92 echo "$(escapeUri "$uri").label
$uri_short"
93 echo "$(escapeUri "$uri").info
$uri"
102 if [ "$requisites" = "true
" ]; then
103 request_url --page-requisites "$uri"
107 loadtime=$(echo "$start" "$(date +%s.%N)" | awk '{ print($2 - $1); }')
109 echo "$(escapeUri "$uri").value $loadtime"