View Full Version : How to determine exact bandwith..
deezire
09-25-2001, 08:43 PM
Hi all,
I just recently openned an account with FutureQuest. I would like to know what is the magic number on the stats program that will tell me exactly where I am at on bandwith consumption.
Thanks for your help in advanced.
Go to yourdomain.com/stats and then look under the "KBytes sent" column.
For example, my reading for September is 6485504 or about 6.4 GB so far this month.
You can get this in the overview (note the average at the bottom isn't 'right' until you have 12 months there since it adds the 0 months). If you click the Short statistics for September 2001 (updated more frequently) you can get this broken down by day with the total for the month so far at the bottom. And if you click on "by month" in the left frame you can see Total KB requested, sent, and the amount saved by (browser) cache. The KB sent corresponds to your bandwidth used.
To extend just a tad...
Divide the "Kbytes used" by 1,024 to see the megabytes used.
Divide the megabytes used by 1,024 to see the gigabytes used.
Deb
- :QTFQuest: <<== I luv this guy!
deezire
09-26-2001, 09:36 AM
Thanks for the help.
Evoir
10-27-2001, 12:23 PM
Every time I want to look up my bandwith usage, I have to do a search for this calculation (I have a bad memmory)
Would it be possible to have this figure posted in our CNC near to where our disk usage info is? I would really like to see a running total bandwith usage for the month there.... I'd like to see it already converted to gigs, since that is what we are alloted. Anyone else?
teach1st
10-27-2001, 12:51 PM
I would really like to see a running total bandwith usage for the month there
Agreed. (Although I could never, ever get close to max)
Mandi
10-28-2001, 02:38 PM
Although I don't have trouble recalling the figure, I can sure sympathize with those who do (I have a memory that is a total seive for lots of other things - appointments, for example :o !)
However, I dunno if it useful to pop it into the CNC, as bandwith isn't tracked there - it's a function of our stats package. I know from other conversations about said package, that the FQ folks are limited in how much they can customize it . . . but if it could be added, a little "remember to multiply this figure by . . " above the table might be nice there. I sorta doubt they are gonna be able to have it output in gigs, though, because of the limitations of the package.
teach1st
10-28-2001, 03:22 PM
Oh, I can remember how to do it. I know how to multiply and divide, too. :)
Computers are better at math stuff like that, though, and it seems a shame that it isn't ciphered automagically, what with the data available (if it's OK with the creator of the stats package) and all.
---off topic---
http-analyze doesn't seem to go out of it's way to summarize information for the user. Bandwidth is probably the best summarized, and even that isn't averaged correctly for some reason until you build up 12 months of data. It's strange that a free external counter like SiteMeter can do such a better job of presenting relevant information on visitors, referrers, weekly trends, etc...
...http-analyze: no soup for you
Arthur
10-29-2001, 06:12 AM
Here's a quick-and-dirty Perl script I slapped together. It shows the bandwidth used on each day of the current month (+ the total sofar), in megabytes and gigabytes and shows the previous months.
I tried this first in PHP, but I bumped into the safe_mode limitations, so I did it in Perl (which I know very little of). Upload the script into your cgi-bin directory and chmod it to 0755, there's no need to change anything else. Unless of course you want to make the output look a bit better....
#!/usr/local/bin/perl
# bandwidth.cgi, to monitor your bandwidth usage
print <<HEADER;
Content-type: text/html
<HTML>
<HEAD><TITLE>Bandwidth usage</TITLE></HEAD>
<BODY>
<PRE>
HEADER
print "Bandwidth used:\n";
$directory = $ENV{"DOCUMENT_ROOT"};
open (BW, "$directory/stats/www-stats.hist");
while (<BW>) {
chomp;
if (substr($_,0,3) eq "DAY") {
@fields = split(/[ ]+/);
printf "Day: %10s %4.4f MB / %4.4f GB\n", $fields[1], $fields[7]/1048576, $fields[7]/1073741824;
$monthly_total += $fields[7];
}
if (substr($_,0,3) eq "MON") {
@fields = split(/[ ]+/);
printf "Month: %10s %4.4f GB\n", $fields[1], $fields[7]/1073741824;
}
}
printf "Used sofar this month: %4.4f GB\n", $monthly_total/1073741824;
print <<FOOTER;
</PRE>
</BODY>
</HTML>
FOOTER
Evoir
10-29-2001, 02:26 PM
Arthur,
I copied your little script, and named it bandiwth.cgi, uploaded it (text mode) to my cgi-bin, chmod'ed it to 755
When I called it via IE, I get an Internal Server Error.
here's what my error logs say: (edited because it messed up the table)
---
%% [Mon Oct 29 13:22:39 2001] GET /cgi-bin/bandwith.cgi HTTP/1.1
%% 500 /big/dom/xcurvemag/cgi-bin/bandwith.cgi
%request
Accept: */*
Accept-Language: en
Authorization: Basic Y3VydmVtOkZTNjkzOA==
Connection: Keep-Alive
Cookie: bblastvisit=990482677; bbpassword=bbjjhgjhghjgy9a4324e; bbstyleid=0; bbuserid=1; poll_id000029=voted; poll_id000031=voted; poll_id000034=voted; poll_id000035=voted; poll_id000036=voted; poll_id000037=voted; poll_id000038=voted; poll_id000039=voted; cookie=set; sessionhash=02dd0b59f61eb7c9056626a7745b793f; bbthreadview[4370]=1004375859; bbthreadview[4352]=1004375884; bbthreadview[4375]=1004375901; bbadminon=1; bbthreadview[3753]=1004376458; bbthreadview[4359]=1004376486; bblastvisit=992047426; bbpassword=4acb4bc224acbbe3c2bfdcaa39a4324e; sessionhash=58a2ae443cbb6569b38590c9bb40fcf8
Extension: Security/Remote-Passphrase
Host: www.curvemag.com
UA-CPU: PPC
UA-OS: MacOS
User-Agent: Mozilla/4.0 (compatible; MSIE 5.0; Mac_PowerPC)
%response
%stderr
Can't find string terminator "HEADER" anywhere before EOF at bandwith.cgi line 5.
---
Ideally, I would prefer a FQ solution... but I am willing to try other solutions too.
Arthur
10-29-2001, 03:16 PM
Evie, vBulletin messes up the script, you can copy and paste the script from this location (I hope that works..).
And it should be fairly simple to incorporate this into the CNC...
[edit] web page removed
Originally posted by arthur:
Evie, vBulletin messes up the script, you can copy and paste the script from this location (removed) (I hope that works..).
And it should be fairly simple to incorporate this into the CNC...
That one works like a champ Arthur :)
Thanks,
Bob
Evoir
10-29-2001, 03:23 PM
Thanks. It seems to work. Mostly, anyway. it looks like it does not calculate gigs for past months...
I will eventually password protect this file, but for now it is here (http://www.curvemag.com/cgi-bin/bandwith.cgi).
When I look to months past, it seems to calculate the mb, but not the gb's
Am I reading it all correctly?
Arthur
10-29-2001, 03:38 PM
It seems that your "www-stats.hist" is missing some spaces or something, it doesn't get parsed correctly. What does for example the line starting with "MON 03/2001:" look like?
(www-stats.hist is in your www/stats directory)
janderk
10-29-2001, 03:43 PM
Originally posted by Deb:
Divide the "Kbytes used" by 1,024 to see the megabytes used.
Divide the megabytes used by 1,024 to see the gigabytes used. Or you can use the <shameless plug>WWW Unit Converter (http://www.digitaldutch.com/unitconverter/)</shameless plug>. Click on Bits and Bytes.
Jan Derk
Monty
10-29-2001, 06:07 PM
mine's doing something similar to Evoirs,
http://2coolfishing.com/cgi-bin/bandwidth.cgi
here's the part of file of mine that Arthur asked about
# MONTHLY COUNTERS for the last 12 months
LASTMON: 10/2001
MON 01/2001: 781598 384403 379799 81794 44020 8200063488
MON 02/2001: 784529 397563 372021 57584 48425 8658514944
MON 03/2001: 935117 461178 458077 71497 52638 11050884096
MON 04/2001: 748192 382743 348977 57629 53722 10645463040
MON 05/2001: 1025616 462238 546019 64770 64852 11745549312
MON 06/2001: 1136308 532260 554802 76406 65796 9652275200
MON 07/2001: 1326319 621954 563924 66389 72781 8943591424
MON 08/2001: 1429499 803853 467420 38539 74822 10492262400
MON 09/2001: 1464760 801723 513078 28387 73134 9918920704
MON 10/2000: 718486 388746 312276 35925 46329 5693015040
MON 11/2000: 558367 290682 253380 31426 37906 4518682112
MON 12/2000: 662263 317055 327125 38245 39315 6031772160
checksum 11571054 5844398 5096898 648591 673740 105550998016
It appears that part of the problem is that the file may be using tabs in addition to spaces. You might want to replace:
@fields = split(/[ ]+/);
with
@fields = split(/\s+/);
Rich
Monty
10-29-2001, 10:30 PM
plugging in Rich's mod, seems to have worked
http://2coolfishing.com/cgi-bin/bandwidth2.cgi
http://2coolfishing.com/temporary/bandwidth2.txt is the actual file (rename to .cgi and set permissions at 755)
Thanks to everyone for this one!
I just broke the 50 domain hosted by FQ barrier today, and that particular script is going to make the end of the month, check the bandwidth drill a *lot* more fun.
Hats off from Texas,
Mont
Evoir
10-29-2001, 10:35 PM
whoooo hoooo!
Thanks rich and Month and Arthur.
:) It works just fine now. The final code is here:
#!/usr/local/bin/perl
# bandwidth.cgi
print <<HEADER;
Content-type: text/html
<HTML>
<HEAD><TITLE>Bandwidth usage</TITLE></HEAD>
<BODY>
<PRE>
HEADER
print "Bandwidth used:\n";
$directory = $ENV{"DOCUMENT_ROOT"};
open (BW, "$directory/stats/www-stats.hist");
while (<BW>) {
chomp;
if (substr($_,0,3) eq "DAY") {
@fields = split(/[ ]+/);
printf "Day: %6s %4.4f MB / %4.4f GB\n", $fields[1], $fields[7]/1048576, $fields[7]/1073741824;
$monthly_total += $fields[7];
}
if (substr($_,0,3) eq "MON") {
@fields = split(/\s+/);
printf "Month: %10s %4.4f GB\n", $fields[1], $fields[7]/1073741824;
}
}
printf "Used sofar this month: %4.4f GB\n", $monthly_total/1073741824;
print <<FOOTER;
</PRE>
</BODY>
</HTML>
FOOTER
Arthur
10-30-2001, 03:10 AM
Thanks Rich.
vBulletin® v3.6.8, Copyright ©2000-2009, Jelsoft Enterprises Ltd.