2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-05-29 17:23:08 +00:00

modified and added by xuqing for xCAT Monitor and RMC Monitor

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@6970 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
xq2005 2010-08-04 08:49:20 +00:00
parent f98359ae33
commit a33e97a309
4 changed files with 319 additions and 3 deletions

View File

@ -54,13 +54,32 @@ function loadMonitorPage() {
var monitorForm = $('<div class="monitor"></div>');
// Create info bar
var monitorInfoBar = createInfoBar('Under construction');
var monitorInfoBar = createInfoBar('Select the Monitor Tool');
monitorForm.append(monitorInfoBar);
// Create drop-down menu
// Hardware available to provision - ipmi, blade, hmc, ivm, fsp, and zvm
var div = $('<div></div>');
monitorForm.append(div);
var monitorList = $('<ul></ul>');
var items = "<li><a href='#' name='xcatmon'>xCAT Monitor</a> : xcatmon provides node status " +
"monitoring using fping on AIX and nmap on Linux. It also provides application " +
"status monitoring. The status and the appstatus columns of the nodelist table " +
"will be updated periodically with the latest status values for the nodes.<li>";
items += "<li><a href='#' name='rmcmon'>RMC Monitor</a> : IBM's Resource Monitoring and Control (RMC) " +
"subsystem is our recommended software for monitoring xCAT clusters. It's is part " +
"of the IBM's Reliable Scalable Cluster Technology (RSCT) that provides a comprehensive " +
"clustering environment for AIX and LINUX.<li>";
items += "<li><a href='#' name='gangliamon'>Ganglia Monitor</a> : <li>";
items += "<li><a href='#' name='pcpmon'>PCP Monitor</a> : <li>";
monitorList.append(items);
$('a', monitorList).click(function(){
loadMonitorTab($(this).attr('name'));
});
monitorForm.append(monitorList);
tab.add('monitorTab', 'Monitor', monitorForm, false);
/**
@ -136,4 +155,39 @@ function loadMonitorPage() {
resrcForm.append(okBtn);
tab.add('resourceTab', 'Resources', resrcForm, false);
}
function loadMonitorTab(monitorName){
//the tab is exist then we only need to select it
var tab = getMonitorTab();
if (0 != $("#" + monitorName).length){
tab.select(monitorName);
return;
}
switch(monitorName){
case 'xcatmon':
tab.add(monitorName, 'xCAT Monitor', '', true);
loadXcatMon();
break;
case 'rmcmon':
tab.add(monitorName, 'RMC Monitor', '', true);
loadRmcMon();
break;
case 'gangliamon':
loadUnfinish(monitorName, tab);
break;
case 'pcpmon':
loadUnfinish(monitorName, tab);
break;
}
tab.select(monitorName);
}
function loadUnfinish(monitorName, tab){
var unfinishPage = $('<div></div>');
unfinishPage.append(createInfoBar('under construction.'));
tab.add(monitorName, 'unfinish', unfinishPage, '', true);
}

View File

@ -0,0 +1,98 @@
function loadRmcMon(){
//find the rmcmon tab
var rmcMonTab = $('#rmcmon');
//add the stauts bar first. id = 'rmcMonStatus'
var rmcStatusBar = createStatusBar('rmcMonStatus');
rmcStatusBar.append(createLoader());
rmcMonTab.append(rmcStatusBar);
//add the configure button.
var configButton = createButton('Configure');
configButton.click(function(){
if ($('#rmcMonConfig').is(':hidden')){
$('#rmcMonConfig').show();
}
else{
$('#rmcMonConfig').hide();
}
});
rmcMonTab.append(configButton);
//add configure div
rmcMonTab.append("<div id='rmcMonConfig'></div>");
$('#rmcMonConfig').hide();
//load the configure div's content
loadRmcMonConfigure();
//add the content of the rmcmon, id = 'rmcMonTab'
rmcMonTab.append("<div id='rmcMonShow'></div>");
//check the software work status by platform(linux and aix)
$.ajax( {
url : 'lib/systemcmd.php',
dataType : 'json',
data : {
cmd : 'ostype'
},
success : rsctRpmCheck
});
}
function loadRmcMonConfigure(){
$('#rmcMonConfig').append('under construction.');
}
function rsctRpmCheck(data){
//linux had to check the rscp first
if ('aix' != data.rsp){
$.ajax( {
url : 'lib/systemcmd.php',
dataType : 'json',
data : {
cmd : 'rpm -q rsct.core'
},
success : function(data){
if (-1 != data.rsp.indexOf("not")){
$('#rmcMonStatus').empty().append('Please install the RSCT first.<br/> The software can be downloaded from ' +
'<a href="http://www14.software.ibm.com/webapp/set2/sas/f/rsct/rmc/download/home.html" target="install_window">RSCT\'s RMC subsystem.</a><br/>' +
'You can find more support form <a href="http://xcat.svn.sourceforge.net/viewvc/xcat/xcat-core/trunk/xCAT-client/share/doc/xCAT2-Monitoring.pdf" target="pdf_window">xCAT2-Monitoring.pdf</a>');
}
else{
xcatrmcRpmCheck();
}
}
});
}
else{
xcatrmcRpmCheck();
}
}
function xcatrmcRpmCheck(){
$.ajax( {
url : 'lib/systemcmd.php',
dataType : 'json',
data : {
cmd : 'rpm -q xCAT-rmc'
},
success : function(data){
if(-1 != data.rsp.indexOf("not")){
$('#rmcMonStatus').empty().append('Please install the xCAT-rmc first.<br/> The software can be downloaded from ' +
'<a href="http://xcat.sourceforge.net/#download" target="install_window">xCAT Download Page.</a><br/>'+
'You can find more support form <a href="http://xcat.svn.sourceforge.net/viewvc/xcat/xcat-core/trunk/xCAT-client/share/doc/xCAT2-Monitoring.pdf" target="pdf_window">xCAT2-Monitoring.pdf</a>');
}
else{
loadRmcMonShow();
}
}
});
}
function loadRmcMonShow(){
$('#rmcMonStatus').empty().append('The RMC Monitor is under construction.');
$('#rmcMonShow').empty().append('under construction.');
}

View File

@ -0,0 +1,162 @@
function loadXcatMon(){
//find the xcat mon tab
var xcatMonTab = $('#xcatmon');
//add the stauts bar first. id = 'xcatMonStatus'
var StatusBar = createStatusBar('xcatMonStatus');
StatusBar.append(createLoader());
xcatMonTab.append(StatusBar);
//add the configure button.
var configButton = createButton('Configure');
configButton.click(function(){
if ($('#xcatMonConfig').is(':hidden')){
$('#xcatMonConfig').show();
}
else{
$('#xcatMonConfig').hide();
}
});
xcatMonTab.append(configButton);
//add the configure div, id = 'xcatMonConfig'
xcatMonTab.append("<div id='xcatMonConfig'></div>");
$('#xcatMonConfig').hide();
//add button start, stop, cancel to the monconfig div
loadXcatMonConfigure();
//add the content of the xcat mon, id = 'xcatMonShow'
xcatMonTab.append("<div id='xcatMonShow'></div>");
//show the content of the page.
$.ajax( {
url : 'lib/cmd.php',
dataType : 'json',
data : {
cmd : 'monls',
tgt : '',
args : 'xcatmon',
msg : ''
},
success : loadXcatMonWorkStatus
});
}
function loadXcatMonWorkStatus(data){
var xcatWorkStatus = data.rsp[0];
//the xcat mon did not run
if (-1 != xcatWorkStatus.indexOf('not-monitored')){
$('#xcatMonStatus').empty().append('The xCAT Monitor is not working. Please start it first.');
return;
}
//the xcatmon is running, show the result
loadXcatMonShow();
}
function loadXcatMonConfigure(){
//get the xcat mon configure div
var xcatMonConfigDiv = $('#xcatMonConfig');
xcatMonConfigDiv.empty();
//add start button
var startButton = createButton('Start');
xcatMonConfigDiv.append(startButton);
startButton.click(function(){
$('#xcatMonStatus').empty().append(createLoader());
$.ajax({
url : 'lib/cmd.php',
dataType : 'json',
data : {
cmd : 'monstart',
tgt : '',
args : 'xcatmon',
msg : ''
},
success : function(data){
//update the status bar, update the xcatmon show
$('#xcatMonStatus').empty().append(data.rsp[0]);
loadXcatMonShow();
}
});
});
//add stop buttons
var stopButton = createButton('Stop');
xcatMonConfigDiv.append(stopButton);
stopButton.click(function(){
$('#xcatMonStatus').empty().append(createLoader());
$.ajax({
url : 'lib/cmd.php',
dataType : 'json',
data : {
cmd : 'monstop',
tgt : '',
args : 'xcatmon',
msg : ''
},
success : function(data){
$('#xcatMonStatus').empty().append(data.rsp[0]);
$('#xcatMonShow').empty();
}
});
});
//add cancel button
var cancelButton = createButton('Cancel');
xcatMonConfigDiv.append(cancelButton);
cancelButton.click(function(){
$('#xcatMonConfig').hide();
});
}
function loadXcatMonShow(){
//update the status bar into waiting
$('#xcatMonStatus').empty().append(createLoader());
//get the latest xcatmon information
$.ajax({
url : 'lib/cmd.php',
dataType : 'json',
data : {
cmd : 'nodestat',
tgt : 'lpar',
args : '',
msg : ''
},
success : updateXcatMonShow
});
}
function updateXcatMonShow(data){
var temp = 0;
var nodeStatus = data.rsp;
var show = "";
var tempArray;
//update the status bar
$('#xcatMonStatus').empty().append("Get nodes' status finished.");
$('#xcatMonShow').empty();
$('#xcatMonShow').append("<fieldset><legend>Node Status</legend></fieldset>");
//get the nodestat from return data
//the data.rsp is an array, it look like this:
//['node1:ssh', 'node2:noping', 'node3:ssh']
for (temp = 0; temp < nodeStatus.length; temp++){
tempArray = nodeStatus[temp].split(':');
show += '<p>' + tempArray[0] + ':' + tempArray[1] + '</p>';
}
$('#xcatMonShow fieldset').append(show);
var refreshButton = createButton('Refresh');
$('#xcatMonShow fieldset').append(refreshButton);
refreshButton.click(function(){
loadXcatMonShow();
});
}

View File

@ -407,6 +407,8 @@ function initPage() {
includeJs("js/jquery/jquery.tree.js");
includeJs("js/configure/configure.js");
includeJs("js/configure/update.js");
includeJs("js/monitor/xcatmon.js");
includeJs("js/monitor/rmcmon.js");
includeJs("js/monitor/monitor.js");
includeJs("js/nodes/nodes.js");
includeJs("js/provision/provision.js");