* @copyright 2003-2007 PgPool Global Development Group * @version SVN: $Id$ */ require_once('common.php'); require_once('command.php'); $tpl->assign('help', basename( __FILE__, '.php')); $MAX_VALUE = 2147483647; if(!isset($_SESSION[SESSION_LOGIN_USER])) { exit(); } $ret = execPcp('PCP_NODE_COUNT'); if(!array_key_exists('SUCCESS', $ret)) { $errorCode = 'e1002'; $tpl->assign('errorCode', $errorCode); $tpl->display('innerError.tpl'); exit(); } else { $nodeCount = $ret['SUCCESS']; } $tpl->assign('nodeCount', $nodeCount); $isParallelMode = isParallelMode(); $isReplicationMode = isReplicationMode(); $isMasterSlaveMode = isMasterSlaveMode(); $nodeInfo = array(); for($i=0; $i<$nodeCount; $i++) { $ret = execPcp('PCP_NODE_INFO', $i); if(!array_key_exists('SUCCESS', $ret)) { $errorCode = 'e1003'; $tpl->assign('errorCode', $errorCode); $tpl->display('innerError.tpl'); exit(); } else { $ret = $ret['SUCCESS']; } $nodeInfo[$i] = split(" ", $ret); $nodeInfo[$i][3] = sprintf('%.3f', $nodeInfo[$i][3] / $MAX_VALUE); if( $isParallelMode ) { array_push($nodeInfo[$i], 'none'); } else { switch($nodeInfo[$i][2]) { case 1: case 2: if($isReplicationMode || $isMasterSlaveMode) { array_push($nodeInfo[$i], 'disconnect'); } else { array_push($nodeInfo[$i], 'none'); } break; case 3: if(NodeActive($i)) { if($isReplicationMode || $isMasterSlaveMode) { array_push($nodeInfo[$i], 'return'); } else { array_push($nodeInfo[$i], 'none'); } break; } else { array_push($nodeInfo[$i], 'none'); } break; } } } $tpl->assign('refreshTime', _PGPOOL2_STATUS_REFRESH_TIME*1000); $tpl->assign('nodeInfo', $nodeInfo); $tpl->assign('parallelMode', $isParallelMode); $tpl->assign('msgStopPgpool', $message['msgStopPgpool']); $tpl->display('nodeStatus.tpl'); ?>