code related with monitor interface is put here. */ #displayMonitorLists() will generate all the monitoring plug-ins, #the user can select the plug-ins he wants to operate on, #and press the "Next" button; function displayMonitorLists() { #The command "monls -a" is used to get the monitoring plug-ins list $xml = docmd("monls"," ", array('-a')); if(getXmlErrors($xml,$errors)) { echo "

",implode(' ', $errors), "

"; exit; } #then, parse the xml data $ooe = 0; $line = 0; foreach($xml->children() as $response) foreach($response->children() as $data) { list($name, $stat, $nodemonstatus) = preg_split("/\s+/", $data); $ooe = $ooe%2; echo ""; echo ""; echo "$name"; echo "$stat"; if(isset($nodemonstatus)) { echo "Enabled";}else {echo "Disabled";} echo ""; $name_str = "\"$name\""; if($stat == "monitored") { $act_str = "\"stop\""; insertButtons(array('label'=>'Stop', 'id'=>'stop', 'onclick'=>"monsetupAction($name_str, $act_str)")); $act_str = "\"restart\""; insertButtons(array('label'=>'Restart', 'id'=>'restart', 'onclick'=>"monsetupAction($name_str, $act_str)")); }else { $act_str = "\"start\""; insertButtons(array('label' => 'Start', 'id'=>'start', 'onclick' => "monsetupAction($name_str, $act_str)")); } echo ""; echo " "; $ooe++; $line++; //echo "$name$stat$name"; } return 0; } function displayTips($tips) { //to tell the user how to operate on the current web page //the argument $tips is an array like this: //{ // "Click the name of each plugin, you can get the plugin's description.", // "You can also select one plugin, then you can set node/application status monitoring for the selected plugin.", //} echo '

Tips:

'; foreach ($tips as $tip) { echo "

$tip

"; echo "\n"; } echo '
'; return 0; } function insertDiv($id) { echo "
"; } function displayMonTable() { //create one table to display the monitoring plugins' list echo '
'; echo << Plug-in Name Status Node Status Monitoring Action TOS1; echo << showPluginOptions(); showPluginDescription(); TOS9; echo ''; displayMonitorLists(); echo "
"; return 0; } function display_stat_mon_table($args) { //create one table to disable or enable node/application monitoring //the argument $args are one array like this: //{ 'xcatmon' => { // 'nodestat' => 'Enabled', // 'appstat' => 'Disabled', // }, //}; // echo '
'; foreach($args as $key => $value) { $name = $key; if($value{'nodestat'} == 'Enabled') { $ns_tobe = 'Disable'; } else { $ns_tobe = 'Enable'; } if($value{'appstat'} == 'Enabled') { $as_tobe = 'Disable'; } else { $as_tobe = 'Enable'; } } echo "

Node/Application Status Monitoring for $name

"; echo << Node Status Monitoring TOS2; insertButtons(array('label'=>$ns_tobe, 'id'=>'node_stat', 'onclick'=>"node_stat_control(\"$name\")")); echo ''; echo ''; echo ''; echo 'Application Status Monitoring'; echo ''; insertbuttons(array('label'=>$as_tobe, 'id'=>'app_stat', 'onclick'=>'')); echo ''; echo ''; echo '
'; } function displayStatus() { //tell the user that the current interface is not done yet... echo "

This interface is still under development -use accordingly.

"; } function displayOSITree() { //display the node range tree, but only with the nodes with OSI type //this follows the function displayNrTree(); //it doesn't work on firefox!!! echo << $(init_ositree());
EOS3; } function displayAssociation() { echo '
'; echo <<Available Condition/Response Associations TOS5; $xml = docmd("webrun", "", array("lscondresp")); if(getXmlErrors($xml,$errors)) { echo "

",implode(' ', $errors), "

"; exit; } //get all the condition&response associations for RMC foreach ($xml->children() as $response) foreach($response->children() as $data) { //get the data from xcatd $association = explode("=", $data); $ooe = 0; $line = 0; foreach($association as $elem) { $ooe = $ooe%2; //the format should be //"NodeReachability"\t"EmailRootOffShift"\t"hv8plus01.ppd.pok.ibm.com"\t"Active" $record = explode("\"", $elem); $cond = $record[1]; $resp = $record[3]; $node = $record[5]; $state = $record[7]; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; $ooe++; $line++; } } echo "
Condition Response Node State Action
$cond$resp$node$state"; if($state == "Active") { insertButtons(array('label'=>'DeActivate', 'id'=>'deactivate', 'onclick'=>"control_RMCAssoc(\"$cond\", \"$node\", \"$resp\", \"stop\")")); }else if($state == "Not active"){ insertButtons(array('label'=>'Activate', 'id'=>'activate', 'onclick'=>"control_RMCAssoc(\"$cond\", \"$node\", \"$resp\", \"start\")")); } echo "
"; return 0; } function displayCond() { //the user selects one node/noderange from the #ositree div echo << Available Conditions COND; $xml = docmd("webrun", '', array("lscondition")); foreach($xml->children() as $response) foreach($response->children() as $data) { //get the data from xcatd $conditions = explode("=", $data); } $ooe = 0; $line = 0; foreach($conditions as $elem) { $ooe = $ooe%2; echo ""; echo ""; echo ""; echo ""; $ooe++; $line++; } echo "
Conditions
$elem
"; return 0; } function displayResp() { echo << Available Response RESP; $xml=docmd("webrun", '', array("lsresponse")); $ooe=0; $line=0; foreach($xml->children() as $response) foreach($response->children() as $data) { $responses = explode("=", $data); } foreach($responses as $elem) { $ooe = $ooe%2; echo ""; echo ""; echo ""; echo ""; $ooe++; $line++; } echo '
Response
$elem
'; return 0; } function displayCondResp() { echo '
'; displayAssociation(); displayCond(); displayResp(); insertButtons(array('label'=>'Add', id=>'addAssociation', 'onclick'=>'mkCondResp()')); insertButtons(array('label'=>'Cancel', id=>'cancel_op', 'onclick'=>'clearEventDisplay()')); echo '
'; displayStatus(); } function displayMonsetting() //TODO: copied from the function displayTable() from display.php, need update { echo "
"; echo "

$tab

\n"; insertButtons(array('label' => 'Save','id' => 'saveit'), array('label' => 'Cancel', 'id' => 'reset') ); $xml = docmd('tabdump', '', array("monsetting")); $headers = getTabHeaders($xml); if(!is_array($headers)){ die("

Can't find header line in $tab

"); } echo "\n"; #echo "
\n"; echo ""; echo "\n"; # extra cell for the red x #echo "\n"; # extra cell for the red x foreach($headers as $colHead) {echo ""; } echo "\n"; # close header row echo ""; $tableWidth = count($headers); $ooe = 0; $item = 0; $line = 0; $editable = array(); foreach($xml->children() as $response) foreach($response->children() as $arr){ $arr = (string) $arr; if(ereg("^#", $arr)){ $editable[$line++][$item] = $arr; continue; } $cl = "ListLine$ooe"; $values = splitTableFields($arr); # X row echo ""; foreach($values as $v){ echo ""; $editable[$line][$item++] = $v; } echo "\n"; $line++; $item = 0; $ooe = 1 - $ooe; } echo "
$colHead
$v
\n"; $_SESSION["editable-$tab"] = & $editable; # save the array so we can access it in the next call of this file or change.php echo "

"; insertButtons(array('label' => 'Add Row', 'id' => 'newrow')); echo "

\n"; } function displayRMCRsrc() { echo <<Available RMC Resources TOS0; $xml = docmd("webrun", "", array("lsrsrc")); if(getXmlErrors($xml,$errors)) { echo "

",implode(' ', $errors), "

"; exit; } foreach($xml->children() as $response) foreach($response->children() as $data) { //get all the class name $classes = explode("=", $data); } $ooe = 0; $line = 0; foreach($classes as $class) { $ooe = $ooe%2; echo ""; echo ""; echo ""; echo ""; $ooe++; $line++; } echo "
Class Name
$class
"; return 0; } function displayRMCAttr() { echo "

Select the RMC Resource, you will see all its available attributes here.

"; } ?>