How can I trigger a script when a subdomain reaches certain amount of bandwidth?

心不动则不痛 提交于 2019-12-10 22:57:24

问题


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.



来源:https://stackoverflow.com/questions/8121334/how-can-i-trigger-a-script-when-a-subdomain-reaches-certain-amount-of-bandwidth

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!