How can I trigger a script when a subdomain reache

2019-07-08 07:57发布

问题:

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?

回答1:

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.