Link to home
Start Free TrialLog in
Avatar of mickey159
mickey159Flag for United States of America

asked on

PHP bandwidth monitor script

Can somebody help me to write or find a php bandwidth monitor script?
It is not a homework and I want to make it on my website.
I have searched for days in Google.
I would like it to be like below:
Bandwidth:100MB/1000MB

Thanks very much!
ASKER CERTIFIED SOLUTION
Avatar of mickey159
mickey159
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mickey159

ASKER

I am reading...
so please wait for comments
Thank you!
A question:
How to use it?
Put it on top of the page?
And how to add the result to the database for log?
Also,is it useful for file download?
(setting the header to force download and use readfile()?)

Thanks!
Have you considered Cacti: http://www.cacti.net/
PHP cannot monitor bandwidth because you need something that is pcap enabled. PHP is not.

PHP is a scripting language not a full blown compileable programming language with access to the raw nic.

Use ntop.

If you are trying to monitor webserver bandwidth, however, you can do that by parsing the logs.
I am quite busy these days and I may answer every 2 days.
How to install ntop?
Can it be easier?
I think I m using Cacti.

Thanks!
Reading the docs, I don't think I can install Cacti.
It needs admin previllege to install PRDTool,right?
Is this your server or shared / hosted? Do you have root privs?
I plan to get it on hosted server.
I don't think I will have root privs.

Thank you!
Then you can't do what you want to do. the closest you'll get is awstats from cPanel's built in monitor. You will have access (or should have access) to the awstats logs, which you can use PHP to parse.

That's as good as you're going to get.
I of course know that.
Every panel has its bandwidth monitor.
But what I want to do is like the example picture.
Now I don't mind whether it is php or not,
I want to just record the bandwidth and add it to the database.
(It is not possible to ask the host provider to get the code, they just won't allow everything such as allow the use of some function or help you to install php plugins)

Thanks very much for all of your help!
example.bmp
If you're running this on a hosted solution, the only thing you can do is parse the logs.

If you're running this on a dedicated box, you have more options.
So how can I do it?
Per post: http:#33625592  Cacti.
Thanks but I will get it my way.