new monitor style is introduced
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@4605 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
parent
cb8c94d359
commit
0e722a0e28
@ -0,0 +1,128 @@
|
||||
/*The css style for the new monlist web page*/
|
||||
.pluginstat
|
||||
{
|
||||
position: relative;
|
||||
width: 170px;
|
||||
height: 48px;
|
||||
float: left;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
.pluginstat .lef
|
||||
{
|
||||
padding: 8px 0px 8px 0px;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
position: relative;
|
||||
float: left;
|
||||
display: inline;
|
||||
}
|
||||
.pluginstat .mid
|
||||
{
|
||||
font-size: 1em;
|
||||
float: left;
|
||||
position: relative;
|
||||
display: block;
|
||||
color: black;
|
||||
}
|
||||
|
||||
.pluginstat .rig
|
||||
{
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
float: right;
|
||||
background-image: url("../img/monplugin.png");
|
||||
}
|
||||
|
||||
/*The list of monitor plugins*/
|
||||
#plist
|
||||
{
|
||||
float: left;
|
||||
width: 180px;
|
||||
padding-left: 15px;
|
||||
}
|
||||
|
||||
#settings
|
||||
{
|
||||
display: block;
|
||||
width: 725px;
|
||||
float: left;
|
||||
text-align: left;
|
||||
font-size: 1em;
|
||||
}
|
||||
|
||||
.fg-button {
|
||||
outline: 0;
|
||||
margin: 0 4px 0 0;
|
||||
padding: .4em 1em;
|
||||
text-decoration:none !important;
|
||||
cursor:pointer;
|
||||
position: relative;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.fg-buttonset {float: left;}
|
||||
.fg-buttonset-single .fg-button {margin-right: -3px}
|
||||
|
||||
#nrtree-input {
|
||||
float: left;
|
||||
width: 25%;
|
||||
min-width: 125px;
|
||||
min-height: 255px;
|
||||
border-right: 1px solid orange;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
#stat1 {
|
||||
padding-left: 10px;
|
||||
padding-right: 10px;
|
||||
width: 65%;
|
||||
float: right;
|
||||
}
|
||||
|
||||
fieldset {
|
||||
padding: 0 15px 3em;
|
||||
border: 0;
|
||||
}
|
||||
|
||||
.custom-radio { position: relative;}
|
||||
|
||||
/* input, label positioning */
|
||||
.custom-radio input {
|
||||
position: absolute;
|
||||
left: 2px;
|
||||
top: 3px;
|
||||
margin: 0;
|
||||
z-index: 0;
|
||||
}
|
||||
.custom-radio label {
|
||||
display: block;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
font-size: 1.3em;
|
||||
padding-right: 1em;
|
||||
line-height: 1;
|
||||
padding: .5em 0 .5em 30px;
|
||||
margin: 0 0 .3em;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.custom-radio label {background: url(../img/radiobutton.gif) no-repeat;}
|
||||
|
||||
.custom-radio label {
|
||||
background-position: -10px -14px;
|
||||
}
|
||||
|
||||
.custom-radio label.hover,
|
||||
.custom-radio label.focus {
|
||||
background-position: -10px -114px;
|
||||
}
|
||||
|
||||
.custom-radio label.checked {
|
||||
background-position: -10px -214px;
|
||||
}
|
||||
|
||||
.custom-radio label.focus {
|
||||
outline: 1px dotted #ccc;
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ LoadBar.prototype.loaded = function(file) {
|
||||
//load the reset button to try one more time!
|
||||
//$(document).ready(function () {
|
||||
injs();
|
||||
document.getElementById("wrapper").style.display = "none";
|
||||
//document.getElementById("wrapper").style.display = "none";
|
||||
//});
|
||||
}
|
||||
};
|
||||
@ -105,7 +105,8 @@ var xStart = function(){
|
||||
myBar.addScript("jquery.tablesorter.js");
|
||||
myBar.addScript("jquery.flot.js");
|
||||
myBar.addScript("excanvas.js");
|
||||
myBar.addScript("noderangetree.js");
|
||||
myBar.addScript("noderangetree.js");
|
||||
myBar.addScript("monitor.js");
|
||||
myBar.addScript("xcat.js");
|
||||
myBar.addScript("xcatauth.js");
|
||||
myBar.addScript("config.js");
|
||||
|
134
xCAT-UI/js/monitor.js
Normal file
134
xCAT-UI/js/monitor.js
Normal file
@ -0,0 +1,134 @@
|
||||
|
||||
|
||||
jQuery.fn.customInput = function(){//from http://www.filamentgroup.com/examples/customInput/customInput.jquery.js
|
||||
$(this).each(function(i){
|
||||
if($(this).is('[type=checkbox],[type=radio]')){
|
||||
var input = $(this);
|
||||
|
||||
// get the associated label using the input's id
|
||||
var label = $('label[for='+input.attr('id')+']');
|
||||
|
||||
//get type, for classname suffix
|
||||
var inputType = (input.is('[type=checkbox]')) ? 'checkbox' : 'radio';
|
||||
|
||||
// wrap the input + label in a div
|
||||
$('<div class="custom-'+ inputType +'"></div>').insertBefore(input).append(input, label);
|
||||
|
||||
// find all inputs in this set using the shared name attribute
|
||||
var allInputs = $('input[name='+input.attr('name')+']');
|
||||
|
||||
// necessary for browsers that don't support the :hover pseudo class on labels
|
||||
label.hover(
|
||||
function(){
|
||||
$(this).addClass('hover');
|
||||
if(inputType == 'checkbox' && input.is(':checked')){
|
||||
$(this).addClass('checkedHover');
|
||||
}
|
||||
},
|
||||
function(){ $(this).removeClass('hover checkedHover'); }
|
||||
);
|
||||
|
||||
//bind custom event, trigger it, bind click,focus,blur events
|
||||
input.bind('updateState', function(){
|
||||
if (input.is(':checked')) {
|
||||
if (input.is(':radio')) {
|
||||
allInputs.each(function(){
|
||||
$('label[for='+$(this).attr('id')+']').removeClass('checked');
|
||||
});
|
||||
};
|
||||
label.addClass('checked');
|
||||
}
|
||||
else { label.removeClass('checked checkedHover checkedFocus'); }
|
||||
|
||||
})
|
||||
.trigger('updateState')
|
||||
.click(function(){
|
||||
$(this).trigger('updateState');
|
||||
})
|
||||
.focus(function(){
|
||||
label.addClass('focus');
|
||||
if(inputType == 'checkbox' && input.is(':checked')){
|
||||
$(this).addClass('checkedFocus');
|
||||
}
|
||||
})
|
||||
.blur(function(){ label.removeClass('focus checkedFocus'); });
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
function monPluginSetStat()
|
||||
{
|
||||
$('.fg-button:not(.ui-state-disabled)')
|
||||
.hover(
|
||||
function() {
|
||||
$(this).addClass('ui-state-hover');
|
||||
},
|
||||
function() {
|
||||
$(this).removeClass('ui-state-hover');
|
||||
}
|
||||
)
|
||||
.click(
|
||||
function() {
|
||||
// if($(this).hasClass("ui-state-active")) {
|
||||
var plugin=$('.pluginstat.ui-state-active').attr('id');
|
||||
var todo = $(this).html();
|
||||
//$("#settings").tabs('select',2);
|
||||
//for the noderange, we have to check the <div> with id "nrtree-input", and also the 'custom-nr' textarea
|
||||
var value = "";
|
||||
//we check the textarea firstly,
|
||||
value = $("#custom-nr").val();
|
||||
//then, if the textarea is empty, we have to get the selection from nrtree
|
||||
if(!value) {
|
||||
var i=0;
|
||||
var node_selected = nrtree.selected_arr;
|
||||
for(; i< node_selected.length; i++) {
|
||||
value += node_selected[i].attr('id');
|
||||
}
|
||||
//remove the "," at the front
|
||||
value = value.substr(1);
|
||||
}
|
||||
//get the value for "node status monitoring"
|
||||
|
||||
//$("#feedback").html(value); //used for debug
|
||||
if(value == "") {value="all";}
|
||||
$.post("monitor/setup.php",{name:plugin,action:todo,nm:$("#stat1 form fieldset input:checked").attr('value'),nr:value},function(data) {
|
||||
if(data=='successful') {
|
||||
//update the status of the selected plugin
|
||||
//reload the tabs for enable/disable
|
||||
var tmp = $("#"+plugin).children();
|
||||
$.get("monitor/options.php",{name:plugin,opt:"status"},function(stat){
|
||||
if(stat == "Disabled") {
|
||||
$(tmp[1]).html(plugin+"<br>"+stat);
|
||||
$(tmp[0].firstChild).removeClass("ui-icon-circle-check").addClass("ui-icon-circle-close");
|
||||
$("#settings").tabs('url',3,'monitor/options.php?name='+plugin+'&opt=enable').tabs("load",3);
|
||||
}else {
|
||||
$(tmp[1]).html(plugin+"<br>"+stat);
|
||||
$(tmp[0].firstChild).removeClass("ui-icon-circle-close").addClass("ui-icon-circle-check");
|
||||
$("#settings").tabs('url',3,'monitor/options.php?name='+plugin+'&opt=disable').tabs("load",3);
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
}
|
||||
// }
|
||||
);
|
||||
}
|
||||
|
||||
function nodemonSetStat()
|
||||
{
|
||||
//enable/disable buttons for setting of the Node monitoring status
|
||||
$("#nodemonset .fg-buttonset .fg-button").hover(function() {
|
||||
$(this).addClass("ui-state-hover");
|
||||
},function() {
|
||||
$(this).removeClass("ui-state-hover");
|
||||
}).click(function(){
|
||||
//TODO
|
||||
});
|
||||
}
|
||||
function appmonSetStat()
|
||||
{
|
||||
//TODO
|
||||
}
|
||||
|
||||
// for the progress bar
|
||||
myBar.loaded('monitor.js');
|
@ -384,30 +384,6 @@ function init_rmc_ositree() {
|
||||
});
|
||||
}
|
||||
|
||||
//node_stat_control() can enable/disable nodestatmon for the selected plugin
|
||||
function node_stat_control(plugin)
|
||||
{
|
||||
//get the label of the button
|
||||
var action = $("#node_stat span").text();
|
||||
if(action=='Enable') {
|
||||
//enable node_stat_monitor
|
||||
$.get("monitor/control_node_stat.php",{name:plugin, action:"enable"},function(data) {
|
||||
if(data=='successful') {
|
||||
//change the label to "Disable"
|
||||
$("#node_stat span").text("Disable");
|
||||
}
|
||||
});
|
||||
}else if(action=='Disable') {
|
||||
//disable node_stat_monitor
|
||||
$.get("monitor/control_node_stat.php",{name:plugin, action:"disable"},function(data) {
|
||||
if(data=='successful') {
|
||||
//change the label to "enable"
|
||||
$("#node_stat span").text("Enable");
|
||||
}
|
||||
})
|
||||
//then, change the label to "Enable""
|
||||
}
|
||||
}
|
||||
|
||||
function goto_next()
|
||||
//TODO: change the function name! it's too silly now!
|
||||
@ -476,37 +452,6 @@ function showRMCAttrib()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function showPluginOptions()
|
||||
{
|
||||
//for monlist.php, when the user clicks the radiobox, the available options for the plugin will display
|
||||
$("input[@name=plugins]").click(function() {
|
||||
//when one radiobox is selected, the #options <div> is show available options to the user
|
||||
//at first, hide the <div> named with "#plugin_desc"
|
||||
if($("#plugin_desc").css("display") == "block") {
|
||||
$("#plugin_desc").hide("slow");
|
||||
}
|
||||
var plugin = $(this).attr('value');
|
||||
$.get("monitor/options.php", {name:plugin},function(data) {
|
||||
$("#options").html(data);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//TODO: remove it
|
||||
function showPluginDescription()
|
||||
{
|
||||
$(".description").click(function(){
|
||||
if($("#plugin_desc").css("display") == "none") {
|
||||
$("#plugin_desc").show();
|
||||
}
|
||||
$.get("monitor/plugin_desc.php", {name: $(this).text()}, function(data){
|
||||
$("#plugin_desc").html(data);
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
//TODO: when mouse hover the list of monitor plugins, the .ListLine_hover style will
|
||||
//be applied on the <tr>,
|
||||
function hoverOnMonlist()
|
||||
|
@ -59,7 +59,7 @@ function openDialog(){
|
||||
background: "#2e2e2e url(img/auth.gif) repeat",
|
||||
opacity: 1.0
|
||||
},
|
||||
height: 250,
|
||||
height: 275,
|
||||
width: 350,
|
||||
autoOpen: true,
|
||||
buttons: {
|
||||
|
@ -544,6 +544,7 @@ echo <<<EOS
|
||||
<li>Monitor Events/Performances by Plugins, such as RMC...</li>
|
||||
<li>This is still <b>UNDER DEVELOPMENT</b>.</li>
|
||||
</ul>
|
||||
<h1><a href='#' onclick='loadMainPage("monitor/newmonlist.php")'>New_style Monitor</a></h1>
|
||||
</div>
|
||||
EOS;
|
||||
}
|
||||
|
@ -100,52 +100,6 @@ TOS9;
|
||||
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 '<div style="margin-right: 50px; width:auto; margin-left: 50px">';
|
||||
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 "<h3>Node/Application Status Monitoring for $name</h3>";
|
||||
echo <<<TOS2
|
||||
<table cellspacing="1" class="tabTable" id="tabTable"><tbody>
|
||||
<tr class="ListLine0">
|
||||
<td>Node Status Monitoring</td>
|
||||
<td>
|
||||
TOS2;
|
||||
insertButtons(array('label'=>$ns_tobe, 'id'=>'node_stat', 'onclick'=>"node_stat_control(\"$name\")"));
|
||||
//TODO: change the function name of node_stat_control
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
echo '<tr class="ListLine1">';
|
||||
echo '<td>Application Status Monitoring</td>';
|
||||
echo '<td>';
|
||||
insertButtons(array('label'=>$as_tobe, 'id'=>'app_stat', 'onclick'=>'show_monshow_data()'));
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
echo '</tbody> </table> </div>';
|
||||
}
|
||||
|
||||
function displayStatus()
|
||||
{
|
||||
@ -532,40 +486,41 @@ TOS1;
|
||||
echo "</tbody></table></div>";
|
||||
}
|
||||
|
||||
/*
|
||||
* function displayNodeAppStatus($name)
|
||||
* ************************************
|
||||
* to display the web page "Node/Application Status Monitoring"
|
||||
*
|
||||
/*displayMList() will display the list of monitor plugins
|
||||
* For the new style monitor list
|
||||
*/
|
||||
function displayNodeAppStatus($name)
|
||||
function displayMList()
|
||||
{
|
||||
displayMapper(array('home'=>'main.php', 'monitor'=>'monitor/monlist.php', 'Node Status Setup'=> ''));
|
||||
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 "<p class=Error>",implode(' ',$errors), "</p>";
|
||||
$xml = docmd("monls", "", array('-a'));
|
||||
if(getXmlErrors($xml, $errors)) {
|
||||
echo "<p class=Error>", implode(' ', $errors), "</p>";
|
||||
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";
|
||||
}
|
||||
|
||||
foreach($xml->children() as $response) foreach ($response->children() as $data) {
|
||||
list($name, $stat, $nodemon) = preg_split("/\s+/", $data);
|
||||
//create .pluginstat class for each plugin
|
||||
echo "<div class='pluginstat ui-corner-all' id=$name>";
|
||||
//TODO: I have to make it beautiful
|
||||
createPluginStatElem($name, $stat, $nodemon);
|
||||
echo "</div>";
|
||||
echo "<span class='ui-icon ui-icon-grip-dotted-horizontal'></span>";
|
||||
}
|
||||
|
||||
display_stat_mon_table(array("$name"=>
|
||||
array(
|
||||
'nodestat'=>$ns,
|
||||
'appstat'=>'Disabled', //currently application status monitoring is not supported by xCAT monitor Arch.
|
||||
)));
|
||||
return 0;
|
||||
}
|
||||
|
||||
function createPluginStatElem($name, $stat, $nodemon)
|
||||
{
|
||||
if($nodemon) {
|
||||
echo "<div class='lef'><span class='ui-icon ui-icon-circle-check'></span></div>";
|
||||
echo "<div class='mid'>$name<br/>Enabled</div>";
|
||||
}else {
|
||||
echo "<div class='lef'><span class='ui-icon ui-icon-circle-close'></span></div>";
|
||||
echo "<div class='mid ftsz'>$name<br />Disabled</div>";
|
||||
}
|
||||
echo "<div class='rig'></div>";
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
@ -1,38 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* Enable/Disable node_stat_monitor feature for the desired plug-in
|
||||
* this file is invoked by the file "stat_mon.php"
|
||||
* update the table "monitoring",
|
||||
*/
|
||||
if(!isset($TOPDIR)) { $TOPDIR="..";}
|
||||
|
||||
require_once "$TOPDIR/lib/security.php";
|
||||
require_once "$TOPDIR/lib/functions.php";
|
||||
require_once "$TOPDIR/lib/display.php";
|
||||
require_once "$TOPDIR/lib/monitor_display.php";
|
||||
|
||||
$name = $_REQUEST['name'];
|
||||
$action = $_REQUEST['action'];
|
||||
|
||||
//TODO:
|
||||
//right now, we can only go through "webrun" command to run the local command through xcatd
|
||||
//specially for enable/disable node status monitoring, what I can do is to edit the table "monitoring"
|
||||
//This method is not suitable!
|
||||
if($action == 'enable') {
|
||||
//chtab name=$name monitoring.nodestatmon='yes'
|
||||
$xml=docmd("webrun",'',array("chtab name=$name monitoring.nodestatmon=1"));
|
||||
if(getXmlErrors($xml, $errors)) {
|
||||
echo "<p class=Error>",implode(' ', $errors), "</p>";
|
||||
exit;
|
||||
}
|
||||
}else if($action == 'disable') {
|
||||
//chtab name=$name monitoring.nodestatmon=''
|
||||
$xml=docmd("webrun",'', array("chtab name=$name monitoring.nodestatmon=no"));
|
||||
if(getXmlErrors($xml,$errors)) {
|
||||
echo "<p class=Error>",implode(' ', $errors), "</p>";
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
echo "successful";
|
||||
?>
|
@ -1,22 +1,83 @@
|
||||
<?php
|
||||
if(!isset($TOPDIR)) { $TOPDIR="..";}
|
||||
require_once "$TOPDIR/lib/security.php";
|
||||
require_once "$TOPDIR/lib/functions.php";
|
||||
require_once "$TOPDIR/lib/display.php";
|
||||
require_once "$TOPDIR/lib/monitor_display.php";
|
||||
require_once "$TOPDIR/lib/security.php";
|
||||
require_once "$TOPDIR/lib/functions.php";
|
||||
require_once "$TOPDIR/lib/display.php";
|
||||
require_once "$TOPDIR/lib/monitor_display.php";
|
||||
|
||||
displayMapper(array('home'=>'main.php', 'monitor' =>''));
|
||||
displayMapper(array('home'=>'main.php', 'new_monitor' =>''));
|
||||
|
||||
displayTips(array("Click the name of each plugin, you can get the plugin's description.",
|
||||
"Select one plugin, choose the options for set up monitoring ",
|
||||
"Click the button <b>\"Start\", \"Stop\" or \"Restart\"</b> to setup monitoring plugin"));
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
$(".pluginstat:first").toggleClass("ui-state-active");
|
||||
$(".pluginstat").hover(
|
||||
function() {
|
||||
$(this).addClass("ui-state-hover");
|
||||
},
|
||||
function() {
|
||||
$(this).removeClass("ui-state-hover");
|
||||
}
|
||||
);
|
||||
$(".pluginstat").click(function(){
|
||||
//TODO: only one plugin is allowedto be in active state
|
||||
//There will be always only one div in active status
|
||||
if($(this).hasClass('ui-state-active')==false) {
|
||||
//find another div in active state, toggle it
|
||||
|
||||
//TODO: change the view style;
|
||||
//Change all the "Actions/Description/Configurations/Views" to Tabs
|
||||
//And, list all the monitoring plugins under the tree? Not sure now.
|
||||
displayMonTable();
|
||||
$(".pluginstat.ui-state-active").toggleClass("ui-state-active");
|
||||
$(this).toggleClass("ui-state-active");
|
||||
//then, update the contents in the "#settings" tab
|
||||
var selected = $("#settings").tabs('option','selected');
|
||||
var name = $(this).attr('id');
|
||||
var options = ["desc","conf","view",["enable","disable"]];
|
||||
if(selected != 3) {
|
||||
$("#settings").tabs('url',selected,"monitor/options.php?name="+name+"&opt="+options[selected]);
|
||||
}else {
|
||||
//to handle enable/disable
|
||||
var str = $(".ui-state-active .mid").html();
|
||||
if(str.match("Enabled")==null) {
|
||||
//the plugin is in "disabled" state, we need to enable it
|
||||
$("#settings").tabs('url',3,"monitor/options.php?name="+name+"&opt="+options[3][0]);
|
||||
}else {
|
||||
$("#settings").tabs('url',3,"monitor/options.php?name="+name+"&opt="+options[3][1]);
|
||||
}
|
||||
}
|
||||
$("#settings").tabs('load',selected);
|
||||
}
|
||||
});
|
||||
|
||||
insertDiv("options");
|
||||
$("#settings").tabs({selected:-1});
|
||||
$("#settings").tabs('option','ajaxOptions',{async:false});
|
||||
$("#settings").bind('tabsselect', function(event, ui) {
|
||||
var name=$('.ui-state-active').attr('id');
|
||||
var options = ["desc","conf","view",["enable","disable"]];
|
||||
var i;
|
||||
for(i=0; i<options.length-1; i++) {
|
||||
$("#settings").tabs("url", i, "monitor/options.php?name="+name+"&opt="+options[i]);
|
||||
}
|
||||
//to handle enable/disable
|
||||
var str = $(".ui-state-active .mid").html();
|
||||
if(str.match("Enabled")==null) {
|
||||
//the plugin is in "disabled" state, we need to enable it
|
||||
$("#settings").tabs('url',3,"monitor/options.php?name="+name+"&opt="+options[3][0]);
|
||||
}else {
|
||||
$("#settings").tabs('url',3,"monitor/options.php?name="+name+"&opt="+options[3][1]);
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
?>
|
||||
<div id="plist" class="ui-state-default ui-corner-all">
|
||||
<?php displayMList(); ?>
|
||||
</div>
|
||||
<div id="settings">
|
||||
<ul>
|
||||
<li><a href="monitor/options.php">Description</a></li>
|
||||
<li><a href="monitor/options.php">Configuration</a></li>
|
||||
<li><a href="monitor/options.php">View</a></li>
|
||||
<li><a href="monitor/options.php">Enable/Disable</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div id="feedback"></div>
|
||||
|
22
xCAT-UI/monitor/oldmonlist.php
Normal file
22
xCAT-UI/monitor/oldmonlist.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
if(!isset($TOPDIR)) { $TOPDIR="..";}
|
||||
require_once "$TOPDIR/lib/security.php";
|
||||
require_once "$TOPDIR/lib/functions.php";
|
||||
require_once "$TOPDIR/lib/display.php";
|
||||
require_once "$TOPDIR/lib/monitor_display.php";
|
||||
|
||||
displayMapper(array('home'=>'main.php', 'monitor' =>''));
|
||||
|
||||
displayTips(array("Click the name of each plugin, you can get the plugin's description.",
|
||||
"Select one plugin, choose the options for set up monitoring ",
|
||||
"Click the button <b>\"Start\", \"Stop\" or \"Restart\"</b> to setup monitoring plugin"));
|
||||
|
||||
|
||||
//TODO: change the view style;
|
||||
//Change all the "Actions/Description/Configurations/Views" to Tabs
|
||||
//And, list all the monitoring plugins under the tree? Not sure now.
|
||||
displayMonTable();
|
||||
|
||||
insertDiv("options");
|
||||
|
||||
?>
|
@ -8,8 +8,214 @@ require_once "$TOPDIR/lib/display.php";
|
||||
require_once "$TOPDIR/lib/monitor_display.php";
|
||||
|
||||
$name = $_REQUEST['name'];
|
||||
|
||||
$option = $_REQUEST['opt'];
|
||||
//display the "configure" and "view" options for the desired monitoring plugin
|
||||
displayOptionsForPlugin($name);
|
||||
|
||||
//displayOptionsForPlugin($name);
|
||||
|
||||
switch ($option) {
|
||||
case "status":
|
||||
//return the status of the plugin with "$name" as name
|
||||
updatePluginStat($name);
|
||||
break;
|
||||
case "enable":
|
||||
case "disable":
|
||||
//enable/disable the plugin
|
||||
//show all the node/range in the cluster
|
||||
//and also provide one textarea to allow the user to type
|
||||
showNRTreeInput();
|
||||
showPluginStat($name, $option);
|
||||
break;
|
||||
case "conf":
|
||||
//show all the options for configuration
|
||||
showPluginConf($name);
|
||||
break;
|
||||
case "view":
|
||||
//show all the options for view
|
||||
showPluginView($name);
|
||||
break;
|
||||
case "desc":
|
||||
//show all the description of the plugin
|
||||
default:
|
||||
showPluginDesc($name);
|
||||
break;
|
||||
}
|
||||
|
||||
function showPluginConf($name)
|
||||
{
|
||||
//TODO
|
||||
//echo <<<TOS11
|
||||
// <div class="ui-state-highlight ui-corner-all">
|
||||
// <p>All the options for configuration are here.</p>
|
||||
// <p>choose the options to update them</p>
|
||||
// </div>
|
||||
// <span class="ui-icon ui-icon-grip-dotted-horizontal"></span>
|
||||
//TOS11;
|
||||
echo "<div id=accordion>";
|
||||
echo <<<TOS10
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
$("#accordion").accordion({autoHeight: false});
|
||||
});
|
||||
</script>
|
||||
<h3><a href='#'>Application Monitor Setting</a></h3>
|
||||
<div id="appmonset">
|
||||
<div class="ui-state-highlight ui-corner-all">
|
||||
<span class='ui-icon ui-icon-alert' />The configuration for application status monitoring
|
||||
has not been implemented; We will consider it later!
|
||||
</div>
|
||||
</div>
|
||||
<h3><a href='#'>The monsetting table Setting</a></h3>
|
||||
<div id="monsettingtabset">
|
||||
<div class="ui-state-highlight ui-corner-all">
|
||||
<p>Press the following buttons to enable/disable the settings</p>
|
||||
<p>In order to make it effect, turn to the "Enable/Disable" tab for the plugin</p>
|
||||
</div>
|
||||
</div>
|
||||
TOS10;
|
||||
echo "</div>";
|
||||
}
|
||||
|
||||
function showPluginView($name)
|
||||
{
|
||||
//TODO
|
||||
}
|
||||
|
||||
function updatePluginStat($name)
|
||||
{
|
||||
$xml = docmd("monls", "", array("$name"));
|
||||
foreach($xml->children() as $response) foreach($response->children() as $data) {
|
||||
$result = preg_split("/\s+/", $data);
|
||||
if($result[0] == $name && $result[1] == "not-monitored") {
|
||||
echo "Disabled";
|
||||
}else {
|
||||
echo "Enabled";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function showPluginDesc($name)
|
||||
{
|
||||
//TODO: many "return" keys are missed in the response.
|
||||
//We have to figure them out
|
||||
$xml = docmd("monls"," ", array("$name", "-d"));
|
||||
if (getXmlErrors($xml, $errors)) {
|
||||
echo "<p class=Error>monls failed: ", implode(' ',$errors), "</p>\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
$information = "";
|
||||
foreach ($xml->children() as $response) foreach ($response->children() as $data) {
|
||||
$information .="<p>$data</p>";
|
||||
}
|
||||
echo $information;
|
||||
}
|
||||
|
||||
/*
|
||||
* changePluginStat($name)
|
||||
* which is used to enable/disable the selected plugin,
|
||||
* and which return whether they're sucessful or not
|
||||
*/
|
||||
function showPluginStat($name, $opt)
|
||||
{
|
||||
//display the nrtree here
|
||||
//let the user choose node/noderange to enable/disable monitor plugin
|
||||
echo "<div id=stat1>";
|
||||
echo "<div class='ui-state-highlight ui-corner-all'>";
|
||||
echo <<<TOS1
|
||||
<script type="text/javascript">
|
||||
monPluginSetStat();
|
||||
$('input').customInput();
|
||||
</script>
|
||||
TOS1;
|
||||
if($opt == 'enable') {
|
||||
//monadd: xcatmon has special options
|
||||
//moncfg <plugin> <nr>
|
||||
//"moncfg rmcmon <nr> -r" is necessary for rmcmon
|
||||
//monstart
|
||||
echo "<p>The $name Plugin is in Disabled status</p>";
|
||||
echo "<p>You can Press the Following button to change its status</p>";
|
||||
echo "<p>Select the noderange from the right tree</p>";
|
||||
echo "<p>OR: you can type the noderange in the following area</p>";
|
||||
echo "</div>";
|
||||
|
||||
insertNRTextEntry();
|
||||
echo "<p>When you are trying to enable the plugin</p><p>would you like to support node status monitoring?</p>";
|
||||
insertRadioBtn();
|
||||
insertButtonSet("Enable","Disable", 0);
|
||||
}else if($opt == 'disable') {
|
||||
//monstop
|
||||
//mondecfg
|
||||
echo "<p>The $name Plugin is in Enabled status</p>";
|
||||
echo "<p>You can Press the Following button to change its status</p>";
|
||||
echo "<p>Select the noderange from the right tree</p>";
|
||||
echo "<p>OR: you can type the noderange in the following area</p>";
|
||||
echo "</div>";
|
||||
insertNRTextEntry();
|
||||
echo "<p>When you are trying to enable the plugin</p><p>would you like to support node status monitoring?</p>";
|
||||
insertRadioBtn();
|
||||
insertButtonSet("Enable","Disable", 1);
|
||||
}
|
||||
echo "</div>";
|
||||
}
|
||||
|
||||
function insertRadioBtn()
|
||||
{
|
||||
//to provide the choose to support "-n"(node status monitoring)
|
||||
echo <<<TOS21
|
||||
<form>
|
||||
<fieldset>
|
||||
<input type="radio" name="options" id="radio-1" value="yes" />
|
||||
<label for="radio-1">support node status monitor</label>
|
||||
<input type="radio" name="options" id="radio-2" value="no" />
|
||||
<label for="radio-2">Not support node status monitor</label>
|
||||
</fieldset>
|
||||
</form>
|
||||
TOS21;
|
||||
}
|
||||
|
||||
function insertNRTextEntry()
|
||||
{
|
||||
echo "<textarea id='custom-nr' class='ui-corner-all' style='width:100%'>";
|
||||
echo "</textarea>";
|
||||
}
|
||||
|
||||
function insertButtonSet($state1, $state2, $default)
|
||||
{
|
||||
echo "<span class='ui-icon ui-icon-grip-solid-horizontal'></span>";
|
||||
echo "<div class='fg-buttonset fg-buttonset-single'>";
|
||||
if($default == 0) {
|
||||
echo "<button class='fg-button ui-state-default ui-state-active ui-priority-primary ui-corner-left'>Enable</button>";
|
||||
echo "<button class='fg-button ui-state-default ui-corner-right'>Disable</button>";
|
||||
}else {
|
||||
echo "<button class='fg-button ui-state-default ui-corner-left'>Enable</button>";
|
||||
echo "<button class='fg-button ui-state-default ui-state-active ui-priority-primary ui-corner-right'>Disable</button>";
|
||||
}
|
||||
echo "</div>";
|
||||
}
|
||||
|
||||
function showNRTreeInput()
|
||||
{
|
||||
echo "<div id=nrtree-input class='ui-state-default ui-corner-all'>";
|
||||
echo <<<TOS3
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
nrtree = new tree_component(); // -Tree begin
|
||||
nrtree.init($("#nrtree-input"),{
|
||||
rules: { multiple: "Ctrl" },
|
||||
ui: { animation: 250 },
|
||||
callback : { onchange : printtree },
|
||||
data : {
|
||||
type : "json",
|
||||
async : "true",
|
||||
url: "noderangesource.php"
|
||||
}
|
||||
}); //Tree finish
|
||||
});
|
||||
</script>
|
||||
TOS3;
|
||||
echo "</div>";
|
||||
}
|
||||
|
||||
?>
|
||||
|
@ -1,31 +0,0 @@
|
||||
<?php
|
||||
if(!isset($TOPDIR)) { $TOPDIR="..";}
|
||||
require_once "$TOPDIR/lib/security.php";
|
||||
require_once "$TOPDIR/lib/functions.php";
|
||||
require_once "$TOPDIR/lib/display.php";
|
||||
|
||||
/*
|
||||
* Run the command "monls $name -d",
|
||||
* return the information
|
||||
*/
|
||||
# get the _REQUEST['name'] arguments
|
||||
$name=$_REQUEST['name'];
|
||||
$xml = docmd("monls"," ", array("$name", "-d"));
|
||||
|
||||
if (getXmlErrors($xml, $errors)) {
|
||||
echo "<p class=Error>monls failed: ", implode(' ',$errors), "</p>\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
$information = "";
|
||||
|
||||
foreach ($xml->children() as $response) foreach ($response->children() as $data) {
|
||||
$information .= str_replace("\n", "<br />", $data);;
|
||||
$information .= "\n<br/>";
|
||||
//print_r($data);
|
||||
}
|
||||
echo "<p>";
|
||||
echo $information;
|
||||
echo "</p>";
|
||||
?>
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
/*
|
||||
* setup.php
|
||||
* perform the "monstart", "monadd" and "monstop" actions for selected monitoring plugins
|
||||
* to perform the "monstart" and "monstop" actions for the monitoring plugins
|
||||
*/
|
||||
|
||||
if(!isset($TOPDIR)) { $TOPDIR="..";}
|
||||
@ -14,82 +14,119 @@ require_once "$TOPDIR/lib/monitor_display.php";
|
||||
|
||||
$name = $_REQUEST['name'];
|
||||
$action = $_REQUEST['action'];
|
||||
//read the "monitoring" table to see whether node status monitoring is enable or not
|
||||
//$xml = docmd("webrun", "", array("gettab name=$name monitoring.nodestatmon"));
|
||||
//if(getXmlErrors($xml, $errors)) {
|
||||
// echo "<p class=Error>",implode(' ', $errors), "</p>";
|
||||
// exit;
|
||||
//}
|
||||
//
|
||||
//foreach($xml->children() as $response) foreach($response->children() as $data)
|
||||
//{
|
||||
// $nodemonstat = $data;
|
||||
//}
|
||||
switch($action) {
|
||||
case "stop":
|
||||
monstop($name);
|
||||
break;
|
||||
case "restart":
|
||||
monrestart($name);
|
||||
break;
|
||||
case "start":
|
||||
monstart($name);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
$nm = $_REQUEST['nm'];//node status monitoring: yes or no
|
||||
$noderange = $_REQUEST['nr'];
|
||||
|
||||
function monstop($plugin)
|
||||
{
|
||||
$xml = docmd("monstop", "", array("$plugin","-r"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
function monrestart($plugin)
|
||||
{
|
||||
$xml = docmd("monstop", "", array("$plugin", "-r"));
|
||||
if($action == "Disable") {
|
||||
//FIXIT: it seems rmcmon has sth wrong with monstop
|
||||
//The var $noderange can't work
|
||||
$xml = docmd("monstop", " ", array("$name", "$noderange" , "-r"));
|
||||
if(getXmlErrors($xml, $errors)) {
|
||||
echo "<p class=Error>",implode(' ', $errors), "</p>";
|
||||
exit;
|
||||
}
|
||||
$xml = docmd("moncfg", "", array("$plugin", "-r"));
|
||||
$xml = docmd("mondecfg", " ", array("$name", "$noderange"));
|
||||
if(getXmlErrors($xml, $errors)) {
|
||||
echo "<p class=Error>",implode(' ', $errors), "</p>";
|
||||
echo "<p class=Error>", implode(' ', $errors), "</p>";
|
||||
exit;
|
||||
}
|
||||
|
||||
$xml = docmd("monstart", "", array("$plugin", "-r"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
function monstart($plugin)
|
||||
{
|
||||
//Before running "monstart", the command "monls" is used to check
|
||||
$xml = docmd("monls","", NULL);
|
||||
echo "successful";
|
||||
}else if($action == "Enable") {
|
||||
//at first, check "-n"
|
||||
if($nm == "yes") {
|
||||
$xml=docmd("monrm", "", array("$name"));
|
||||
$xml = docmd("monadd", "", array("$name", "-n"));
|
||||
} else if($nm == "no") {
|
||||
$xml = docmd("monrm", "", array("$name"));
|
||||
$xml = docmd("monadd", "", array("$name"));
|
||||
}
|
||||
//then, moncfg
|
||||
$xml = docmd("moncfg", " ", array("$name", "$noderange"));
|
||||
if(getXmlErrors($xml, $errors)) {
|
||||
echo "<p class=Error>",implode(' ', $errors), "</p>";
|
||||
echo "<p class=Error>", implode(' ', $errors), "</p>";
|
||||
exit;
|
||||
}
|
||||
$has_plugin = false;
|
||||
if(count($xml->children()) != 0) {
|
||||
foreach($xml->children() as $response) foreach($response->children() as $data) {
|
||||
$arr = preg_split("/\s+/", $data);
|
||||
if($arr[0] == $plugin) {
|
||||
$has_plugin = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if($has_plugin == false) {
|
||||
//if $has_plugin == false, that means the plugin is not added into the monitoring table
|
||||
$xml = docmd("monadd",'', array("$plugin"));
|
||||
//special case for rmcmon
|
||||
if($name == "rmcmon") {
|
||||
$xml = docmd("moncfg", " ", array("$name", "$noderange", "-r"));
|
||||
if(getXmlErrors($xml, $errors)) {
|
||||
echo "<p class=Error>",implode(' ', $errors), "</p>";
|
||||
echo "<p class=Error>", implode(' ', $errors), "</p>";
|
||||
exit;
|
||||
}
|
||||
}
|
||||
//we have to make sure that the plugin is added in the "monitoring" table
|
||||
$xml = docmd("monstart", "", array("$plugin", "-r"));
|
||||
return 0;
|
||||
$xml = docmd("monstart", " ", array("$name", "$noderange", "-r"));
|
||||
if(getXmlErrors($xml, $errors)) {
|
||||
echo "<p class=Error>", implode(' ', $errors), "</p>";
|
||||
exit;
|
||||
}
|
||||
echo "successful";
|
||||
}
|
||||
|
||||
?>
|
||||
//switch($action) {
|
||||
// case "stop":
|
||||
// monstop($name);
|
||||
// break;
|
||||
// case "restart":
|
||||
// monrestart($name);
|
||||
// break;
|
||||
// case "start":
|
||||
// monstart($name);
|
||||
// break;
|
||||
// default:
|
||||
// break;
|
||||
//}
|
||||
//
|
||||
//function monstop($plugin)
|
||||
//{
|
||||
// $xml = docmd("monstop", "", array("$plugin","-r"));
|
||||
// return 0;
|
||||
//}
|
||||
//
|
||||
//function monrestart($plugin)
|
||||
//{
|
||||
// $xml = docmd("monstop", "", array("$plugin", "-r"));
|
||||
// if(getXmlErrors($xml, $errors)) {
|
||||
// echo "<p class=Error>",implode(' ', $errors), "</p>";
|
||||
// exit;
|
||||
// }
|
||||
// $xml = docmd("moncfg", "", array("$plugin", "-r"));
|
||||
// if(getXmlErrors($xml, $errors)) {
|
||||
// echo "<p class=Error>",implode(' ', $errors), "</p>";
|
||||
// exit;
|
||||
// }
|
||||
//
|
||||
// $xml = docmd("monstart", "", array("$plugin", "-r"));
|
||||
// return 0;
|
||||
//}
|
||||
//
|
||||
//function monstart($plugin)
|
||||
//{
|
||||
// //Before running "monstart", the command "monls" is used to check
|
||||
// $xml = docmd("monls","", NULL);
|
||||
// if(getXmlErrors($xml, $errors)) {
|
||||
// echo "<p class=Error>",implode(' ', $errors), "</p>";
|
||||
// exit;
|
||||
// }
|
||||
// $has_plugin = false;
|
||||
// if(count($xml->children()) != 0) {
|
||||
// foreach($xml->children() as $response) foreach($response->children() as $data) {
|
||||
// $arr = preg_split("/\s+/", $data);
|
||||
// if($arr[0] == $plugin) {
|
||||
// $has_plugin = true;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// if($has_plugin == false) {
|
||||
// //if $has_plugin == false, that means the plugin is not added into the monitoring table
|
||||
// $xml = docmd("monadd",'', array("$plugin"));
|
||||
// if(getXmlErrors($xml, $errors)) {
|
||||
// echo "<p class=Error>",implode(' ', $errors), "</p>";
|
||||
// exit;
|
||||
// }
|
||||
// }
|
||||
// //we have to make sure that the plugin is added in the "monitoring" table
|
||||
// $xml = docmd("monstart", "", array("$plugin", "-r"));
|
||||
// return 0;
|
||||
//}
|
||||
//
|
||||
//?>
|
||||
|
@ -1,20 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* This web page is for "Node status Monitoring" and "Application Status Monitioring",
|
||||
* The user can enable/disable "Node/Application Status Monitoring" from this page.
|
||||
*/
|
||||
if(!isset($TOPDIR)) { $TOPDIR="..";}
|
||||
|
||||
require_once "$TOPDIR/lib/security.php";
|
||||
require_once "$TOPDIR/lib/functions.php";
|
||||
require_once "$TOPDIR/lib/display.php";
|
||||
require_once "$TOPDIR/lib/monitor_display.php";
|
||||
|
||||
//get the name of the selected plug-in
|
||||
$name = $_REQUEST['name'];
|
||||
|
||||
displayNodeAppStatus($name);
|
||||
|
||||
displayStatus();
|
||||
|
||||
?>
|
Loading…
x
Reference in New Issue
Block a user