Results 1 to 4 of 4
  1. #1

    Question Help Monitoring Bandwidth... How?

    I am not sure if there's an easy way to go about monitoring bandwidth on a user by user basis. I have a website that hosts game developers and their creations and I would like to keep bandwidth usage down and start charging the guys that manage to currently take a few gigs a month themselves. The problem is that it's not a normal CPanel type of hosting, it's done via my code and PHP and such. So how would I go about tracking individual user bandwidth (just HTTP)? Are there libraries or would I have to parse and interpret the log myself? I imagine that this process would take a long time every time I updated the bandwidth usage (lets say the server does it once every six hours or so... I have a lot of users). Any help would be greatly appreciated, thanks!

  2. #2
    Join Date
    Mar 2004
    Are you running on Apache?

    if yes then you would be able to access the user's bandwidth usage from the log files for each users.

    Testing 1.. Testing 1..2.. Testing 1..2..3...

  3. #3
    But users are managed by the server. A user on the site is not a server user, rather his information is stored in a MySQL database, and the only way I can see to track bandwidth is to count how much is used by their site (using the URL).

    I imagine logs might be the only way to go... But I really don't like the idea of trusting bandwidth metering to a bulky process running every few hours to total the numbers...

  4. #4
    I've spent 2 years writing a control panel.

    Apache log files are fine for getting a users http bandwidth usage, you just need a way to reconcile the log or log entry with the user. For me each user has their own log file so it makes it easy for me, but if you only have one log file you can still get the data out by matching the user back to the domain in the entry.

    For performance use a method that keeps track of the log file each time its read, then start at that position next time you read it. I run my script every 5 minutes and it only takes a few sconds to run as it only goes through entrys that have been added in the last five minutes.

    The log file is easy to parse, using a simple reg exp, but i believe there is librarys for perl and php, though they are fairly large and probably over kill especially if your looking for speed.

    If you need some help my bank account needs income

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts