</fieldset><?php unset($id, $unused_node, $add_button, $drop_button); } else { } ?> <input id='add_soft' type='button' value='Add node to Repmgr' onclick='$.skyboxShow("/dev/db/repmgr/add");' /><?php #output ps findings on standby_nodes ?> <fieldset><legend>Monitoring Daemon Status</legend><?php ?> <div>NOTE: repmgr monitoring daemons only run on standby nodes</div><?php ?> <div>NOTE: Killing a repmgr monitoring daemon will NOT stop replication, it will only stop the stats table from being updated</div><?php $ssh_user = '******'; foreach ($repmgr->get_nodes() as $node) { $ps = $repmgr->remote_ps($node['id'], $ssh_user); ?> <fieldset class='ps' ><legend>repmgr Processes on <?php echo $node['host']; ?> </legend><?php if (is_array($ps)) { ?> <div id='ps_<?php echo $node['id']; ?> _error'></div><?php ?> <input id='ps_<?php echo $node['id']; ?>
<?php unset($repmgr); $repmgr = new repmgr($db_host, true); if (!$repmgr || !$repmgr->initialized) { die('no cluster installed'); } $params = count($_POST) ? $_POST : (count($_GET) ? $_GET : die('no parameters')); switch ($params['func']) { case 'kill': $standby_node = $params['a']; $pid = $params['b']; $output = $repmgr->remote_kill($standby_node, $pid); $json = array('exit_status' => $exit_status = array_pop($output), 'success' => $exit_status == '0', 'output' => is_array($output) ? implode('\\n', $output) : $output, 'ps' => $repmgr->remote_ps($standby_node)); echo json_encode($json); break; case 'start': $standby_node = $params['a']; $output = $repmgr->remote_start($standby_node); $json = array('exit_status' => $exit_status = array_pop($output), 'success' => $exit_status == '0', 'output' => is_array($output) ? implode('\\n', $output) : $output, 'ps' => $repmgr->remote_ps($standby_node)); echo json_encode($json); break; case 'promote': #still experimental $new_primary_node = $params['a']; $output = $repmgr->promote($new_primary_node); $json = array('output' => $output); echo json_encode($json); break; case 'add_hard': $node = $params['a'];