Location: PHPKode > projects > SCOP Heartbeat Administration interface > scop-2.0/html/scop/maint/maint.php

$l = $_GET['l'];
global $meta;
$meta = "<meta http-equiv=\"refresh\" content=\"10;url=maint.php?srcfile=ldirectord&action=modrealweight&l=$l\">";

// maint.php : All code hear is to allow the maintenance of real servers by allowing you to take them on or off line
// It needs to display both required AND acctual status.
// Copyright Loadbalancer.org Limited all source code protected by the GPL with NO WARRANTY.

include ("../inc/header.inc");
include ("../inc/functions.inc");

# This code opens a file, reads it into an array and then writes it back to a file.

If ($srcfile=="ldirectord") {

	parse_status_file(); // Get the actual live status from ipvsadm
	parse_config_file(); // Read the ldirectord.cf file and setup the global variables

	if ($action=="modrealweight") {

		if ($subaction=="change") {

			$realserver = $REAL_LABEL[$v][$r];

			if ($REALWEIGHT[$v][$r]==0) {
				SCOP_log("Maintenance : Real server $realserver changed to ONLINE for VIP $VIRTUAL_LABEL[$v]");
			else {

				SCOP_log("Maintenance : Real server $realserver changed to OFFLINE for VIP $VIRTUAL_LABEL[$v]");


		// Need to parse the live status as well as requested for comparison.

		//echo "<h2>Modify The Status Of Real Servers</h2>";
		$txt = "${$l.$trans}";

		$a4 = "${$l.$trans}"

<div id="contentArea">
<h1><a href="/scop/index.php?menu=maint&l=<?=$l?>"><?=$a4?></a> &gt; <?=$txt?></h1>
<div class="border">


		$a43 = "${$l.$trans}";
		$a21 = "${$l.$trans}";
		$a44 = "${$l.$trans}";
		$a45 = "${$l.$trans}";
		$a46 = "${$l.$trans}";
		$a47 = "${$l.$trans}";
		$a48 = "${$l.$trans}";
		$a49 = "${$l.$trans}";
		$a50 = "${$l.$trans}";
		$a51 = "${$l.$trans}";
		$a52 = "${$l.$trans}";
		$a55 = "${$l.$trans}";

		//echo "</br>Taking a server offline will change its weight to 0, and the weighted least connection algorithm will no longer use this server.<BR>This is ideal if you need to perform maintenance on a server in the cluster. </br>";
		//echo "When you bring it back online the weight is set to 1. </br>";

		echo "<FORM method=\"post\" action=\"maint.php?srcfile=ldirectord&action=modrealweight&t=$t\"> <center><INPUT type=\"submit\" value=\"$a55\" name=\"go\" ></center></form><br />";

		echo "<table class=\"datagrid\" align=\"center\" summary=\"server status\">";
		echo "<th><b> $a43 </th><th><i> $a21 </i></b></th><th> <b> $a44 </b></th><th><center><i> $a45 </i></center></th><th><center><b> $a46  </b></center></th><th><center><b> $a47 </b></center></th><th><center> $a48 </th> " ;
			?><tr><td colspan="7" class="sep2"></td></tr><?

		for ( $i=1; $i<count($VIRTUAL); $i++) { // Display the current info for each virtual server
			// get the total cons
				for ( $b=0; $b<count($REAL[$i]); $b++) {
			//First display the Virtual server info
			echo "<tr><th><b> VIP $i </th><th><i>$VIRTUAL_LABEL[$i]</i></b></th><th><b> $VIRTUAL[$i] </b></th><th><center><i> $REALVIPACTIVCONS </i></center></th><th><center><b>  </b></center></th><th><center><b> </b></center></th><th><center> " . active($VIRTUALWEIGHT_stat[$i]) . "</th></tr>" ;
?><tr><td colspan="7" class="sep1"></td></tr><?
			//echo "</table><table width=\"60%\">";

			//for ( $b=0; $b<count($REAL[$i]); $b++) {
			for ( $b=count($REAL[$i])-1; $b>-1; $b--) {
				echo "<tr><td><center>RIP <b>$x</b></center> </td><td><i><center> " . $REAL_LABEL[$i][$b] . " </center> </i></td><td><center><b> " . $REAL[$i][$b] . "</b></center></td><td><center><i> " . $REALACTIVECONS_stat[$i][$b] . "</i></center></td>";
				if ($REALWEIGHT[$i][$b]==0) {
					echo "<td><b><center><font color=\"red\" >$a50 (<i>" . $REALWEIGHT[$i][$b] . "</i>)</font></center></b></td><td><center><a href=\"maint.php?srcfile=ldirectord&action=modrealweight&subaction=change&v=$i&r=$b&t=$t\"> $a52 </a></center></td><td><center>"  . active($REALWEIGHT_stat[$i][$b]) . "</center></td></tr>";
				else {
					echo "<td><b><center><font color=\"#0ef42d\"> $a49 (<i><a href=\"../config/display.php?srcfile=ldirectord&action=modreal&subaction=modify&v=$i&r=$b&l=$l\">" . $REALWEIGHT[$i][$b] . "</a></i>)</font></center></b></td><td><center><a href=\"maint.php?srcfile=ldirectord&action=modrealweight&subaction=change&v=$i&r=$b&t=$t\"> $a51 </a></center></td><td><center> "  . active($REALWEIGHT_stat[$i][$b]) . " </center></td></tr>";
			?><tr><td colspan="7" class="sep1"></td></tr><?

		echo "</table>";
<hr class="sep1">

<div class="bottom"><span>-----</span></div>
		//echo "</br>NB. When you take a server offline make sure the current sessions have finished before re-booting a Real Server etc. </br>";
		# open a new file


include ("../inc/footer.inc");

Return current item: SCOP Heartbeat Administration interface