SAAS-1229, SAAS-1230 - initial implementation of station suspend when over bandwidth limit

This commit is contained in:
Duncan Sommerville 2015-11-24 13:36:54 -05:00
parent 04167c103b
commit 82544f34d9
6 changed files with 64 additions and 0 deletions

View file

@ -156,6 +156,19 @@ class ApiController extends Zend_Controller_Action
}
Application_Model_Preference::incrementBandwidthLimitCounter($usageBytes);
Application_Model_Preference::setBandwidthLimitUpdateTimer();
$usage = Application_Model_Preference::getBandwidthLimitCounter();
if ($usage > Application_Model_Preference::getBandwidthLimit()) {
$CC_CONFIG = Config::getConfig();
$user = array('', $CC_CONFIG['apiKey'][0]);
$data = array('reason' => "Bandwidth limit exceeded");
try {
$result = Application_Common_HTTPHelper::doPost(AIRTIMEPRO_API_URL, $user, $data);
Logging::info($result);
} catch (Exception $e) {
throw $e;
}
}
}
//Used by the SaaS monitoring

View file

@ -44,6 +44,9 @@ class ProvisioningController extends Zend_Controller_Action
if (isset($_POST['icecast_pass'])) {
Application_Model_Preference::setDefaultIcecastPassword($_POST['icecast_pass']);
}
if (isset($_POST['bandwidth_limit'])) {
Application_Model_Preference::setBandwidthLimit($_POST['bandwidth_limit']);
}
} catch (Exception $e) {
$this->getResponse()
->setHttpResponseCode(400)