add gangliamon configure
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@7489 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
parent
e08d48c877
commit
1d18c14551
116
xCAT-UI/js/monitor/gangliamon.js
Normal file
116
xCAT-UI/js/monitor/gangliamon.js
Normal file
@ -0,0 +1,116 @@
|
||||
function loadGangliaMon(){
|
||||
var gangMonTab = $('#gangliamon');
|
||||
var gangMonStatus = createStatusBar('gangMonStatus');
|
||||
gangMonTab.append(gangMonStatus);
|
||||
|
||||
gangMonTab.append("<div id='gangMonConfig'></div>");
|
||||
$('#gangMonConfig').hide();
|
||||
addCfgButton();
|
||||
|
||||
gangMonTab.append("<div id='gangLink'></div>");
|
||||
$('#gangLink').hide();
|
||||
addGangLink();
|
||||
|
||||
$.ajax( {
|
||||
url : 'lib/systemcmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'rpm -q rrdtool ganglia-gmetad ganglia-gmond ganglia-web'
|
||||
},
|
||||
|
||||
success : gangRpmCheck
|
||||
});
|
||||
}
|
||||
|
||||
function addCfgButton(){
|
||||
var startButton = createButton('Start');
|
||||
$('#gangMonConfig').append(startButton);
|
||||
startButton.bind('click', function(){
|
||||
$.ajax({
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'webrun',
|
||||
tgt : '',
|
||||
args : 'gangliaStart',
|
||||
msg : ''
|
||||
},
|
||||
|
||||
success : function(data){
|
||||
$('#rmcMonStatus').empty().append(data.rsp[0]);
|
||||
$('#gangLink').show();
|
||||
}
|
||||
});
|
||||
});
|
||||
$('#gangMonConfig').append(startButton);
|
||||
|
||||
var stopButton = createButton('Stop');
|
||||
$('#gangMonConfig').append(startButton);
|
||||
stopButton.bind('click', function(){
|
||||
$.ajax({
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'rmcstop',
|
||||
tgt : '',
|
||||
args : 'gangliamon,-r',
|
||||
msg : ''
|
||||
},
|
||||
|
||||
success : function(data){
|
||||
$('#rmcMonStatus').empty().append(data.rsp[0]);
|
||||
$('#gangLink').hide();
|
||||
}
|
||||
});
|
||||
});
|
||||
$('#gangMonConfig').append(stopButton);
|
||||
}
|
||||
|
||||
function addGangLink(){
|
||||
$('#gangLink').append('The Ganglia is running now. <br\>');
|
||||
$('#gangLink').append('please click <a href="">here</a> to open the Ganglia\'s main page');
|
||||
$('#gangLink a').click(function(){
|
||||
window.open('../ganglia/');
|
||||
});
|
||||
}
|
||||
function gangRpmCheck(data){
|
||||
var rpmStatus = data.rsp.split(/\n/);
|
||||
var stopFlag = false;
|
||||
var showString = "";
|
||||
var tempArray = ["rrdtool", "ganglia-gmetad", "ganglia-gmond", "ganglia-web"];
|
||||
|
||||
for (var temp in rpmStatus){
|
||||
if(-1 != rpmStatus[temp].indexOf("not")){
|
||||
stopFlag = true;
|
||||
showString += "Please install <b>" + tempArray[temp] + "</b>.<br/>";
|
||||
}
|
||||
}
|
||||
|
||||
if (stopFlag){
|
||||
showString += "<p>References: <a href='http://xcat.svn.sourceforge.net/viewvc/xcat/xcat-core/trunk/xCAT-client/share/doc/xCAT2-Monitoring.pdf'>xCAT2-Monitoring.pdf</a>.</p>";
|
||||
$('#gangMonStatus').empty().append(showString);
|
||||
return;
|
||||
}
|
||||
|
||||
$('#gangMonConfig').show();
|
||||
|
||||
$.ajax({
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'monls',
|
||||
tgt : '',
|
||||
args : 'gangliamon',
|
||||
msg : ''
|
||||
},
|
||||
|
||||
success : function(data){
|
||||
if (-1 != data.rsp[0].indexOf("not-monitored")){
|
||||
$('#gangMonStatus').empty().append("Please start the Ganglia Monitoring first.");
|
||||
return;
|
||||
}
|
||||
|
||||
$('#gangLink').show();
|
||||
}
|
||||
});
|
||||
}
|
@ -70,7 +70,8 @@ function loadMonitorPage() {
|
||||
"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='gangliamon'>Ganglia Monitor</a> : Ganglia is a scalable distributed " +
|
||||
"monitoring system for high-performance computing systems such as clusters and Grids.<li>";
|
||||
items += "<li><a href='#' name='pcpmon'>PCP Monitor</a> : <li>";
|
||||
|
||||
monitorList.append(items);
|
||||
@ -175,7 +176,8 @@ function loadMonitorTab(monitorName){
|
||||
loadRmcMon();
|
||||
break;
|
||||
case 'gangliamon':
|
||||
loadUnfinish(monitorName, tab);
|
||||
tab.add(monitorName, 'Ganglia Monitor', '', true);
|
||||
loadGangliaMon();
|
||||
break;
|
||||
case 'pcpmon':
|
||||
loadUnfinish(monitorName, tab);
|
||||
@ -189,5 +191,5 @@ function loadUnfinish(monitorName, tab){
|
||||
var unfinishPage = $('<div></div>');
|
||||
unfinishPage.append(createInfoBar('under construction.'));
|
||||
|
||||
tab.add(monitorName, 'unfinish', unfinishPage, '', true);
|
||||
tab.add(monitorName, 'unfinish', unfinishPage, true);
|
||||
}
|
@ -446,7 +446,7 @@ function initPage() {
|
||||
} else if (page == 'monitor.php') {
|
||||
includeJs("js/monitor/xcatmon.js");
|
||||
includeJs("js/monitor/rmcmon.js");
|
||||
|
||||
includeJs("js/monitor/gangliamon.js");
|
||||
headers.eq(3).css('background-color', '#A9D0F5');
|
||||
loadMonitorPage();
|
||||
} else {
|
||||
|
@ -52,6 +52,7 @@ sub process_request
|
||||
'unlock' => \&web_unlock,
|
||||
'rmcstart' => \&web_rmcmonStart,
|
||||
'rmcshow' => \&web_rmcmonShow,
|
||||
'gangliaStart' => \&web_gangliamonStart,
|
||||
|
||||
#'xdsh' => \&web_xdsh,
|
||||
#THIS list needs to be updated
|
||||
@ -433,7 +434,7 @@ sub web_rmcmonStart{
|
||||
$callback->({info=>'RMC Monitoring is running now.'});
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$retData .= "RMC is not running, start it now.\n";
|
||||
|
||||
@ -631,4 +632,43 @@ sub web_rmcmonShow(){
|
||||
#push the last attribute name and values.
|
||||
push(@{$retHash->{node}}, {name=>$attrName, data=>join(',', @attrValue)});
|
||||
$callback->($retHash);
|
||||
}
|
||||
|
||||
sub web_gangliamonStart(){
|
||||
my ( $request, $callback, $sub_req ) = @_;
|
||||
my $table;
|
||||
my $retInfo;
|
||||
my $output;
|
||||
|
||||
#check the running status
|
||||
$table = xCAT::Table->new('monitoring');
|
||||
my $gangWorkingStatus = $table->getAttribs({name => 'gangliamon'}, 'disable');
|
||||
$table.close();
|
||||
|
||||
#the rmc monitoring is running so return directly
|
||||
if($gangWorkingStatus){
|
||||
if ($gangWorkingStatus->{disable} =~ /0|No|no|NO|N|n/){
|
||||
$callback->({info=>'Ganglia Monitoring is running now.'});
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
#run configure commands
|
||||
$output = xCAT::Utils->runcmd('monadd gangliamon', -1, 1);
|
||||
foreach($output){
|
||||
$retInfo .= ($_ . "\n");
|
||||
}
|
||||
|
||||
$output = xCAT::Utils->runcmd('moncfg gangliamon -r', -1, 1);
|
||||
foreach($output){
|
||||
$retInfo .= ($_ . "\n");
|
||||
}
|
||||
|
||||
$output = xCAT::Utils->runcmd('monstart gangliamon -r', -1, 1);
|
||||
foreach($output){
|
||||
$retInfo .= ($_ . "\n");
|
||||
}
|
||||
|
||||
$callback->({info=>$retInfo});
|
||||
return;
|
||||
}
|
Loading…
Reference in New Issue
Block a user