Page 1 of 1

Speedtest Webpage

Posted: Tue Dec 15, 2009 3:10 am
by vincent Thong
Hi,

I want to create a webpage that would display the download speed of some specific websites like http://mail.yahoo.com in a graphical form. The display would be a graph with y-axis shows the download speed (Kbps) and x-axis is the live time.

I open to suggestion.
I would like to find out the ways to do this.
Thanks.

Re: Speedtest Webpage

Posted: Tue Dec 15, 2009 7:16 am
by VladSun
I am not sure what do you mean by "download speed of some specific websites " ...
Anyway, MRTG + user defined script will do most of the work.

Re: Speedtest Webpage

Posted: Sun Dec 20, 2009 3:00 am
by vincent Thong
What I need is to draw a graph of the loading speed of website (let's say mail.yahoo.com).
I want to test my internet connection speed for different websites and display them in a webpage.

I have tried the MRTG, (thanks for the help).

I am new to MRTG, can someone tell me how to get the download speed of a website?

In the MRTG configuration file, .cfg file, the code "Target", how to use this code to get the download speed of mail.yahoo.com website?
Target[port]: 1:public@router

What is the 'thing' put in the "port"
and what to put in the "router"?

VladSun wrote:I am not sure what do you mean by "download speed of some specific websites " ...

Re: Speedtest Webpage

Posted: Sun Dec 20, 2009 4:42 am
by VladSun
As I said, you need a custom script to collect the data.
The
Target[port]: 1:public@router
means that you will collect data through SNMP, which I highly doubt will be available to you (i.e. mail.yahoo.com gives a public access to its SNMP).

You need a
Target[port]: `path/to/custom/script.sh`

This script should return 4 lines:
- graphic1 value
- graphic2 value
- server uptim
- graphics description

The first 2 are of interest.
MRTG is "Multi Router Traffic Grapher" - that is, it's meant to create graphics for upload/download traffic in a single picture - that's why you have 2 graphic values in the script output above.

So you need a script that will measure the download rate of mail.yahoo.com and pass the calculated value to the MRTG:

Example:

Code: Select all

#!/bin/bash
/script/to/cals/download/rate.sh
echo 
echo
echo
/script/to/cals/download/rate.sh should output a single line containing a numeric value

Also you need to specify the correct Options directive by specifying the way your data comes:
Options[port]: absolute

It can be:

http://oss.oetiker.ch/mrtg/doc/mrtg-reference.en.html
gauge

Treat the values gathered from target as 'current status' measurements and not as ever incrementing counters. This would be useful to monitor things like disk space, processor load, temperature, and the like ...

In the absence of 'gauge' or 'absolute' options, MRTG treats variables as a counters and calculates the difference between the current and the previous value and divides that by the elapsed time between the last two readings to get the value to be plotted.
absolute

This is for counter type data sources which reset their value when they are read. This means that rateup does not have to build the difference between the current and the last value read from the data source. The value obtained is still divided by the elapsed time between the current and the last reading, which makes it different from the 'gauge' option. Useful for external data gatherers.
derive

If you are using rrdtool as logger/grapher you can use a third type of data source. Derive is like counter, except that it is not required to go UP all the time. It is useful for situations where the change of some value should be graphed.

Re: Speedtest Webpage

Posted: Sun Dec 20, 2009 8:07 am
by josh
Very educational Vlad :D

I always knew what MRTG was but didn't know you could plug in your own data like that.

Re: Speedtest Webpage

Posted: Sun Dec 20, 2009 10:11 am
by VladSun
Thanks, josh.
I really miss my days as a network administrator :)

The standalone MRTG is awful if one has to collect data from very high number of data sources - that is if there are many, many targets described in the mrtg.cfg.
That is because MRTG will try to generate ALL images from the data gathered. It doesn't do it on demand. It's a slow process and MRTG complains that it can not finish data processing in the interval between data gathering given (usually 5 minutes).

In such case one need to use RRDTool to collect data and generate images on demand. And MRTG will be used only for defining targets.

Re: Speedtest Webpage

Posted: Sat Jan 09, 2010 9:27 am
by vincent Thong
Well, I am new to MRTG. I have just read the manual of MRTG.
I am some guide on the process of using it.

Check if I missed out something.

1) I need to install the SNMP software. (I got it from http://www.wtcs.org/snmp4tpc/default.htm)
2) and then MRTG collect info from perl scripts.
3) then we can have the HTML-based Network Monitoring System.

hmm..
What software I need to install (except perl and MRTG which I already installed) in order to use MRTG?

Re: Speedtest Webpage

Posted: Sun Jan 10, 2010 7:37 am
by VladSun
You don't need SNMP in your case - you need just a script to fetch data you need and provide it to MRTG.

Re: Speedtest Webpage

Posted: Mon Jan 11, 2010 9:39 am
by vincent Thong
hm.. I qoute this from http://oss.oetiker.ch/mrtg/doc/mrtg-nt-guide.en.html
But before we begin you need to know a few things. Take an
opportunity to gather the following information:

1) The IP address or hostname and the SNMP port number, (if non standard), of the device you want to monitor.
2) If you want to monitor something other than bytes in and out, you must also know the SNMPOID of what you
want to monitor.
3)Finally you need to know the read-only SNMP community string for your device. If you don't know it, try
public, that is the default.
This MRTG needs a router?
I don't have a router. How about a pc using normal network connection like broadband?
I have completed the perl script that calculate the downloading time of a webpage.
Now I should link the perl script with the MRTG.
I am quite blur with the code Target[10.10.10.1.1]: 1:public@10.10.10.1

What is a community?
Community is the community name of the device you want to create a configuration for. If not
specified, it defaults to 'public'; you might want to try this first if you do not know the
community name of a device. If you are using the wrong community name you will get no
response from the device.
The device mentioned here means the router?
But I use broadband.

Re: Speedtest Webpage

Posted: Mon Jan 11, 2010 9:57 am
by vincent Thong
How do the perl script link to the MRTG config file?
Which lines of the code I should put the path location of the perl script?

WorkDir: c:\xampp\htdocs\networking\target
EnableIPv6: no
Target[124.108.120.31]:HERE?
MaxBytes[124.108.120.31]: 1250000
Target[port]: `path/to/custom/script.sh`
But it return a error saying it "evaluated to 'path' instead of a number "

hm.. .sh file is the stored information that generated by perl scripts?
can this perform in Windows OS?

Please help :cry:
I am stucked for weeks