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 "
";
}
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 '
';
echo '
Tips:(Click me to display tips)
';
echo '
';
foreach ($tips as $tip) {
echo "
$tip
";
echo "\n";
}
echo "
";
echo '';
echo '
';
return 0;
}
function insertDiv($id)
{
echo "";
}
function displayMonTable()
{
//create one table to display the monitoring plugins' list
echo '
TOS2;
insertButtons(array('label'=>$ns_tobe, 'id'=>'node_stat', 'onclick'=>"node_stat_control(\"$name\")"));
//TODO: change the function name of node_stat_control
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 '
";
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 "
$class
";
echo "
";
$ooe++;
$line++;
}
echo "
";
return 0;
}
function displayRMCAttr()
{
echo "
Select the RMC Resource, you will see all its available attributes here.
";
}
function RMCEventLogToTable()
{
$xml = docmd("webrun", "", array("lsevent"));
//var_dump($xml);
foreach($xml->children() as $response) foreach($response->children() as $records)
{
//$data should be one array to store all the RMC event log.
echo "
";
foreach($records->children() as $data) {
echo "
$data
";
}
echo "
";
}
}
//displayRMCEventLog() to display the RMC event logs in one table with "tablesorter" class
function displayRMCEvnetLog()
{
echo <<
Time
Category
Message
TOS9;
RMCEventLogToTable();
echo "";
//TODO: the following javascript doesn't work well.
echo <<
$("table").tablesorter({ sortList: [[0,1],[1,1]] });
TOS8;
echo "";
}
function displayRMCMonshowAttr($attr, $nr) {
//TODO: should add one argument to support the noderange argument
echo "
";
echo "
";
echo "";
echo "
";
echo "
Time
";
echo "
$attr
";
echo "
";
echo "";
echo "";
if($nr == "cluster") {
//get all the data by the command "monshow"
$xml = docmd("monshow", "", array("rmcmon", "-t", "60", "-a", "$attr"));
//the error handling is skipped
}elseif($nr == "summary") {
$xml = docmd("monshow", "", array("rmcmon", "-s", "-t", "60", "-a", "$attr"));
}else {
$xml = docmd("monshow", "", array("rmcmon", "$nr", "-t", "60", "-a", "$attr"));
}
//the formats of the data are different based on $nr
//print_r($xml);
$index = 0;
foreach($xml->children() as $response) foreach($response->children() as $data) {
//handle the data here
//skip the first 2 lines
if($index++ < 2) {
continue;
}
//then, parse "date" & "value"
$arr = preg_split("/\s+/", $data);
array_pop($arr);
$tmp = array_pop($arr);
if($tmp == '-') {
$val = array_pop($arr);
$time = implode(" ", $arr);
echo "
";
echo "
$time
";
echo "
$val
";
echo "
";
}
}
echo "";
echo "
";
echo "
";
}
function displayRMCMonshowGraph($value, $nr) {
//display the RMC Performance Data
echo <<
The Graph View for RMC Resource
TOS11;
}
/*
* function displayOptionsForPlugin($plugin)
* *****************************************
* when the user selects one plugin, the avaiable configuration options will display in
* TODO: for the non-rmcmon plugins, only the option "node/application status monitoring setting" is shown;
*
* the avaiable view options will also display in
,
* TODO: right now, it's only implemented for rmcmon plugin.
*/
function displayOptionsForPlugin($name)
{
echo "
";
echo "
Available Configurations for $name
";
echo '
';
echo "";
//set up the options for the plugin with the name "$name"
if($name == "rmcmon") {
//node status monitor, RMC events, RMC resources
echo "
";
//there should be many choices for the user to view the clusters' status
echo <<
TOS1;
if($name == "rmcmon") {
#display two rows, one for RMC event, another for RMC Resource Performance monitoring.
echo "
";
echo "
RMC Event Logs
";
echo "
";
insertButtons(array('label'=>'View in Text', 'id'=>'rmc_event_text', 'onclick'=>'loadMainPage("monitor/rmc_lsevent.php")'));
echo "
";
echo "
";
echo "
";
echo "
RMC Resource Logs
";
echo "
";
insertButtons(array('label'=>'View By text/graphics', 'id'=>'rmc_resrc_text', 'onclick'=>'loadMainPage("monitor/rmc_monshow.php")'));
echo "
";
echo "
";
}
else {
echo "
There's no view functions for $name.
";
}
echo "
";
}
/*
* function displayNodeAppStatus($name)
* ************************************
* to display the web page "Node/Application Status Monitoring"
*
*/
function displayNodeAppStatus($name)
{
displayMapper(array('home'=>'main.php', 'monitor'=>''));
displayTips(array(
"Enable/disable Node/App Status Monitoring by clicking the button",
"In order to take affect, you have to START/RESTART the desired plugin"));
//get the current status for "node-status-monitor"
$xml = docmd("monls", ' ', array($name));
if(getXmlErrors($xml,$errors)) {
echo "
",implode(' ',$errors), "
";
exit;
}
#then, parse the xml data
foreach($xml->children() as $response) foreach($response->children() as $data) {
list($n, $stat, $nodemonstatus) = preg_split("/\s+/",$data);
if(isset($nodemonstatus)) {
$ns = "Enabled";
}else {
$ns = "Disabled";
}
}
display_stat_mon_table(array("$name"=>
array(
'nodestat'=>$ns,
'appstat'=>'Disabled', //currently application status monitoring is not supported by xCAT monitor Arch.
)));
}
?>