[mrtg] Web Page Load Times

Glen Peake glen.peake at etrade.com.au
Wed Jan 23 07:26:49 MET 2002


Hi All,

Downloaded a script that is able to graph Web Page Load times, but I'm
getting an error when I try to run the script.

( I'm running Windows NT4 / Windows 2000 ) (don't have access to a *NIX box)

When I run the script I get the following error(s):


'wget' is not recognised as an internal or external command
'wget' is not recognised as an internal or external command
'grep' is not recognised as an internal or external command




Wget works fine from the command prompt on it's own i.e. not run via the
script

I tried modifying the line
foreach $_ (`wget -o saved.txt | more saved.txt | grep saved`)

to include the path to where wget is located on my hard drive, to no avail..

Any thoughts????


Here's the link to the site where the script is kept

http://www.leh.net/~kevin/docs/mrtg/index_1.html
<http://www.leh.net/~kevin/docs/mrtg/index_1.html> 

Here is my MRTG.CFG file
---- Begin ----
WorkDir: c:\temp

Target[sysload]: `c:\perl\bin\perl.exe c:\temp\wget\web_page_load.pl`
PageTop[sysload]: <H1>Round Trip Time Analysis for web</H1>
MaxBytes[sysload]: 3000
# Directory[sysload]: sysload
Options[sysload]: gauge, nopercent
YLegend[sysload]: Load 
ShortLegend[sysload]: Load
Legend1[sysload]: Load Average over last 5 minutes
Legend2[sysload]: Load Average over last 15 minutes
Legend3[sysload]: Average over last 5 minutes
Legend4[sysload]: Average over last 15 minutes
LegendO[sysload]: &nbsp;15 minute stagger
Title[sysload]: System load
---- End ----
web_page_load.pl ( I have made the following edits )

FROM
#!/usr/local/bin/perl
TO
#!C:\Perl\bin\PERL.EXE

FROM
foreach $_ (`wget -o saved.txt | more saved.txt | grep saved`)
TO
foreach $_ (`wget www.mywebsite.com <http://www.mywebsite.com>  -o saved.txt
| more saved.txt | grep saved`)

-------- begin -------- web_page_load.pl
#!C:\Perl\bin\PERL.EXE
# Copywrite: 
# This Work is copywrite Barry Irwin , Moria Research 1999
# All Rights Reserved
#
# Permission is given for derivitive works to be freely distributed provided
# Original Author is acknowledged, and this copywrite remains intact
#
# DISCLAIMER: Your milage may vary. NO WARRANTY provided. USE, Enjoy, but if
# it blows up , or suchlike, badluck. Author Assumes NO responsibility for
# this work
# VERSION=0.1
# Outputs the %used for a disk partition. parameter can be either disk slice
# name (/dev/da2s1f) or symbolic name ( eg /var)
# probably a good idea to set AbsMax to somethign like 115( since file
# systems can get >100% full. guage type is also recomended
#
# OCTOBER 2000
# I have majorly hacked this script to get load times from a web server.
# ---kevin at leh.net


#root at rucus:/home/system/quark/www# df -k /var | tail -1
#/dev/da2s1f 595383 263439 284314 48% /var

#if ( $ARGV[0] eq "" )
#{
# print "/dev/hda7 \n";
# exit;
#}


#uptimestuff
$tmp =`uptime`;
$tmp =~ s/,//g;
@utime = split /\s/, $tmp;


#Kevin added line to generate the text file


$percent = 0;


# Kevin - Here, insert the url of what site/page you are measuring. (you
will need wget)
# Capturing load time of the page, via wget's reporting. (you have to delete
the page it retrieves in
# cron or something, otherwise you will have a bunch of copies of the same
page.

foreach $_ (`wget www.mywebsite.com <http://www.mywebsite.com>  -o saved.txt
| more saved.txt | grep saved`)
# grab the data out of the file
{
($device, $size, $used, $free, $percent, $mount) = split(/\s+/);
# if ( $ARGV[0] eq $device || $ARGV[0] eq $device) 
{ chop($used); last;} #bail out
}

# Kevin adding new stuff
$percent = 0;

# Kevin - I do the exact same command again to grab different information
from the same line I grep
# I am sure there is a better way to do this, not the master scripter.
Greping for page size.

foreach $_ (`wget www.mywebsite.com <http://www.mywebsite.com>  -o saved.txt
| more saved.txt | grep saved`)
# grab the data out of the file

{
($device, $size, $used, $free, $percent, $mount) = split(/\s+/);
# if ( $ARGV[0] eq $device || $ARGV[0] eq $device) 
{ chop($used); last;} #bail out
}


# Kevin adding new stuff
foreach $_ (`more saved.txt | grep Length`) 
# grab the data out of the file
{
($length, $size1, $used1, $free1, $percent1, $mount1) = split(/\s+/);
# if ( $ARGV[0] eq $device || $ARGV[0] eq $device)
{ chop($used1); last;} #bail out
}

# This is chopping off the last bit of data on the load time, one character
at a time. # someone please email me and tell me how to do this quicker.
-Kevin chop ($device);
chop ($device);
chop ($device);
chop ($device);
chop ($device);
chop ($device);


chop ($size1);
chop ($size1);
chop ($size1);
chop ($size1);


# Kevin - The first value I wanted, just used the old variable name of
$device, not really relevant.
print "$device\n";
# Kevin - The second value I wanted, again just altered the variable name.
print "$size1\n";
print "$utime[3] days $utime[5] hours\n";
print "\n";
----- end -----

--
Unsubscribe mailto:mrtg-request at list.ee.ethz.ch?subject=unsubscribe
Archive     http://www.ee.ethz.ch/~slist/mrtg
FAQ         http://faq.mrtg.org    Homepage     http://www.mrtg.org
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi



More information about the mrtg mailing list