Event bar, module list in view, change builder data - #1748

This commit is contained in:
enriquecd 2018-01-26 14:43:23 +01:00
parent b57606610c
commit 7c71b83b9a
3 changed files with 253 additions and 28 deletions

View File

@ -362,8 +362,8 @@ elseif ($step == 4) {
echo "<tr>";
echo "<th><b>".__('Common modules')."</b></th>";
echo "<th><b>".__('Critical if more than')."</b></th>";
echo "<th><b>".__('Warning if more than')."</b></th>";
echo "<th><b>".__('Critical if equal or greater than')."</b></th>";
echo "<th><b>".__('Warning if equal or greater than')."</b></th>";
echo "<th><b>".__('Actions')."</b></th>";
echo "</tr>";

View File

@ -181,12 +181,16 @@ elseif ($step == 3) {
$id_parent_modulo = db_process_sql('select id_agente_modulo from tagente_modulo where id_agente = '.$id_agent[0]['id_agent'].' and nombre = "Cluster status"');
$get_module_type = db_process_sql('select id_tipo_modulo,descripcion from tagente_modulo where nombre = "'.$value.'" limit 1');
$get_module_type = db_process_sql('select id_tipo_modulo,descripcion,min_warning,min_critical from tagente_modulo where nombre = "'.$value.'" limit 1');
$get_module_type_value = $get_module_type[0]['id_tipo_modulo'];
$get_module_description_value = $get_module_type[0]['descripcion'];
$get_module_warning_value = $get_module_type[0]['min_warning'];
$get_module_critical_value = $get_module_type[0]['min_critical'];
$values_module = array(
'nombre' => $value,
'id_modulo' => 5,
@ -197,8 +201,8 @@ elseif ($step == 3) {
'custom_integer_2' =>$tcluster_module,
'id_tipo_modulo' =>$get_module_type_value,
'descripcion' => $get_module_description_value,
'min_warning' => 1,
'min_critical' => 2
'min_warning' => $get_module_warning_value,
'min_critical' => $get_module_critical_value
);
@ -249,9 +253,13 @@ elseif ($step == 3) {
$warning_values[$value] = get_parameter('warning_item_'.$value,0);
}
// $get_module_id_limit = db_process_sql('update tagente_modulo set min_critical = '.$value.' where nombre = (select name from tcluster_item where id = '.$key.') and cutom_integer_1 = '.$id_cluster);
foreach ($critical_values as $key => $value) {
$titem_critical_limit = db_process_sql('update tcluster_item set critical_limit = '.$value.' where id = '.$key);
$get_module_critical_limit = db_process_sql('update tagente_modulo set min_critical = '.$value.' where nombre = (select name from tcluster_item where id = '.$key.') and cutom_integer_1 = '.$id_cluster);
if ($titem_critical_limit !== false){
db_pandora_audit("Report management", "Critical limit #$value assigned to item #$key");
}
@ -265,6 +273,8 @@ elseif ($step == 3) {
$titem_warning_limit = db_process_sql('update tcluster_item set warning_limit = '.$value.' where id = '.$key);
$get_module_warning_limit = db_process_sql('update tagente_modulo set min_warning = '.$value.' where nombre = (select name from tcluster_item where id = '.$key.') and cutom_integer_1 = '.$id_cluster);
if ($titem_warning_limit !== false){
db_pandora_audit("Report management", "Critical limit #$value assigned to item #$key");
}
@ -280,7 +290,7 @@ elseif ($step == 3) {
header ("Location: index.php?sec=reporting&sec2=godmode/reporting/cluster_builder&step=5&id_cluster=".$id_cluster);
}
elseif ($cluster_type[$id_cluster] == 'AA') {
header ("Location: index.php?sec=reporting&sec2=godmode/reporting/cluster_view&id=".$id_cluster);
// header ("Location: index.php?sec=reporting&sec2=godmode/reporting/cluster_view&id=".$id_cluster);
}
}

View File

@ -34,15 +34,19 @@ ui_print_page_header ( __("Cluster detail").' » '.clusters_get_name($id_cluster
echo "<table style='width:100%;'>";
echo "<tr>";
echo "<td style='border:1px solid black;min-width:800px;min-height:500px;vertical-align: top;width:55%';>";
echo "<div id='cluster_map' style='min-width:800px;width:100%;height:500px;'></div>";
echo "<td style='border:1px solid black;min-width:600px;min-height:500px;vertical-align: top;width:55%';>";
echo "<div id='cluster_map' style='min-width:600px;width:100%;height:500px;'></div>";
echo "</td>";
echo "<td style='width:45%;min-width:600px;min-height:500pxpx;vertical-align: top;background-color:blue;'>";
echo "<td style='width:45%;min-width:390px;min-height:500px;vertical-align: top;background-color:blue;'>";
echo "<div style='width:50%;min-width:300px;background-color:lightblue;float:left;'>";
echo "<div style='float:left;width:100px;margin-left:20px;margin-top:20px;font-size:2em;text-align:center;'>".__('CLUSTER STATUS')."</div>";
echo "<div style='margin-left:auto;margin-right:auto;left:0;right:0;'>";
echo "<div style='width:50%;min-width:390px;max-width:390px;background-color:lightblue;float:left;'>";
echo "<div style='float:left;width:100px;margin-left:20px;margin-top:25px;font-size:2em;text-align:center;'>".__('CLUSTER STATUS')."</div>";
$cluster_module = db_process_sql('select id_agente_modulo from tagente_modulo where id_agente = (select id_agent from tcluster where id = '.$id_cluster.') and nombre = "Cluster status"');
@ -51,32 +55,56 @@ echo "<table style='width:100%;'>";
switch ($cluster_module_status) {
case 1:
echo "<div style='float:left;width:100px;margin-left:20px;margin-top:20px;height:50px;background-color:red;'></div>";
echo "<div style='border:3px gray groove;float:left;width:100px;margin-left:20px;margin-top:20px;height:50px;'>
<div class='status_animation' style='position:relative;width:100px;background-color:red;'></div>
</div>";
break;
case 2:
echo "<div style='float:left;width:100px;margin-left:20px;margin-top:20px;height:50px;background-color:yellow;'></div>";
echo "<div style='border:3px gray groove;float:left;width:100px;margin-left:20px;margin-top:20px;height:50px;'>
<div class='status_animation' style='position:relative;width:100px;background-color:yellow;'></div>
</div>";
break;
case 4:
echo "<div style='float:left;width:100px;margin-left:20px;margin-top:20px;height:50px;background-color:blue;'></div>";
echo "<div style='border:3px gray groove;float:left;width:100px;margin-left:20px;margin-top:20px;height:50px;'>
<div class='status_animation' style='position:relative;width:100px;background-color:blue;'></div>
</div>";
break;
case 3:
echo "<div style='float:left;width:100px;margin-left:20px;margin-top:20px;height:50px;background-color:gray;'></div>";
echo "<div style='border:3px gray groove;float:left;width:100px;margin-left:20px;margin-top:20px;height:50px;'>
<div class='status_animation' style='position:relative;width:100px;background-color:gray;'></div>
</div>";
break;
case 5:
echo "<div style='float:left;width:100px;margin-left:20px;margin-top:20px;height:50px;background-color:blue;'></div>";
echo "<div style='border:3px gray groove;float:left;width:100px;margin-left:20px;margin-top:20px;height:50px;'>
<div class='status_animation' style='position:relative;width:100px;background-color:blue;'></div>
</div>";
break;
case 0:
echo "<div style='float:left;width:100px;margin-left:20px;margin-top:20px;height:50px;background-color:green;'></div>";
echo "<div style='border:3px gray groove;float:left;width:100px;margin-left:20px;margin-top:20px;height:50px;'>
<div class='status_animation' style='position:relative;width:100px;background-color:green;'></div>
</div>";
break;
@ -85,7 +113,7 @@ echo "<table style='width:100%;'>";
break;
}
echo "<div style='border:1px solid lightgray;float:left;width:350px;margin-left:20px;margin-right:20px;margin-top:20px;height:200px;margin-bottom:20px;'>";
echo "<div style='border:1px solid lightgray;float:left;min-width:350px;width:350px;margin-left:20px;margin-right:20px;margin-top:20px;height:200px;margin-bottom:20px;'>";
echo "<div style='float:left;width:100%;height:25px;background-color:#373737;text-align:center;'><span style='color:#e7e9ea;display:block;margin:5px;font-size:1.5em;'>".__('Balanced modules')."</span></div>";
@ -118,14 +146,14 @@ echo "<table style='width:100%;'>";
echo "</div>";
echo "<div style='width:50%;min-width:300px;background-color:red;float:left;'>";
echo "<div style='width:50%;min-width:390px;max-width:390px;background-color:red;float:left;'>";
$last_update = db_process_sql('select timestamp from tagente_estado where id_agente_modulo = '.$cluster_module[0]['id_agente_modulo']);
$last_update_value = $last_update[0]['timestamp'];
echo "<div style='float:left;width:100px;px;margin-top:20px;font-size:2em;text-align:center;'>".__('LAST UPDATE')."</div>";
echo "<div style='float:left;width:220px;margin-left:20px;margin-top:30px;font-size:1.5em;text-align:center;'>".$last_update_value."</div>";
echo "<div style='float:left;width:100px;px;margin-left:20px;margin-top:25px;font-size:2em;text-align:center;'>".__('LAST UPDATE')."</div>";
echo "<div style='float:left;width:220px;margin-left:20px;margin-top:40px;font-size:1.5em;text-align:center;'>".$last_update_value."</div>";
echo "<div style='border:1px solid lightgray;float:left;width:350px;margin-left:20px;margin-right:20px;margin-top:20px;height:200px;margin-bottom:20px;'>";
@ -159,7 +187,10 @@ echo "<table style='width:100%;'>";
echo "</div>";
echo "<div style='width:100%;height:140px;min-width:600px;background-color:orange;float:left;margin-top:50px;'>";
echo "</div>";
echo "<div style='width:100%;height:140px;min-width:390px;background-color:orange;float:left;margin-top:50px;'>";
$id_agent = db_process_sql('select id_agent from tcluster where id = '.$id_cluster);
@ -219,14 +250,198 @@ echo "<table style='width:100%;'>";
echo "</tr>";
echo "<tr>";
echo "<td colspan='2' style='min-width:600px;min-height:600px;vertical-align: top;border:1px solid black;'>";
echo "<div id='cluster_modules' style='min-height:150px;'>";
echo "<td colspan='2' style='min-width:400px;min-height:600px;vertical-align: top;border:1px solid black;'>";
echo "<div id='module_list' style='min-height:150px;margin-top:20px;'>";
echo "</div>";
echo "</td>";
echo "</tr>";
echo "</table>";
$id_agent = db_process_sql('select id_agent from tcluster where id = '.$id_cluster);
$id_agent_value = $id_agent[0]['id_agent'];
ui_require_css_file ('cluetip');
ui_require_jquery_file ('cluetip');
echo "<div id='module_details_dialog' style='display: none;'></div>";
ui_include_time_picker();
ui_require_jquery_file("ui.datepicker-" . get_user_language(), "include/javascript/i18n/");
?>
<script>
function pagination_list_modules() {
var parameters = {};
parameters["list_modules"] = 1;
parameters["id_agente"] = <?php echo $id_agent_value; ?>;
parameters["filter_monitors"] = 0;
parameters["monitors_change_filter"] = 0;
parameters["page"] = "include/ajax/module";
$("#module_list").empty();
$("#module_list_loading").show();
jQuery.ajax ({
data: parameters,
type: 'POST',
url: "ajax.php",
dataType: 'html',
success: function (data) {
$("#module_list_loading").hide();
$("#module_list").empty();
$("#module_list").html(data);
$('.forced_title[alt=Force]').css('display','none');
}
});
}
$("a.tag_details").cluetip ({
arrows: true,
clickThrough: false,
attribute: 'href',
cluetipClass: 'default'
});
$("a.relations_details").cluetip ({
width: 500,
arrows: true,
clickThrough: false,
attribute: 'href',
cluetipClass: 'default',
sticky: true,
mouseOutClose: 'both',
closeText: '<?php html_print_image("images/cancel.png") ?>'
});
// Show the modal window of an module
function show_module_detail_dialog(module_id, id_agent, server_name, offset, period,module_name) {
var server_name = '';
var extra_parameters = '';
if ($('input[name=selection_mode]:checked').val()) {
period = $('#period').val();
var selection_mode = $('input[name=selection_mode]:checked').val();
var date_from = $('#text-date_from').val();
var time_from = $('#text-time_from').val();
var date_to = $('#text-date_to').val();
var time_to = $('#text-time_to').val();
extra_parameters = '&selection_mode=' + selection_mode + '&date_from=' + date_from + '&date_to=' + date_to + '&time_from=' + time_from + '&time_to=' + time_to;
}
// Get the free text in both options
var freesearch = $('#text-freesearch').val();
if (freesearch != null && freesearch !== '') {
var free_checkbox = $('input[name=free_checkbox]:checked').val();
extra_parameters += '&freesearch=' + freesearch;
if (free_checkbox == 1) {
extra_parameters += '&free_checkbox=1';
} else {
extra_parameters += '&free_checkbox=0';
}
}
title = <?php echo "\"" . __("Module: ") . "\"" ?>;
$.ajax({
type: "POST",
url: "<?php echo ui_get_full_url('ajax.php', false, false, false); ?>",
data: "page=include/ajax/module&get_module_detail=1&server_name="+server_name+"&id_agent="+id_agent+"&id_module=" + module_id+"&offset="+offset+"&period="+period + extra_parameters,
dataType: "html",
success: function(data) {
$("#module_details_dialog").hide ()
.empty ()
.append (data)
.dialog ({
resizable: true,
draggable: true,
modal: true,
title: title + module_name,
overlay: {
opacity: 0.5,
background: "black"
},
width: 650,
height: 500
})
.show ();
refresh_pagination_callback (module_id, id_agent, "",module_name);
datetime_picker_callback();
forced_title_callback();
}
});
}
function datetime_picker_callback() {
$("#text-time_from, #text-time_to").timepicker({
showSecond: true,
timeFormat: '<?php echo TIME_FORMAT_JS; ?>',
timeOnlyTitle: '<?php echo __('Choose time');?>',
timeText: '<?php echo __('Time');?>',
hourText: '<?php echo __('Hour');?>',
minuteText: '<?php echo __('Minute');?>',
secondText: '<?php echo __('Second');?>',
currentText: '<?php echo __('Now');?>',
closeText: '<?php echo __('Close');?>'});
$("#text-date_from, #text-date_to").datepicker({dateFormat: "<?php echo DATE_FORMAT_JS; ?>"});
$.datepicker.setDefaults($.datepicker.regional[ "<?php echo get_user_language(); ?>"]);
}
datetime_picker_callback();
function refresh_pagination_callback (module_id, id_agent, server_name,module_name) {
$(".binary_dialog").click( function() {
var classes = $(this).attr('class');
classes = classes.split(' ');
var offset_class = classes[2];
offset_class = offset_class.split('_');
var offset = offset_class[1];
var period = $('#period').val();
show_module_detail_dialog(module_id, id_agent, server_name, offset, period,module_name);
return false;
});
}
$(document).ready(function(){
pagination_list_modules();
$( ".status_animation" ).css({'height':'5px','top':'0px'});
$( ".status_animation" ).animate({
top: "45px"
}, 500, 'linear', function() {
$( ".status_animation" ).css({'height':'5px','top':'0px'});
$( ".status_animation" ).animate({
top: "45px"
}, 500, 'linear', function() {
$( ".status_animation" ).css({'height':'0px','top':'25px'});
$( ".status_animation" ).animate({
top: "0px",
height: "50px"
}, 500, 'linear', function() {
});
});
});
});
</script>