public static function testConnection($server, $port) { $startTime = Memcadmin_Misc::getMicrotimeFloat(); $s = @fsockopen($server, $port, $errno, $errstr, 3); // wait max. 3 seconds self::$_lastResponseTime = Memcadmin_Misc::getMicrotimeFloat() - $startTime; if (!$s) { return false; } return true; }
public function actionOverview() { $this->_view->structure = array(); foreach ($this->_structure as $cluster) { $this->_view->structure[$cluster->getName()] = array(); $nodes = $cluster->getNodes(); foreach ($nodes as $node) { $this->_view->structure[$cluster->getName()][$node->getName()] = array('ip' => $node->getIp(), 'port' => $node->getPort(), 'state' => $node->getUpState() ? 'UP' : 'DOWN', 'responseTime' => Memcadmin_Misc::formatSecAsmSec($node->getLastResponseTime())); } } return $this; }