2

I run a hosted service and I need to be able to monitor how much bandwidth every customer (Who uses an individual subdomain, created through cPanel) consumes.

Is there some way to trigger a PHP script to run when a subdomain reaches a certain amount of bandwidth? If this isn't an existing solution (I would guess as perhaps part of one of the statistic modules that already exist like Webalizer) then can I have some suggestions on what it should be written in?

hakre
  • 193,403
  • 52
  • 435
  • 836
Marc Fowler
  • 913
  • 1
  • 11
  • 22

1 Answers1

0

I'd like to apologize in advance for not providing exact code here, since I'm not on a programming machine right now.. But I found two links that you might be able to use:

This contains info on getting bandwidth information:

http://docs.cpanel.net/twiki/bin/view/ApiDocs/Api1/ApiBandwidth

How to call the API1 functions:

http://docs.cpanel.net/twiki/bin/view/SoftwareDevelopmentKit/CallingApiOne

Again, I'm sorry for not providing any real code, but you can at least give these a read. I haven't got any cPanels to play around with either, but I'll see if I can grab something later.

Nonym
  • 6,199
  • 1
  • 25
  • 21
  • Unfortunately it's not a true API, in that I can't get the monthly totals by subdomain. I could maybe scrape the HTML that it can generate but that feels really unreliable and hacky. – Marc Fowler Nov 14 '11 at 18:46