ADD failover option availability_graph
This commit is contained in:
parent
0064bc0cba
commit
209681e4c2
|
@ -0,0 +1,12 @@
|
|||
START TRANSACTION;
|
||||
|
||||
ALTER TABLE `treport_content_sla_combined` ADD `id_agent_module_failover` int(10) unsigned NOT NULL;
|
||||
ALTER TABLE `treport_content_sla_combined` ADD `id_server_failover` int(10) unsigned NOT NULL;
|
||||
|
||||
ALTER TABLE `treport_content` ADD COLUMN `failover_mode` tinyint(1) DEFAULT '0';
|
||||
ALTER TABLE `treport_content` ADD COLUMN `failover_type` tinyint(1) DEFAULT '0';
|
||||
|
||||
ALTER TABLE `treport_content_template` ADD COLUMN `failover_mode` tinyint(1) DEFAULT '1';
|
||||
ALTER TABLE `treport_content_template` ADD COLUMN `failover_type` tinyint(1) DEFAULT '1';
|
||||
|
||||
COMMIT;
|
|
@ -796,6 +796,8 @@ ALTER TABLE `treport_content_template` ADD COLUMN `unknown_checks` TINYINT(1) DE
|
|||
ALTER TABLE `treport_content_template` ADD COLUMN `agent_max_value` TINYINT(1) DEFAULT '1';
|
||||
ALTER TABLE `treport_content_template` ADD COLUMN `agent_min_value` TINYINT(1) DEFAULT '1';
|
||||
ALTER TABLE `treport_content_template` ADD COLUMN `current_month` TINYINT(1) DEFAULT '1';
|
||||
ALTER TABLE `treport_content_template` ADD COLUMN `failover_mode` tinyint(1) DEFAULT '1';
|
||||
ALTER TABLE `treport_content_template` ADD COLUMN `failover_type` tinyint(1) DEFAULT '1';
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `treport_content_sla_com_temp` (treport_content_sla_combined_template)
|
||||
|
@ -1442,6 +1444,8 @@ ALTER TABLE `treport_content` ADD COLUMN `unknown_checks` TINYINT(1) DEFAULT '1'
|
|||
ALTER TABLE `treport_content` ADD COLUMN `agent_max_value` TINYINT(1) DEFAULT '1';
|
||||
ALTER TABLE `treport_content` ADD COLUMN `agent_min_value` TINYINT(1) DEFAULT '1';
|
||||
ALTER TABLE `treport_content` ADD COLUMN `current_month` TINYINT(1) DEFAULT '1';
|
||||
ALTER TABLE `treport_content` ADD COLUMN `failover_mode` tinyint(1) DEFAULT '0';
|
||||
ALTER TABLE `treport_content` ADD COLUMN `failover_type` tinyint(1) DEFAULT '0';
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tmodule_relationship`
|
||||
|
@ -2213,4 +2217,5 @@ CREATE TABLE IF NOT EXISTS `tcredential_store` (
|
|||
-- ---------------------------------------------------------------------
|
||||
-- Table `treport_content_sla_combined`
|
||||
-- ---------------------------------------------------------------------
|
||||
ALTER TABLE `treport_content_sla_combined` ADD `id_agent_module_secondary` int(10) unsigned NOT NULL;
|
||||
ALTER TABLE `treport_content_sla_combined` ADD `id_agent_module_failover` int(10) unsigned NOT NULL;
|
||||
ALTER TABLE `treport_content_sla_combined` ADD `id_server_failover` int(10) unsigned NOT NULL;
|
||||
|
|
|
@ -165,6 +165,8 @@ switch ($action) {
|
|||
$show_in_landscape = 0;
|
||||
$hide_notinit_agents = 0;
|
||||
$priority_mode = REPORT_PRIORITY_MODE_OK;
|
||||
$failover_mode = 0;
|
||||
$failover_type = REPORT_FAILOVER_TYPE_NORMAL;
|
||||
$server_name = '';
|
||||
$server_id = 0;
|
||||
$dyn_height = 230;
|
||||
|
@ -314,6 +316,8 @@ switch ($action) {
|
|||
$sla_sorted_by = $item['top_n'];
|
||||
$period = $item['period'];
|
||||
$current_month = $item['current_month'];
|
||||
$failover_mode = $item['failover_mode'];
|
||||
$failover_type = $item['failover_type'];
|
||||
break;
|
||||
|
||||
case 'module_histogram_graph':
|
||||
|
@ -2237,6 +2241,7 @@ $class = 'databox filters';
|
|||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr id="row_select_fields2" style="" class="datos">
|
||||
<td style="font-weight:bold;margin-right:150px;">
|
||||
<?php
|
||||
|
@ -2608,6 +2613,59 @@ $class = 'databox filters';
|
|||
</td>
|
||||
</tr>
|
||||
|
||||
<tr id="row_failover_mode" style="" class="datos">
|
||||
<td style="font-weight:bold;">
|
||||
<?php
|
||||
echo __('Failover mode').ui_print_help_tip(
|
||||
__('XXX.'),
|
||||
true
|
||||
);
|
||||
?>
|
||||
</td>
|
||||
<td>
|
||||
<?php
|
||||
html_print_checkbox_switch(
|
||||
'failover_mode',
|
||||
1,
|
||||
$failover_mode
|
||||
);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr id="row_failover_type" style="" class="datos">
|
||||
<td style="font-weight:bold;">
|
||||
<?php
|
||||
echo __('Failover type');
|
||||
?>
|
||||
</td>
|
||||
<td>
|
||||
<?php
|
||||
echo __('Failover normal');
|
||||
echo '<span style="margin-left:5px;"></span>';
|
||||
html_print_radio_button(
|
||||
'failover_type',
|
||||
REPORT_FAILOVER_TYPE_NORMAL,
|
||||
'',
|
||||
$failover_type == REPORT_FAILOVER_TYPE_NORMAL,
|
||||
''
|
||||
);
|
||||
|
||||
echo '<span style="margin:30px;"></span>';
|
||||
|
||||
echo __('Failover simple');
|
||||
echo '<span style="margin-left:5px;"></span>';
|
||||
html_print_radio_button(
|
||||
'failover_type',
|
||||
REPORT_FAILOVER_TYPE_SIMPLE,
|
||||
'',
|
||||
$failover_type == REPORT_FAILOVER_TYPE_SIMPLE,
|
||||
''
|
||||
);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr id="row_filter_search" style="" class="datos">
|
||||
<td style="font-weight:bold;"><?php echo __('Free search'); ?></td>
|
||||
<td>
|
||||
|
@ -2771,6 +2829,13 @@ function print_SLA_list($width, $action, $idItem=null)
|
|||
'id_rc',
|
||||
$idItem
|
||||
);
|
||||
|
||||
$failover_mode = db_get_value(
|
||||
'failover_mode',
|
||||
'treport_content',
|
||||
'id_rc',
|
||||
$idItem
|
||||
);
|
||||
?>
|
||||
<table class="databox data" id="sla_list" border="0" cellpadding="4" cellspacing="4" width="100%">
|
||||
<thead>
|
||||
|
@ -2783,16 +2848,18 @@ function print_SLA_list($width, $action, $idItem=null)
|
|||
<th class="header sla_list_module_col" scope="col">
|
||||
<?php
|
||||
echo __('Module');
|
||||
if ($report_item_type == 'availability_graph') {
|
||||
if ($report_item_type == 'availability_graph'
|
||||
&& $failover_mode
|
||||
) {
|
||||
?>
|
||||
<th class="header sla_list_agent_secondary" scope="col">
|
||||
<th class="header sla_list_agent_failover" scope="col">
|
||||
<?php
|
||||
echo __('Agent Secondary');
|
||||
echo __('Agent Failover');
|
||||
?>
|
||||
</th>
|
||||
<th class="header sla_list_module_secondary" scope="col">
|
||||
<th class="header sla_list_module_failover" scope="col">
|
||||
<?php
|
||||
echo __('Module Secondary');
|
||||
echo __('Module Failover');
|
||||
?>
|
||||
</th>
|
||||
<?php
|
||||
|
@ -2878,22 +2945,22 @@ function print_SLA_list($width, $action, $idItem=null)
|
|||
['id_agente_modulo' => $item['id_agent_module']]
|
||||
);
|
||||
|
||||
if (isset($item['id_agent_module_secondary']) === true
|
||||
&& $item['id_agent_module_secondary'] !== 0
|
||||
if (isset($item['id_agent_module_failover']) === true
|
||||
&& $item['id_agent_module_failover'] !== 0
|
||||
) {
|
||||
$idAgentSecondary = db_get_value_filter(
|
||||
$idAgentFailover = db_get_value_filter(
|
||||
'id_agente',
|
||||
'tagente_modulo',
|
||||
['id_agente_modulo' => $item['id_agent_module_secondary']]
|
||||
['id_agente_modulo' => $item['id_agent_module_failover']]
|
||||
);
|
||||
$nameAgentSecondary = agents_get_alias(
|
||||
$idAgentSecondary
|
||||
$nameAgentFailover = agents_get_alias(
|
||||
$idAgentFailover
|
||||
);
|
||||
|
||||
$nameModuleSecondary = db_get_value_filter(
|
||||
$nameModuleFailover = db_get_value_filter(
|
||||
'nombre',
|
||||
'tagente_modulo',
|
||||
['id_agente_modulo' => $item['id_agent_module_secondary']]
|
||||
['id_agente_modulo' => $item['id_agent_module_failover']]
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -2910,12 +2977,14 @@ function print_SLA_list($width, $action, $idItem=null)
|
|||
echo printSmallFont($nameModule);
|
||||
echo '</td>';
|
||||
|
||||
if ($report_item_type == 'availability_graph') {
|
||||
echo '<td class="sla_list_agent_secondary">';
|
||||
echo printSmallFont($nameAgentSecondary).$server_name_element;
|
||||
if ($report_item_type == 'availability_graph'
|
||||
&& $failover_mode
|
||||
) {
|
||||
echo '<td class="sla_list_agent_failover">';
|
||||
echo printSmallFont($nameAgentFailover).$server_name_element;
|
||||
echo '</td>';
|
||||
echo '<td class="sla_list_module_secondary">';
|
||||
echo printSmallFont($nameModuleSecondary);
|
||||
echo '<td class="sla_list_module_failover">';
|
||||
echo printSmallFont($nameModuleFailover);
|
||||
echo '</td>';
|
||||
}
|
||||
|
||||
|
@ -2967,10 +3036,12 @@ function print_SLA_list($width, $action, $idItem=null)
|
|||
<td class="sla_list_agent_col agent_name"></td>
|
||||
<td class="sla_list_module_col module_name"></td>
|
||||
<?php
|
||||
if ($report_item_type == 'availability_graph') {
|
||||
if ($report_item_type == 'availability_graph'
|
||||
&& $failover_mode
|
||||
) {
|
||||
?>
|
||||
<td class="sla_list_agent_secondary agent_name_secondary"></td>
|
||||
<td class="sla_list_module_secondary module_name_secondary"></td>
|
||||
<td class="sla_list_agent_failover agent_name_failover"></td>
|
||||
<td class="sla_list_module_failover module_name_failover"></td>
|
||||
<?php
|
||||
}
|
||||
|
||||
|
@ -3030,20 +3101,22 @@ function print_SLA_list($width, $action, $idItem=null)
|
|||
</select>
|
||||
</td>
|
||||
<?php
|
||||
if ($report_item_type == 'availability_graph') {
|
||||
if ($report_item_type == 'availability_graph'
|
||||
&& $failover_mode
|
||||
) {
|
||||
?>
|
||||
<td class="sla_list_agent_secondary_col">
|
||||
<input id="hidden-id_agent_secondary" name="id_agent_secondary" value="" type="hidden">
|
||||
<input id="hidden-server_name_secondary" name="server_name_secondary" value="" type="hidden">
|
||||
<td class="sla_list_agent_failover_col">
|
||||
<input id="hidden-id_agent_failover" name="id_agent_failover" value="" type="hidden">
|
||||
<input id="hidden-server_name_failover" name="server_name_failover" value="" type="hidden">
|
||||
<?php
|
||||
$params = [];
|
||||
$params['show_helptip'] = true;
|
||||
$params['input_name'] = 'agent_secondary';
|
||||
$params['input_name'] = 'agent_failover';
|
||||
$params['value'] = '';
|
||||
$params['use_hidden_input_idagent'] = true;
|
||||
$params['hidden_input_idagent_id'] = 'hidden-id_agent_secondary';
|
||||
$params['hidden_input_idagent_id'] = 'hidden-id_agent_failover';
|
||||
$params['javascript_is_function_select'] = true;
|
||||
$params['selectbox_id'] = 'id_agent_module_secondary';
|
||||
$params['selectbox_id'] = 'id_agent_module_failover';
|
||||
$params['add_none_module'] = false;
|
||||
if ($meta) {
|
||||
$params['use_input_id_server'] = true;
|
||||
|
@ -3054,8 +3127,8 @@ function print_SLA_list($width, $action, $idItem=null)
|
|||
ui_print_agent_autocomplete_input($params);
|
||||
?>
|
||||
</td>
|
||||
<td class="sla_list_module_secondary_col">
|
||||
<select id="id_agent_module_secondary" name="id_agent_module_secondary" disabled="disabled" style="max-width: 180px">
|
||||
<td class="sla_list_module_failover_col">
|
||||
<select id="id_agent_module_failover" name="id_agent_module_failover" disabled="disabled" style="max-width: 180px">
|
||||
<option value="0">
|
||||
<?php
|
||||
echo __('Select an Agent first');
|
||||
|
@ -3701,11 +3774,18 @@ $(document).ready (function () {
|
|||
$("#checkbox-checkbox_show_resume").change(function(){
|
||||
if($(this).is(":checked")){
|
||||
$("#row_select_fields2").show();
|
||||
$("#row_select_fields3").show();
|
||||
}
|
||||
else{
|
||||
$("#row_select_fields2").hide();
|
||||
$("#row_select_fields3").hide();
|
||||
}
|
||||
});
|
||||
|
||||
$("#checkbox-failover_mode").change(function(){
|
||||
if($(this).is(":checked")){
|
||||
$("#row_failover_type").show();
|
||||
}
|
||||
else{
|
||||
$("#row_failover_type").hide();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
@ -3999,13 +4079,13 @@ function deleteGeneralRow(id_row) {
|
|||
|
||||
function addSLARow() {
|
||||
var nameAgent = $("input[name=agent_sla]").val();
|
||||
var nameAgentSecondary = $("input[name=agent_secondary]").val();
|
||||
var nameAgentFailover = $("input[name=agent_failover]").val();
|
||||
var idAgent = $("input[name=id_agent_sla]").val();
|
||||
var serverId = $("input[name=id_server]").val();
|
||||
var idModule = $("#id_agent_module_sla").val();
|
||||
var idModuleSecondary = $("#id_agent_module_secondary").val();
|
||||
var idModuleFailover = $("#id_agent_module_failover").val();
|
||||
var nameModule = $("#id_agent_module_sla :selected").text();
|
||||
var nameModuleSecondary = $("#id_agent_module_secondary :selected").text();
|
||||
var nameModuleFailover = $("#id_agent_module_failover :selected").text();
|
||||
var slaMin = $("input[name=sla_min]").val();
|
||||
var slaMax = $("input[name=sla_max]").val();
|
||||
var slaLimit = $("input[name=sla_limit]").val();
|
||||
|
@ -4066,11 +4146,11 @@ function addSLARow() {
|
|||
});
|
||||
}
|
||||
|
||||
if (nameAgentSecondary != '') {
|
||||
//Truncate nameAgentSecondary
|
||||
if (nameAgentFailover != '') {
|
||||
//Truncate nameAgentFailover
|
||||
var params = [];
|
||||
params.push("truncate_text=1");
|
||||
params.push("text=" + nameAgentSecondary);
|
||||
params.push("text=" + nameAgentFailover);
|
||||
params.push("page=include/ajax/reporting.ajax");
|
||||
jQuery.ajax ({
|
||||
data: params.join ("&"),
|
||||
|
@ -4088,14 +4168,14 @@ function addSLARow() {
|
|||
async: false,
|
||||
timeout: 10000,
|
||||
success: function (data) {
|
||||
nameAgentSecondary = data;
|
||||
nameAgentFailover = data;
|
||||
}
|
||||
});
|
||||
|
||||
//Truncate nameModuleSecondary
|
||||
//Truncate nameModuleFailover
|
||||
var params = [];
|
||||
params.push("truncate_text=1");
|
||||
params.push("text=" + nameModuleSecondary);
|
||||
params.push("text=" + nameModuleFailover);
|
||||
params.push("page=include/ajax/reporting.ajax");
|
||||
jQuery.ajax ({
|
||||
data: params.join ("&"),
|
||||
|
@ -4113,7 +4193,7 @@ function addSLARow() {
|
|||
async: false,
|
||||
timeout: 10000,
|
||||
success: function (data) {
|
||||
nameModuleSecondary = data;
|
||||
nameModuleFailover = data;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -4122,7 +4202,7 @@ function addSLARow() {
|
|||
params.push("add_sla=1");
|
||||
params.push("id=" + $("input[name=id_item]").val());
|
||||
params.push("id_module=" + idModule);
|
||||
params.push("id_module_secondary=" + idModuleSecondary);
|
||||
params.push("id_module_failover=" + idModuleFailover);
|
||||
params.push("sla_min=" + slaMin);
|
||||
params.push("sla_max=" + slaMax);
|
||||
params.push("sla_limit=" + slaLimit);
|
||||
|
@ -4155,8 +4235,8 @@ function addSLARow() {
|
|||
$("#row", row).attr('id', 'sla_' + data['id']);
|
||||
$(".agent_name", row).html(nameAgent);
|
||||
$(".module_name", row).html(nameModule);
|
||||
$(".agent_name_secondary", row).html(nameAgentSecondary);
|
||||
$(".module_name_secondary", row).html(nameModuleSecondary);
|
||||
$(".agent_name_failover", row).html(nameAgentFailover);
|
||||
$(".module_name_failover", row).html(nameModuleFailover);
|
||||
$(".service_name", row).html(serviceName);
|
||||
$(".sla_min", row).html(slaMin);
|
||||
$(".sla_max", row).html(slaMax);
|
||||
|
@ -4167,19 +4247,19 @@ function addSLARow() {
|
|||
);
|
||||
$("#list_sla").append($(row).html());
|
||||
$("input[name=id_agent_sla]").val('');
|
||||
$("input[name=id_agent_secondary]").val('');
|
||||
$("input[name=id_agent_failover]").val('');
|
||||
$("input[name=id_server]").val('');
|
||||
$("input[name=agent_sla]").val('');
|
||||
$("input[name=agent_secondary]").val('');
|
||||
$("input[name=agent_failover]").val('');
|
||||
$("#id_agent_module_sla").empty();
|
||||
$("#id_agent_module_sla").attr('disabled', 'true');
|
||||
$("#id_agent_module_sla").append(
|
||||
$("<option></option>")
|
||||
.attr ("value", 0)
|
||||
.html ($("#module_sla_text").html()));
|
||||
$("#id_agent_module_secondary").empty();
|
||||
$("#id_agent_module_secondary").attr('disabled', 'true');
|
||||
$("#id_agent_module_secondary").append(
|
||||
$("#id_agent_module_failover").empty();
|
||||
$("#id_agent_module_failover").attr('disabled', 'true');
|
||||
$("#id_agent_module_failover").append(
|
||||
$("<option></option>")
|
||||
.attr ("value", 0)
|
||||
.html ($("#module_sla_text").html()));
|
||||
|
@ -4360,6 +4440,8 @@ function chooseType() {
|
|||
$("#row_custom_example").hide();
|
||||
$("#row_group").hide();
|
||||
$("#row_current_month").hide();
|
||||
$("#row_failover_mode").hide();
|
||||
$("#row_failover_type").hide();
|
||||
$("#row_working_time").hide();
|
||||
$("#row_only_display_wrong").hide();
|
||||
$("#row_combo_module").hide();
|
||||
|
@ -4533,6 +4615,11 @@ function chooseType() {
|
|||
$("#row_working_time").show();
|
||||
$("#row_historical_db_check").hide();
|
||||
$("#row_priority_mode").show();
|
||||
$("#row_failover_mode").show();
|
||||
var failover_checked = $("input[name='failover_mode']").prop("checked");
|
||||
if(failover_checked){
|
||||
$("#row_failover_type").show();
|
||||
}
|
||||
break;
|
||||
|
||||
case 'module_histogram_graph':
|
||||
|
|
|
@ -1441,6 +1441,14 @@ switch ($action) {
|
|||
$values['show_graph'] = get_parameter(
|
||||
'combo_graph_options'
|
||||
);
|
||||
$values['failover_mode'] = get_parameter(
|
||||
'failover_mode',
|
||||
0
|
||||
);
|
||||
$values['failover_type'] = get_parameter(
|
||||
'failover_type',
|
||||
REPORT_FAILOVER_TYPE_NORMAL
|
||||
);
|
||||
|
||||
$good_format = true;
|
||||
break;
|
||||
|
@ -2398,6 +2406,16 @@ switch ($action) {
|
|||
|
||||
$values['current_month'] = get_parameter('current_month');
|
||||
|
||||
$values['failover_mode'] = get_parameter(
|
||||
'failover_mode',
|
||||
0
|
||||
);
|
||||
|
||||
$values['failover_type'] = get_parameter(
|
||||
'failover_type',
|
||||
REPORT_FAILOVER_TYPE_NORMAL
|
||||
);
|
||||
|
||||
$style = [];
|
||||
$style['show_in_same_row'] = get_parameter(
|
||||
'show_in_same_row',
|
||||
|
|
|
@ -65,7 +65,8 @@ if ($add_sla) {
|
|||
$sla_max = get_parameter('sla_max', 0);
|
||||
$sla_min = get_parameter('sla_min', 0);
|
||||
$server_id = (int) get_parameter('server_id', 0);
|
||||
$id_module_secondary = (int) get_parameter('id_module_secondary', 0);
|
||||
$id_module_failover = (int) get_parameter('id_module_failover', 0);
|
||||
$id_server_failover = (int) get_parameter('id_server_failover', 0);
|
||||
|
||||
$id_service = (int) get_parameter('id_service');
|
||||
if (empty($id_module) && !empty($id_service)) {
|
||||
|
@ -86,13 +87,14 @@ if ($add_sla) {
|
|||
$result = db_process_sql_insert(
|
||||
'treport_content_sla_combined',
|
||||
[
|
||||
'id_report_content' => $id,
|
||||
'id_agent_module' => $id_module,
|
||||
'id_agent_module_secondary' => $id_module_secondary,
|
||||
'sla_max' => $sla_max,
|
||||
'sla_min' => $sla_min,
|
||||
'sla_limit' => $sla_limit,
|
||||
'server_name' => $connection['server_name'],
|
||||
'id_report_content' => $id,
|
||||
'id_agent_module' => $id_module,
|
||||
'id_agent_module_failover' => $id_module_failover,
|
||||
'sla_max' => $sla_max,
|
||||
'sla_min' => $sla_min,
|
||||
'sla_limit' => $sla_limit,
|
||||
'server_name' => $connection['server_name'],
|
||||
'id_server_failover' => $id_server_failover,
|
||||
]
|
||||
);
|
||||
|
||||
|
|
|
@ -134,7 +134,6 @@ if ($install_package) {
|
|||
|
||||
$accept = (bool) get_parameter('accept', false);
|
||||
if ($accept) {
|
||||
hd($accept, true);
|
||||
$package = (string) get_parameter('package');
|
||||
$package = trim($package);
|
||||
|
||||
|
|
|
@ -53,6 +53,10 @@ require_once $config['homedir'].'/include/functions_network.php';
|
|||
define('REPORT_PRIORITY_MODE_OK', 1);
|
||||
define('REPORT_PRIORITY_MODE_UNKNOWN', 2);
|
||||
|
||||
// Failover type.
|
||||
define('REPORT_FAILOVER_TYPE_NORMAL', 1);
|
||||
define('REPORT_FAILOVER_TYPE_SIMPLE', 2);
|
||||
|
||||
// Status.
|
||||
define('REPORT_STATUS_ERR', 0);
|
||||
define('REPORT_STATUS_OK', 1);
|
||||
|
@ -6403,6 +6407,7 @@ function reporting_availability_graph($report, $content, $pdf=false)
|
|||
|
||||
$return['title'] = $content['name'];
|
||||
$return['description'] = $content['description'];
|
||||
$return['failover_type'] = $content['failover_type'];
|
||||
$return['date'] = reporting_get_date_text($report, $content);
|
||||
|
||||
// Get chart.
|
||||
|
@ -6458,18 +6463,20 @@ function reporting_availability_graph($report, $content, $pdf=false)
|
|||
}
|
||||
}
|
||||
|
||||
if (isset($sla['id_agent_module_secondary']) === true
|
||||
&& $sla['id_agent_module_secondary'] != 0
|
||||
if (isset($sla['id_agent_module_failover']) === true
|
||||
&& $sla['id_agent_module_failover'] != 0
|
||||
) {
|
||||
$sla_secondary['primary'] = $sla;
|
||||
$sla_secondary['failover'] = $sla;
|
||||
$sla_secondary['failover']['id_agent_module'] = $sla['id_agent_module_secondary'];
|
||||
$sla_failover = [];
|
||||
$sla_failover['primary'] = $sla;
|
||||
$sla_failover['failover'] = $sla;
|
||||
$sla_failover['failover']['id_agent_module'] = $sla['id_agent_module_failover'];
|
||||
|
||||
// For graph slice for module-interval, if not slice=0.
|
||||
$module_interval = modules_get_interval($sla['id_agent_module']);
|
||||
$slice = ($content['period'] / $module_interval);
|
||||
$data_combined = [];
|
||||
|
||||
foreach ($sla_secondary as $k_sla => $v_sla) {
|
||||
foreach ($sla_failover as $k_sla => $v_sla) {
|
||||
$sla_array = data_db_uncompress_module(
|
||||
$v_sla,
|
||||
$content,
|
||||
|
@ -6477,14 +6484,16 @@ function reporting_availability_graph($report, $content, $pdf=false)
|
|||
$slice
|
||||
);
|
||||
|
||||
$return = prepare_data_for_paint(
|
||||
$v_sla,
|
||||
$sla_array,
|
||||
$content,
|
||||
$report['datetime'],
|
||||
$return,
|
||||
$k_sla
|
||||
);
|
||||
if ($content['failover_type'] == REPORT_FAILOVER_TYPE_NORMAL) {
|
||||
$return = prepare_data_for_paint(
|
||||
$v_sla,
|
||||
$sla_array,
|
||||
$content,
|
||||
$report['datetime'],
|
||||
$return,
|
||||
$k_sla
|
||||
);
|
||||
}
|
||||
|
||||
$data_combined[] = $sla_array;
|
||||
}
|
||||
|
@ -6493,8 +6502,10 @@ function reporting_availability_graph($report, $content, $pdf=false)
|
|||
&& is_array($data_combined) === true
|
||||
&& count($data_combined) > 0
|
||||
) {
|
||||
$data_a = [];
|
||||
$data_a = array_map(
|
||||
function ($primary, $failover) {
|
||||
$return_map = [];
|
||||
if ($primary['date_from'] === $failover['date_from']
|
||||
&& $primary['date_to'] === $failover['date_to']
|
||||
) {
|
||||
|
@ -6517,10 +6528,10 @@ function reporting_availability_graph($report, $content, $pdf=false)
|
|||
$primary['sla_fixed'] = $failover['sla_fixed'];
|
||||
}
|
||||
|
||||
$return = $primary;
|
||||
$return_map = $primary;
|
||||
}
|
||||
|
||||
return $return;
|
||||
return $return_map;
|
||||
},
|
||||
$data_combined[0],
|
||||
$data_combined[1]
|
||||
|
@ -6778,7 +6789,7 @@ function reporting_get_planned_downtimes_sla($id_agent_module, $datetime, $perio
|
|||
* @param array $content Content report data.
|
||||
* @param integer $datetime Date.
|
||||
* @param array $return Array return.
|
||||
* @param string $secondary Type secondaary primary, failover, Result.
|
||||
* @param string $failover Type primary, failover, Result.
|
||||
*
|
||||
* @return array Return modify.
|
||||
*/
|
||||
|
@ -6788,7 +6799,7 @@ function prepare_data_for_paint(
|
|||
$content,
|
||||
$datetime,
|
||||
$return,
|
||||
$secondary=''
|
||||
$failover=''
|
||||
) {
|
||||
$data = [];
|
||||
$alias_agent = modules_get_agentmodule_agent_alias(
|
||||
|
@ -6804,7 +6815,7 @@ function prepare_data_for_paint(
|
|||
$data['min'] = $sla['sla_min'];
|
||||
$data['sla_limit'] = $sla['sla_limit'];
|
||||
$data['dinamic_text'] = $dinamic_text;
|
||||
$data['secondary'] = $secondary;
|
||||
$data['failover'] = $failover;
|
||||
if (isset($sla_array[0])) {
|
||||
$data['time_total'] = 0;
|
||||
$data['time_ok'] = 0;
|
||||
|
@ -6929,7 +6940,7 @@ function prepare_data_for_paint(
|
|||
$dataslice['sla_value'] = $data['sla_value'];
|
||||
|
||||
$height = 80;
|
||||
if ($secondary !== '' && $secondary !== 'result') {
|
||||
if ($failover !== '' && $failover !== 'result') {
|
||||
$height = 50;
|
||||
}
|
||||
|
||||
|
|
|
@ -3284,7 +3284,7 @@ function reporting_html_availability_graph($table, $item, $pdf=0)
|
|||
}
|
||||
|
||||
// Check failover availability report.
|
||||
if ($item['data'][$k_chart]['secondary'] === '') {
|
||||
if ($item['data'][$k_chart]['failover'] === '') {
|
||||
$table1 = new stdClass();
|
||||
$table1->width = '99%';
|
||||
$table1->data = [];
|
||||
|
@ -3302,7 +3302,9 @@ function reporting_html_availability_graph($table, $item, $pdf=0)
|
|||
true
|
||||
);
|
||||
} else {
|
||||
if ($item['data'][$k_chart]['secondary'] === 'primary') {
|
||||
if ($item['data'][$k_chart]['failover'] === 'primary'
|
||||
|| $item['failover_type'] == REPORT_FAILOVER_TYPE_SIMPLE
|
||||
) {
|
||||
$table1 = new stdClass();
|
||||
$table1->width = '99%';
|
||||
$table1->data = [];
|
||||
|
@ -3316,7 +3318,7 @@ function reporting_html_availability_graph($table, $item, $pdf=0)
|
|||
$title = '';
|
||||
$checks_resume_text = $checks_resume;
|
||||
$sla_value_text = "<span style = 'font: bold 2em Arial, Sans-serif; color: ".$color."'>".$sla_value.'</span>';
|
||||
switch ($item['data'][$k_chart]['secondary']) {
|
||||
switch ($item['data'][$k_chart]['failover']) {
|
||||
case 'primary':
|
||||
$title = '<b>'.__('Primary').'</b>';
|
||||
$title .= '<br />'.$chart['agent'];
|
||||
|
@ -3339,12 +3341,12 @@ function reporting_html_availability_graph($table, $item, $pdf=0)
|
|||
break;
|
||||
}
|
||||
|
||||
$table1->data[$item['data'][$k_chart]['secondary']][0] = $title;
|
||||
$table1->data[$item['data'][$k_chart]['secondary']][1] = $chart['chart'];
|
||||
$table1->data[$item['data'][$k_chart]['secondary']][2] = $sla_value_text;
|
||||
$table1->data[$item['data'][$k_chart]['secondary']][3] = $checks_resume_text;
|
||||
$table1->data[$item['data'][$k_chart]['failover']][0] = $title;
|
||||
$table1->data[$item['data'][$k_chart]['failover']][1] = $chart['chart'];
|
||||
$table1->data[$item['data'][$k_chart]['failover']][2] = $sla_value_text;
|
||||
$table1->data[$item['data'][$k_chart]['failover']][3] = $checks_resume_text;
|
||||
|
||||
if ($item['data'][$k_chart]['secondary'] === 'result') {
|
||||
if ($item['data'][$k_chart]['failover'] === 'result') {
|
||||
$tables_chart .= html_print_table(
|
||||
$table1,
|
||||
true
|
||||
|
|
|
@ -1452,6 +1452,8 @@ CREATE TABLE IF NOT EXISTS `treport_content` (
|
|||
`agent_max_value` TINYINT(1) DEFAULT '1',
|
||||
`agent_min_value` TINYINT(1) DEFAULT '1',
|
||||
`current_month` TINYINT(1) DEFAULT '1',
|
||||
`failover_mode` tinyint(1) DEFAULT '1',
|
||||
`failover_type` tinyint(1) DEFAULT '1',
|
||||
PRIMARY KEY(`id_rc`),
|
||||
FOREIGN KEY (`id_report`) REFERENCES treport(`id_report`)
|
||||
ON UPDATE CASCADE ON DELETE CASCADE
|
||||
|
@ -1464,7 +1466,8 @@ CREATE TABLE IF NOT EXISTS `treport_content_sla_combined` (
|
|||
`id` INTEGER UNSIGNED NOT NULL auto_increment,
|
||||
`id_report_content` INTEGER UNSIGNED NOT NULL,
|
||||
`id_agent_module` int(10) unsigned NOT NULL,
|
||||
`id_agent_module_secondary` int(10) unsigned NOT NULL,
|
||||
`id_agent_module_failover` int(10) unsigned NOT NULL,
|
||||
`id_server_failover` int(10) unsigned NOT NULL default 0,
|
||||
`sla_max` double(18,2) NOT NULL default 0,
|
||||
`sla_min` double(18,2) NOT NULL default 0,
|
||||
`sla_limit` double(18,2) NOT NULL default 0,
|
||||
|
@ -2993,6 +2996,8 @@ CREATE TABLE IF NOT EXISTS `treport_content_template` (
|
|||
`agent_max_value` TINYINT(1) DEFAULT '1',
|
||||
`agent_min_value` TINYINT(1) DEFAULT '1',
|
||||
`current_month` TINYINT(1) DEFAULT '1',
|
||||
`failover_mode` tinyint(1) DEFAULT '1',
|
||||
`failover_type` tinyint(1) DEFAULT '1',
|
||||
PRIMARY KEY(`id_rc`)
|
||||
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
|
Loading…
Reference in New Issue