public function indexAction() { $config = Zend_Registry::get('config'); /* @var $config Zend_Config */ if (!$config->gandi->api->key) { return $this->_helper->redirector('index', 'install'); } // Cache Page $cache = Zend_Registry::get('cache'); /* @var $cache Zend_Cache_Frontend_Page */ // DEBUG //Zend_Debug::dump($cache); $return = $cache->start('index'); echo "return: " . $return; die; //$translate = Zend_Registry::get('Zend_Translate'); try { $gandi = new Narno_Service_Gandi($config->gandi->api->key); $this->view->gandi = $gandi; } catch (Exception $e) { echo $e->getMessage(); } // DEBUG //Zend_Debug::dump($gandi->getVmInfo(11303)); /** * Account data */ try { $account = $gandi->getAccountInfo(); } catch (Exception $e) { echo 'API key not available!'; die; } if ($config->gandi->account->showdetails) { $this->view->accountShowdetails = true; $this->view->account = array('fullname' => $account['fullname'], 'resgranted' => array('servers' => $account['resources']["granted"]["servers"], 'ips' => $account['resources']["granted"]["ips"], 'bandwidth' => $account['resources']["granted"]["bandwidth"], 'memory' => $account['resources']["granted"]["memory"], 'cores' => $account['resources']["granted"]["cores"], 'disk' => $account['resources']["granted"]["disk"])); } /** * Account data */ $vmList = $gandi->getVmList(); foreach ($vmList as $key => $vm) { $vmId = (int) $vm['id']; $vm_info = $gandi->getVmInfo($vmId); $this->view->vmList = array($vmId => array('hostname' => $vm_info['hostname'], 'state' => $vm_info['state'], 'graph_cpu' => $vm_info['graph_urls']['vcpu'][0], 'graph_network' => $vm_info['graph_urls']['vif'][0], 'graph_hdd' => $vm_info['graph_urls']['vdi'][1], 'date_created' => new Zend_Date($vm['date_created'], Zend_Date::ISO_8601), 'date_updated' => new Zend_Date($vm['date_updated'], Zend_Date::ISO_8601), 'console' => $vm_info['console'], 'ai_active' => $vm_info['ai_active'], 'cores' => $vm_info['cores'], 'memory' => $vm_info['memory'], 'vm_max_memory' => $vm_info['vm_max_memory'], 'flex_shares' => $vm_info['flex_shares'])); } if ($config->gandi->vm->showdetails) { $this->view->vmShowdetails = true; } }
public function graphUrl(Narno_Service_Gandi $gandi, $vmId, $target, $deviceId = 0) { return $gandi->getGraph($vmId, $target, $deviceId); }