2010-06-16 18:21:58 +00:00
/ * *
* Global variables
* /
var monitorTabs ; // Monitor tabs
/ * *
* Set the monitor tab
*
* @ param o
* Tab object
* @ return Nothing
* /
function setMonitorTab ( o ) {
monitorTabs = o ;
}
/ * *
* Get the monitor tab
*
* @ param Nothing
* @ return Tab object
* /
function getMonitorTab ( ) {
return monitorTabs ;
}
/ * *
* Load the monitor page
*
* @ return Nothing
* /
function loadMonitorPage ( ) {
// If the page is already loaded
if ( $ ( '#monitor_page' ) . children ( ) . length ) {
// Do not reload the monitor page
return ;
}
// Create monitor tab
var tab = new Tab ( ) ;
setMonitorTab ( tab ) ;
tab . init ( ) ;
2010-07-14 20:11:07 +00:00
$ ( '#content' ) . append ( tab . object ( ) ) ;
2010-06-16 18:21:58 +00:00
2010-09-11 13:06:07 +00:00
var monitorForm = $ ( '<div class="form"></div>' ) ;
2011-03-03 19:08:04 +00:00
monitorForm . append ( 'Getting monitoring status ' ) . append ( createLoader ( ) ) ;
2010-08-03 14:58:08 +00:00
tab . add ( 'monitorTab' , 'Monitor' , monitorForm , false ) ;
2010-06-16 18:21:58 +00:00
2011-03-03 19:08:04 +00:00
// Get monitoring status of each tool
2011-01-12 10:43:45 +00:00
$ . ajax ( {
url : 'lib/cmd.php' ,
dataType : 'json' ,
data : {
cmd : 'webrun' ,
tgt : '' ,
args : 'monls' ,
msg : ''
} ,
2011-03-03 19:08:04 +00:00
/ * *
* Load monitoring status
*
* @ param data
* Data returned from HTTP request
* @ return Nothing
* /
2011-01-12 10:43:45 +00:00
success : function ( data ) {
2011-03-03 19:08:04 +00:00
// Initialize status for each tool
2011-01-12 10:43:45 +00:00
var monitorStatusHash = new Object ( ) ;
2011-03-03 19:08:04 +00:00
monitorStatusHash [ 'xcatmon' ] = 'Not monitored' ;
monitorStatusHash [ 'rmcmon' ] = 'Not monitored' ;
monitorStatusHash [ 'rmcevent' ] = 'Not monitored' ;
monitorStatusHash [ 'gangliamon' ] = 'Not monitored' ;
if ( data . rsp [ 0 ] ) {
2011-01-12 10:43:45 +00:00
var tempArray = data . rsp [ 0 ] . split ( ';' ) ;
var position = 0 ;
var name = '' ;
var status = '' ;
2011-03-03 19:08:04 +00:00
for ( var i in tempArray ) {
2011-01-12 10:43:45 +00:00
position = tempArray [ i ] . indexOf ( ':' ) ;
2011-03-03 19:08:04 +00:00
if ( position == - 1 ) {
2011-01-12 10:43:45 +00:00
continue ;
}
2011-03-03 19:08:04 +00:00
2011-01-12 10:43:45 +00:00
name = tempArray [ i ] . substr ( 0 , position ) ;
status = tempArray [ i ] . substr ( position + 1 ) ;
monitorStatusHash [ name ] = status ;
}
2011-03-03 19:08:04 +00:00
}
var monitorTable = '<table><thead><tr><th>Monitor Tool</th><th>Status</th><th>Description</th></tr></thead>' ;
// xCAT monitor
2011-01-12 10:43:45 +00:00
monitorTable += '<tbody><tr><td><a href="#" name="xcatmon">xCAT Monitor</a></td>' ;
monitorTable += '<td>' + monitorStatusHash [ 'xcatmon' ] + '</td>' ;
monitorTable += '<td>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.</td></tr>' ;
2011-03-03 19:08:04 +00:00
// RMC monitor
2011-01-12 10:43:45 +00:00
monitorTable += '<tr><td><a href="#" name="rmcmon">RMC Monitor</a></td>' ;
monitorTable += '<td>' + monitorStatusHash [ 'rmcmon' ] + '</td>' ;
monitorTable += '<td>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.</td></tr>' ;
2011-03-03 19:08:04 +00:00
// RMC event
2011-01-12 10:43:45 +00:00
monitorTable += '<tr><td><a href="#" name="rmcevent">RMC Event</a></td>' ;
2011-03-03 19:08:04 +00:00
monitorTable += '<td>' + monitorStatusHash [ 'rmcevent' ] + '</td>' ;
2011-01-12 10:43:45 +00:00
monitorTable += '<td>Listing event monitoring information recorded by the RSCT Event Response resource manager in the audit log. Creating and removing a condition/response association.</td></tr>' ;
2011-03-03 19:08:04 +00:00
// Ganglia event
2011-01-12 10:43:45 +00:00
monitorTable += '<tr><td><a href="#" name="gangliamon">Ganglia Monitor</a></td>' ;
monitorTable += '<td>' + monitorStatusHash [ 'gangliamon' ] + '</td>' ;
monitorTable += '<td>A scalable distributed monitoring system for high-performance computing systems such as clusters and Grids.</td></tr>' ;
2011-03-03 19:08:04 +00:00
// PCP monitor
2011-01-12 10:43:45 +00:00
monitorTable += '<tr><td><a href="#" name="pcpmon">PCP Monitor</a></td>' ;
2011-03-03 19:08:04 +00:00
monitorTable += '<td>Not monitored</td>' ;
2011-01-12 10:43:45 +00:00
monitorTable += '<td>Under construction.</td></tr>' ;
monitorTable += '</tbody></table>' ;
2011-03-03 19:08:04 +00:00
// Append info bar
2011-01-12 10:43:45 +00:00
$ ( '#monitorTab div' ) . empty ( ) . append ( createInfoBar ( 'Select a monitoring tool to use.' ) ) ;
$ ( '#monitorTab .form' ) . append ( monitorTable ) ;
2011-03-03 19:08:04 +00:00
// Open monitoring tool onclick
2011-01-12 10:43:45 +00:00
$ ( '#monitorTab .form a' ) . bind ( 'click' , function ( ) {
loadMonitorTab ( $ ( this ) . attr ( 'name' ) ) ;
} ) ;
}
} ) ;
2011-03-03 19:08:04 +00:00
// Create resources tab
2010-09-11 13:06:07 +00:00
var resrcForm = $ ( '<div class="form"></div>' ) ;
2010-06-16 18:21:58 +00:00
// Create info bar
2010-12-04 15:42:49 +00:00
var resrcInfoBar = createInfoBar ( 'Select a platform to view its current resources.' ) ;
2010-06-16 18:21:58 +00:00
resrcForm . append ( resrcInfoBar ) ;
2010-07-15 23:22:13 +00:00
2010-08-03 14:16:24 +00:00
// Create radio buttons for platforms
2011-02-24 19:49:11 +00:00
var hwList = $ ( '<ol>Platforms available:</ol>' ) ;
var ipmi = $ ( '<li><input type="radio" name="hw" value="ipmi" checked/>iDataPlex</li>' ) ;
var blade = $ ( '<li><input type="radio" name="hw" value="blade"/>BladeCenter</li>' ) ;
var hmc = $ ( '<li><input type="radio" name="hw" value="hmc"/>System p</li>' ) ;
var zvm = $ ( '<li><input type="radio" name="hw" value="zvm"/>System z</li>' ) ;
2010-08-03 14:16:24 +00:00
hwList . append ( ipmi ) ;
hwList . append ( blade ) ;
hwList . append ( hmc ) ;
hwList . append ( zvm ) ;
resrcForm . append ( hwList ) ;
2010-11-05 22:53:47 +00:00
2010-06-16 18:21:58 +00:00
var okBtn = createButton ( 'Ok' ) ;
okBtn . bind ( 'click' , function ( event ) {
// Get hardware that was selected
2010-08-03 14:16:24 +00:00
var hw = $ ( this ) . parent ( ) . find ( 'input[name="hw"]:checked' ) . val ( ) ;
2010-06-16 18:21:58 +00:00
// Generate new tab ID
var newTabId = hw + 'ResourceTab' ;
if ( ! $ ( '#' + newTabId ) . length ) {
2011-03-03 19:08:04 +00:00
// Create loader
var loader = $ ( '<center></center>' ) . append ( createLoader ( hw + 'ResourceLoader' ) ) ;
2010-08-03 14:58:08 +00:00
tab . add ( newTabId , hw , loader , true ) ;
2010-06-16 18:21:58 +00:00
2010-07-22 19:56:09 +00:00
// Create an instance of the plugin
var plugin ;
2010-11-05 22:53:47 +00:00
switch ( hw ) {
2011-03-03 19:08:04 +00:00
case "blade" :
plugin = new bladePlugin ( ) ;
break ;
case "hmc" :
plugin = new hmcPlugin ( ) ;
break ;
case "ipmi" :
plugin = new ipmiPlugin ( ) ;
break ;
case "zvm" :
plugin = new zvmPlugin ( ) ;
break ;
2010-07-22 19:56:09 +00:00
}
2010-11-05 22:53:47 +00:00
2010-07-22 19:56:09 +00:00
plugin . loadResources ( ) ;
2010-06-16 18:21:58 +00:00
}
// Select tab
tab . select ( newTabId ) ;
} ) ;
2011-03-03 19:08:04 +00:00
2010-06-16 18:21:58 +00:00
resrcForm . append ( okBtn ) ;
2010-08-03 14:58:08 +00:00
tab . add ( 'resourceTab' , 'Resources' , resrcForm , false ) ;
2010-08-04 08:49:20 +00:00
}
2010-11-05 22:53:47 +00:00
/ * *
2011-03-03 19:08:04 +00:00
* Load monitoring tool in a new tab
2010-11-05 22:53:47 +00:00
*
2011-03-03 19:08:04 +00:00
* @ param name
2010-11-05 22:53:47 +00:00
* Name of monitoring tool
* @ return Nothing
* /
2011-03-03 19:08:04 +00:00
function loadMonitorTab ( name ) {
2010-10-08 03:03:42 +00:00
// If the tab exist, then we only need to select it
2010-08-04 08:49:20 +00:00
var tab = getMonitorTab ( ) ;
2011-03-03 19:08:04 +00:00
if ( $ ( "#" + name ) . length ) {
tab . select ( name ) ;
2010-08-04 08:49:20 +00:00
return ;
}
2010-11-05 22:53:47 +00:00
2011-03-03 19:08:04 +00:00
switch ( name ) {
case 'xcatmon' :
tab . add ( name , 'xCAT' , '' , true ) ;
loadXcatMon ( ) ;
break ;
case 'rmcmon' :
tab . add ( name , 'RMC Monitor' , '' , true ) ;
loadRmcMon ( ) ;
break ;
case 'gangliamon' :
tab . add ( name , 'Ganglia' , '' , true ) ;
loadGangliaMon ( ) ;
break ;
case 'rmcevent' :
tab . add ( name , 'RMC Event' , '' , true ) ;
loadRmcEvent ( ) ;
break ;
case 'pcpmon' :
loadUnfinish ( name , tab ) ;
break ;
2010-08-04 08:49:20 +00:00
}
2010-11-05 22:53:47 +00:00
2011-03-03 19:08:04 +00:00
tab . select ( name ) ;
2010-08-04 08:49:20 +00:00
}
2010-11-05 22:53:47 +00:00
/ * *
2011-03-03 19:08:04 +00:00
* Load tab showing 'Under contruction'
2010-11-05 22:53:47 +00:00
*
* @ param monitorName
* Name of monitoring tool
* @ param tab
* Tab area
* @ return Nothing
* /
function loadUnfinish ( monitorName , tab ) {
2010-08-04 08:49:20 +00:00
var unfinishPage = $ ( '<div></div>' ) ;
2010-11-05 22:53:47 +00:00
unfinishPage . append ( createInfoBar ( 'Under construction' ) ) ;
tab . add ( monitorName , 'Unfinish' , unfinishPage , true ) ;
2010-06-16 18:21:58 +00:00
}