The following is an example of a trigger script that allows the configuration of multiple hot spare servers. The purpose of this is to monitor the active servers; and if they both go down or become unavailable, the hot spare servers will become active:
$commitChanges = FALSE; $sp = srvpool::getByName(“sp00”); $sv00 = si::getByName($sp, “sv00”); $sv01 = si::getByName($sp, “sv01”); $sv02 = si::getByName($sp, “sv02”); $sv03 = si::getByName($sp, “sv03”); // if both of these servers are down, make the other two servers active and hot_spare these. if ($sv00->getStatusResp() == 2 && $sv01->getStatusResp() == 2) { $sv00->hot_spare = TRUE; $sv01->hot_spare = TRUE; $sv02->hot_spare = FALSE; $sv03->hot_spare = FALSE; $commitChanges = TRUE; } else if ($sv02->getStatusResp() == 2 && $sv03->getStatusResp() == 2) { $sv00->hot_spare = FALSE; $sv01->hot_spare = FALSE; $sv02->hot_spare = TRUE; $sv03->hot_spare = TRUE; $commitChanges = TRUE; } // avoid unnecessary commits by using a flag if ($commitChanges == TRUE) { $sv00->commit(); $sv01->commit(); $sv02->commit(); $sv03->commit(); } |