fixed errors
This commit is contained in:
parent
8c7acdb02e
commit
0064bc0cba
|
@ -1239,13 +1239,13 @@ ALTER TABLE titem MODIFY `source_data` int(10) unsigned;
|
|||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('big_operation_step_datos_purge', '100');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('small_operation_step_datos_purge', '1000');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('days_autodisable_deletion', '30');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 29);
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 30);
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_docs_logo', 'default_docs.png');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_support_logo', 'default_support.png');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_logo_white_bg_preview', 'pandora_logo_head_white_bg.png');
|
||||
UPDATE tconfig SET value = 'https://licensing.artica.es/pandoraupdate7/server.php' WHERE token='url_update_manager';
|
||||
DELETE FROM `tconfig` WHERE `token` = 'current_package_enterprise';
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package_enterprise', '736');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package_enterprise', '737');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('status_monitor_fields', 'policy,agent,data_type,module_name,server_type,interval,status,graph,warn,data,timestamp');
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
|
@ -2209,3 +2209,8 @@ CREATE TABLE IF NOT EXISTS `tcredential_store` (
|
|||
`extra_2` text,
|
||||
PRIMARY KEY (`identifier`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `treport_content_sla_combined`
|
||||
-- ---------------------------------------------------------------------
|
||||
ALTER TABLE `treport_content_sla_combined` ADD `id_agent_module_secondary` int(10) unsigned NOT NULL;
|
||||
|
|
|
@ -566,7 +566,6 @@ switch ($action) {
|
|||
$include_extended_events = $item['show_extended_events'];
|
||||
|
||||
$filter_search = $style['event_filter_search'];
|
||||
|
||||
break;
|
||||
|
||||
case 'event_report_group':
|
||||
|
@ -2784,8 +2783,21 @@ 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') {
|
||||
?>
|
||||
<th class="header sla_list_agent_secondary" scope="col">
|
||||
<?php
|
||||
echo __('Agent Secondary');
|
||||
?>
|
||||
</th>
|
||||
<th class="header sla_list_module_secondary" scope="col">
|
||||
<?php
|
||||
echo __('Module Secondary');
|
||||
?>
|
||||
</th>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<th class="header sla_list_service_col" scope="col">
|
||||
<?php
|
||||
echo __('Service');
|
||||
|
@ -2831,6 +2843,7 @@ function print_SLA_list($width, $action, $idItem=null)
|
|||
case 'update':
|
||||
case 'edit':
|
||||
echo '<tbody id="list_sla">';
|
||||
|
||||
$itemsSLA = db_get_all_rows_filter(
|
||||
'treport_content_sla_combined',
|
||||
['id_report_content' => $idItem]
|
||||
|
@ -2865,6 +2878,25 @@ 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
|
||||
) {
|
||||
$idAgentSecondary = db_get_value_filter(
|
||||
'id_agente',
|
||||
'tagente_modulo',
|
||||
['id_agente_modulo' => $item['id_agent_module_secondary']]
|
||||
);
|
||||
$nameAgentSecondary = agents_get_alias(
|
||||
$idAgentSecondary
|
||||
);
|
||||
|
||||
$nameModuleSecondary = db_get_value_filter(
|
||||
'nombre',
|
||||
'tagente_modulo',
|
||||
['id_agente_modulo' => $item['id_agent_module_secondary']]
|
||||
);
|
||||
}
|
||||
|
||||
$server_name_element = '';
|
||||
if ($meta && $server_name != '') {
|
||||
$server_name_element .= ' ('.$server_name.')';
|
||||
|
@ -2878,6 +2910,15 @@ 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;
|
||||
echo '</td>';
|
||||
echo '<td class="sla_list_module_secondary">';
|
||||
echo printSmallFont($nameModuleSecondary);
|
||||
echo '</td>';
|
||||
}
|
||||
|
||||
if (enterprise_installed()
|
||||
&& $report_item_type == 'SLA_services'
|
||||
) {
|
||||
|
@ -2926,6 +2967,13 @@ 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') {
|
||||
?>
|
||||
<td class="sla_list_agent_secondary agent_name_secondary"></td>
|
||||
<td class="sla_list_module_secondary module_name_secondary"></td>
|
||||
<?php
|
||||
}
|
||||
|
||||
if (enterprise_installed()
|
||||
&& $report_item_type == 'SLA_services'
|
||||
) {
|
||||
|
@ -2982,6 +3030,42 @@ function print_SLA_list($width, $action, $idItem=null)
|
|||
</select>
|
||||
</td>
|
||||
<?php
|
||||
if ($report_item_type == 'availability_graph') {
|
||||
?>
|
||||
<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">
|
||||
<?php
|
||||
$params = [];
|
||||
$params['show_helptip'] = true;
|
||||
$params['input_name'] = 'agent_secondary';
|
||||
$params['value'] = '';
|
||||
$params['use_hidden_input_idagent'] = true;
|
||||
$params['hidden_input_idagent_id'] = 'hidden-id_agent_secondary';
|
||||
$params['javascript_is_function_select'] = true;
|
||||
$params['selectbox_id'] = 'id_agent_module_secondary';
|
||||
$params['add_none_module'] = false;
|
||||
if ($meta) {
|
||||
$params['use_input_id_server'] = true;
|
||||
$params['input_id_server_id'] = 'hidden-id_server';
|
||||
$params['disabled_javascript_on_blur_function'] = true;
|
||||
}
|
||||
|
||||
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">
|
||||
<option value="0">
|
||||
<?php
|
||||
echo __('Select an Agent first');
|
||||
?>
|
||||
</option>
|
||||
</select>
|
||||
</td>
|
||||
<?php
|
||||
}
|
||||
|
||||
if (enterprise_installed()
|
||||
&& $report_item_type == 'SLA_services'
|
||||
) {
|
||||
|
@ -3002,23 +3086,23 @@ function print_SLA_list($width, $action, $idItem=null)
|
|||
],
|
||||
]
|
||||
);
|
||||
if (!empty($services_tmp)
|
||||
&& $services_tmp != ENTERPRISE_NOT_HOOK
|
||||
if (!empty($services_tmp)
|
||||
&& $services_tmp != ENTERPRISE_NOT_HOOK
|
||||
) {
|
||||
foreach ($services_tmp as $service) {
|
||||
$check_module_sla = modules_check_agentmodule_exists(
|
||||
$service['sla_id_module']
|
||||
);
|
||||
$check_module_sla_value = modules_check_agentmodule_exists(
|
||||
$service['sla_value_id_module']
|
||||
);
|
||||
if ($check_module_sla
|
||||
&& $check_module_sla_value
|
||||
) {
|
||||
foreach ($services_tmp as $service) {
|
||||
$check_module_sla = modules_check_agentmodule_exists(
|
||||
$service['sla_id_module']
|
||||
);
|
||||
$check_module_sla_value = modules_check_agentmodule_exists(
|
||||
$service['sla_value_id_module']
|
||||
);
|
||||
if ($check_module_sla
|
||||
&& $check_module_sla_value
|
||||
) {
|
||||
$services[$service['id']] = $service['name'];
|
||||
}
|
||||
}
|
||||
$services[$service['id']] = $service['name'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
echo '<td class="sla_list_service_col">';
|
||||
echo html_print_select(
|
||||
|
@ -3915,10 +3999,13 @@ function deleteGeneralRow(id_row) {
|
|||
|
||||
function addSLARow() {
|
||||
var nameAgent = $("input[name=agent_sla]").val();
|
||||
var nameAgentSecondary = $("input[name=agent_secondary]").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 nameModule = $("#id_agent_module_sla :selected").text();
|
||||
var nameModuleSecondary = $("#id_agent_module_secondary :selected").text();
|
||||
var slaMin = $("input[name=sla_min]").val();
|
||||
var slaMax = $("input[name=sla_max]").val();
|
||||
var slaLimit = $("input[name=sla_limit]").val();
|
||||
|
@ -3979,10 +4066,63 @@ function addSLARow() {
|
|||
});
|
||||
}
|
||||
|
||||
if (nameAgentSecondary != '') {
|
||||
//Truncate nameAgentSecondary
|
||||
var params = [];
|
||||
params.push("truncate_text=1");
|
||||
params.push("text=" + nameAgentSecondary);
|
||||
params.push("page=include/ajax/reporting.ajax");
|
||||
jQuery.ajax ({
|
||||
data: params.join ("&"),
|
||||
type: 'POST',
|
||||
url: action=
|
||||
<?php
|
||||
echo '"'.ui_get_full_url(
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false
|
||||
).'"';
|
||||
?>
|
||||
+ "/ajax.php",
|
||||
async: false,
|
||||
timeout: 10000,
|
||||
success: function (data) {
|
||||
nameAgentSecondary = data;
|
||||
}
|
||||
});
|
||||
|
||||
//Truncate nameModuleSecondary
|
||||
var params = [];
|
||||
params.push("truncate_text=1");
|
||||
params.push("text=" + nameModuleSecondary);
|
||||
params.push("page=include/ajax/reporting.ajax");
|
||||
jQuery.ajax ({
|
||||
data: params.join ("&"),
|
||||
type: 'POST',
|
||||
url: action=
|
||||
<?php
|
||||
echo '"'.ui_get_full_url(
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false
|
||||
).'"';
|
||||
?>
|
||||
+ "/ajax.php",
|
||||
async: false,
|
||||
timeout: 10000,
|
||||
success: function (data) {
|
||||
nameModuleSecondary = data;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var params = [];
|
||||
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("sla_min=" + slaMin);
|
||||
params.push("sla_max=" + slaMax);
|
||||
params.push("sla_limit=" + slaLimit);
|
||||
|
@ -4015,6 +4155,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);
|
||||
$(".service_name", row).html(serviceName);
|
||||
$(".sla_min", row).html(slaMin);
|
||||
$(".sla_max", row).html(slaMax);
|
||||
|
@ -4025,14 +4167,22 @@ function addSLARow() {
|
|||
);
|
||||
$("#list_sla").append($(row).html());
|
||||
$("input[name=id_agent_sla]").val('');
|
||||
$("input[name=id_agent_secondary]").val('');
|
||||
$("input[name=id_server]").val('');
|
||||
$("input[name=agent_sla]").val('');
|
||||
$("input[name=agent_secondary]").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(
|
||||
$("<option></option>")
|
||||
.attr ("value", 0)
|
||||
.html ($("#module_sla_text").html()));
|
||||
$("input[name=sla_min]").val('');
|
||||
$("input[name=sla_max]").val('');
|
||||
$("input[name=sla_limit]").val('');
|
||||
|
@ -4161,7 +4311,6 @@ function addGeneralRow() {
|
|||
success: function (data) {
|
||||
if (data['correct']) {
|
||||
row = $("#general_template").clone();
|
||||
|
||||
$("#row", row).show();
|
||||
$("#row", row).attr('id', 'general_' + data['id']);
|
||||
$(".agent_name", row).html(nameAgent);
|
||||
|
|
|
@ -65,6 +65,7 @@ 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_service = (int) get_parameter('id_service');
|
||||
if (empty($id_module) && !empty($id_service)) {
|
||||
|
@ -85,12 +86,13 @@ if ($add_sla) {
|
|||
$result = db_process_sql_insert(
|
||||
'treport_content_sla_combined',
|
||||
[
|
||||
'id_report_content' => $id,
|
||||
'id_agent_module' => $id_module,
|
||||
'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_secondary' => $id_module_secondary,
|
||||
'sla_max' => $sla_max,
|
||||
'sla_min' => $sla_min,
|
||||
'sla_limit' => $sla_limit,
|
||||
'server_name' => $connection['server_name'],
|
||||
]
|
||||
);
|
||||
|
||||
|
|
|
@ -134,6 +134,7 @@ if ($install_package) {
|
|||
|
||||
$accept = (bool) get_parameter('accept', false);
|
||||
if ($accept) {
|
||||
hd($accept, true);
|
||||
$package = (string) get_parameter('package');
|
||||
$package = trim($package);
|
||||
|
||||
|
@ -163,6 +164,7 @@ if ($install_package) {
|
|||
unlink($files_copied);
|
||||
}
|
||||
|
||||
|
||||
if (file_exists($package)) {
|
||||
if ($files_h = fopen($files_total, 'r')) {
|
||||
while ($line = stream_get_line($files_h, 65535, "\n")) {
|
||||
|
|
|
@ -1,20 +1,30 @@
|
|||
<?php
|
||||
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas
|
||||
// Please see http://pandorafms.org for full contribution list
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public License
|
||||
// as published by the Free Software Foundation; version 2
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
/**
|
||||
* @package Include
|
||||
* @subpackage Reporting
|
||||
* Extension to manage a list of gateways and the node address where they should
|
||||
* point to.
|
||||
*
|
||||
* @category Reporting
|
||||
* @package Pandora FMS
|
||||
* @subpackage Community
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
|
||||
* Please see http://pandorafms.org for full contribution list
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation for version 2.
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -38,9 +48,7 @@ require_once $config['homedir'].'/include/functions_netflow.php';
|
|||
require_once $config['homedir'].'/include/functions_os.php';
|
||||
require_once $config['homedir'].'/include/functions_network.php';
|
||||
|
||||
//
|
||||
// CONSTANTS DEFINITIONS //
|
||||
//
|
||||
// CONSTANTS DEFINITIONS.
|
||||
// Priority modes.
|
||||
define('REPORT_PRIORITY_MODE_OK', 1);
|
||||
define('REPORT_PRIORITY_MODE_UNKNOWN', 2);
|
||||
|
@ -6370,11 +6378,15 @@ function reporting_availability($report, $content, $date=false, $time=false)
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* reporting_availability_graph
|
||||
*
|
||||
* Generates a structure the report.
|
||||
*/
|
||||
/**
|
||||
* Reporting_availability_graph.
|
||||
*
|
||||
* @param array $report Info report.
|
||||
* @param array $content Content data.
|
||||
* @param boolean $pdf Output type PDF.
|
||||
*
|
||||
* @return array Generates a structure the report.
|
||||
*/
|
||||
function reporting_availability_graph($report, $content, $pdf=false)
|
||||
{
|
||||
global $config;
|
||||
|
@ -6393,7 +6405,7 @@ function reporting_availability_graph($report, $content, $pdf=false)
|
|||
$return['description'] = $content['description'];
|
||||
$return['date'] = reporting_get_date_text($report, $content);
|
||||
|
||||
// Get chart
|
||||
// Get chart.
|
||||
reporting_set_conf_charts(
|
||||
$width,
|
||||
$height,
|
||||
|
@ -6437,83 +6449,8 @@ function reporting_availability_graph($report, $content, $pdf=false)
|
|||
|
||||
foreach ($slas as $sla) {
|
||||
$server_name = $sla['server_name'];
|
||||
// Metaconsole connection
|
||||
if ($metaconsole_on && $server_name != '') {
|
||||
$connection = metaconsole_get_connection($server_name);
|
||||
if (!metaconsole_load_external_db($connection)) {
|
||||
// ui_print_error_message ("Error connecting to ".$server_name);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (modules_is_disable_agent($sla['id_agent_module'])
|
||||
|| modules_is_not_init($sla['id_agent_module'])
|
||||
) {
|
||||
if ($metaconsole_on) {
|
||||
// Restore db connection
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
// controller min and max == 0 then dinamic min and max critical
|
||||
$dinamic_text = 0;
|
||||
if ($sla['sla_min'] == 0 && $sla['sla_max'] == 0) {
|
||||
$sla['sla_min'] = null;
|
||||
$sla['sla_max'] = null;
|
||||
$dinamic_text = __('Dynamic');
|
||||
}
|
||||
|
||||
// controller inverse interval
|
||||
$inverse_interval = 0;
|
||||
if ((isset($sla['sla_max'])) && (isset($sla['sla_min']))) {
|
||||
if ($sla['sla_max'] < $sla['sla_min']) {
|
||||
$content_sla_max = $sla['sla_max'];
|
||||
$sla['sla_max'] = $sla['sla_min'];
|
||||
$sla['sla_min'] = $content_sla_max;
|
||||
$inverse_interval = 1;
|
||||
$dinamic_text = __('Inverse');
|
||||
}
|
||||
}
|
||||
|
||||
// for graph slice for module-interval, if not slice=0;
|
||||
$module_interval = modules_get_interval($sla['id_agent_module']);
|
||||
$slice = ($content['period'] / $module_interval);
|
||||
|
||||
// call functions sla
|
||||
$sla_array = [];
|
||||
$sla_array = reporting_advanced_sla(
|
||||
$sla['id_agent_module'],
|
||||
($report['datetime'] - $content['period']),
|
||||
$report['datetime'],
|
||||
$sla['sla_min'],
|
||||
// min_value -> dynamic
|
||||
$sla['sla_max'],
|
||||
// max_value -> dynamic
|
||||
$inverse_interval,
|
||||
// inverse_interval -> dynamic
|
||||
[
|
||||
'1' => $content['sunday'],
|
||||
'2' => $content['monday'],
|
||||
'3' => $content['tuesday'],
|
||||
'4' => $content['wednesday'],
|
||||
'5' => $content['thursday'],
|
||||
'6' => $content['friday'],
|
||||
'7' => $content['saturday'],
|
||||
],
|
||||
$content['time_from'],
|
||||
$content['time_to'],
|
||||
$slice
|
||||
);
|
||||
|
||||
if ($metaconsole_on) {
|
||||
// Restore db connection
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
|
||||
$server_name = $sla['server_name'];
|
||||
// Metaconsole connection
|
||||
// Metaconsole connection.
|
||||
if ($metaconsole_on && $server_name != '') {
|
||||
$connection = metaconsole_get_connection($server_name);
|
||||
if (metaconsole_connect($connection) != NOERR) {
|
||||
|
@ -6521,199 +6458,118 @@ function reporting_availability_graph($report, $content, $pdf=false)
|
|||
}
|
||||
}
|
||||
|
||||
$planned_downtimes = reporting_get_planned_downtimes_intervals($sla['id_agent_module'], ($report['datetime'] - $content['period']), $report['datetime']);
|
||||
if (isset($sla['id_agent_module_secondary']) === true
|
||||
&& $sla['id_agent_module_secondary'] != 0
|
||||
) {
|
||||
$sla_secondary['primary'] = $sla;
|
||||
$sla_secondary['failover'] = $sla;
|
||||
$sla_secondary['failover']['id_agent_module'] = $sla['id_agent_module_secondary'];
|
||||
|
||||
if ((is_array($planned_downtimes)) && (count($planned_downtimes) > 0)) {
|
||||
// Sort retrieved planned downtimes
|
||||
usort(
|
||||
$planned_downtimes,
|
||||
function ($a, $b) {
|
||||
$a = intval($a['date_from']);
|
||||
$b = intval($b['date_from']);
|
||||
if ($a == $b) {
|
||||
return 0;
|
||||
}
|
||||
// For graph slice for module-interval, if not slice=0.
|
||||
$module_interval = modules_get_interval($sla['id_agent_module']);
|
||||
$slice = ($content['period'] / $module_interval);
|
||||
|
||||
return ($a < $b) ? -1 : 1;
|
||||
}
|
||||
foreach ($sla_secondary as $k_sla => $v_sla) {
|
||||
$sla_array = data_db_uncompress_module(
|
||||
$v_sla,
|
||||
$content,
|
||||
$report['datetime'],
|
||||
$slice
|
||||
);
|
||||
|
||||
$return = prepare_data_for_paint(
|
||||
$v_sla,
|
||||
$sla_array,
|
||||
$content,
|
||||
$report['datetime'],
|
||||
$return,
|
||||
$k_sla
|
||||
);
|
||||
|
||||
$data_combined[] = $sla_array;
|
||||
}
|
||||
|
||||
if (isset($data_combined) === true
|
||||
&& is_array($data_combined) === true
|
||||
&& count($data_combined) > 0
|
||||
) {
|
||||
$data_a = array_map(
|
||||
function ($primary, $failover) {
|
||||
if ($primary['date_from'] === $failover['date_from']
|
||||
&& $primary['date_to'] === $failover['date_to']
|
||||
) {
|
||||
if ($primary['sla_fixed'] !== 100
|
||||
&& $primary['sla_fixed'] < $failover['sla_fixed']
|
||||
) {
|
||||
$primary['time_total'] = $failover['time_total'];
|
||||
$primary['time_ok'] = $failover['time_ok'];
|
||||
$primary['time_error'] = $failover['time_error'];
|
||||
$primary['time_unknown'] = $failover['time_unknown'];
|
||||
$primary['time_not_init'] = $failover['time_not_init'];
|
||||
$primary['time_downtime'] = $failover['time_downtime'];
|
||||
$primary['time_out'] = $failover['time_out'];
|
||||
$primary['checks_total'] = $failover['checks_total'];
|
||||
$primary['checks_ok'] = $failover['checks_ok'];
|
||||
$primary['checks_error'] = $failover['checks_error'];
|
||||
$primary['checks_unknown'] = $failover['checks_unknown'];
|
||||
$primary['checks_not_init'] = $failover['checks_not_init'];
|
||||
$primary['SLA'] = $failover['SLA'];
|
||||
$primary['sla_fixed'] = $failover['sla_fixed'];
|
||||
}
|
||||
|
||||
$return = $primary;
|
||||
}
|
||||
|
||||
return $return;
|
||||
},
|
||||
$data_combined[0],
|
||||
$data_combined[1]
|
||||
);
|
||||
|
||||
$return = prepare_data_for_paint(
|
||||
$sla,
|
||||
$data_a,
|
||||
$content,
|
||||
$report['datetime'],
|
||||
$return,
|
||||
'result'
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$sla_array = data_db_uncompress_module(
|
||||
$sla,
|
||||
$content,
|
||||
$report['datetime']
|
||||
);
|
||||
|
||||
// Compress (overlapped) planned downtimes
|
||||
$npd = count($planned_downtimes);
|
||||
for ($i = 0; $i < $npd; $i++) {
|
||||
if (isset($planned_downtimes[($i + 1)])) {
|
||||
if ($planned_downtimes[$i]['date_to'] >= $planned_downtimes[($i + 1)]['date_from']) {
|
||||
// merge
|
||||
$planned_downtimes[$i]['date_to'] = $planned_downtimes[($i + 1)]['date_to'];
|
||||
array_splice($planned_downtimes, ($i + 1), 1);
|
||||
$npd--;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$planned_downtimes = null;
|
||||
$return = prepare_data_for_paint(
|
||||
$sla,
|
||||
$sla_array,
|
||||
$content,
|
||||
$report['datetime'],
|
||||
$return
|
||||
);
|
||||
}
|
||||
|
||||
$data = [];
|
||||
$data['agent'] = modules_get_agentmodule_agent_alias($sla['id_agent_module']);
|
||||
$data['module'] = modules_get_agentmodule_name($sla['id_agent_module']);
|
||||
$data['max'] = $sla['sla_max'];
|
||||
$data['min'] = $sla['sla_min'];
|
||||
$data['sla_limit'] = $sla['sla_limit'];
|
||||
$data['dinamic_text'] = $dinamic_text;
|
||||
|
||||
if (isset($sla_array[0])) {
|
||||
$data['time_total'] = 0;
|
||||
$data['time_ok'] = 0;
|
||||
$data['time_error'] = 0;
|
||||
$data['time_unknown'] = 0;
|
||||
$data['time_not_init'] = 0;
|
||||
$data['time_downtime'] = 0;
|
||||
$data['checks_total'] = 0;
|
||||
$data['checks_ok'] = 0;
|
||||
$data['checks_error'] = 0;
|
||||
$data['checks_unknown'] = 0;
|
||||
$data['checks_not_init'] = 0;
|
||||
|
||||
$raw_graph = [];
|
||||
$i = 0;
|
||||
foreach ($sla_array as $value_sla) {
|
||||
$data['time_total'] += $value_sla['time_total'];
|
||||
$data['time_ok'] += $value_sla['time_ok'];
|
||||
$data['time_error'] += $value_sla['time_error'];
|
||||
$data['time_unknown'] += $value_sla['time_unknown'];
|
||||
$data['time_downtime'] += $value_sla['time_downtime'];
|
||||
$data['time_not_init'] += $value_sla['time_not_init'];
|
||||
$data['checks_total'] += $value_sla['checks_total'];
|
||||
$data['checks_ok'] += $value_sla['checks_ok'];
|
||||
$data['checks_error'] += $value_sla['checks_error'];
|
||||
$data['checks_unknown'] += $value_sla['checks_unknown'];
|
||||
$data['checks_not_init'] += $value_sla['checks_not_init'];
|
||||
|
||||
// generate raw data for graph
|
||||
$period = reporting_sla_get_status_period($value_sla, $priority_mode);
|
||||
$raw_graph[$i]['data'] = reporting_translate_sla_status_for_graph($period);
|
||||
$raw_graph[$i]['utimestamp'] = ($value_sla['date_to'] - $value_sla['date_from']);
|
||||
$i++;
|
||||
}
|
||||
|
||||
$data['sla_value'] = reporting_sla_get_compliance_from_array($data);
|
||||
$data['sla_fixed'] = sla_truncate($data['sla_value'], $config['graph_precision']);
|
||||
} else {
|
||||
// Show only table not divider in slice for defect slice=1
|
||||
$data['time_total'] = $sla_array['time_total'];
|
||||
$data['time_ok'] = $sla_array['time_ok'];
|
||||
$data['time_error'] = $sla_array['time_error'];
|
||||
$data['time_unknown'] = $sla_array['time_unknown'];
|
||||
$data['time_downtime'] = $sla_array['time_downtime'];
|
||||
$data['time_not_init'] = $sla_array['time_not_init'];
|
||||
$data['checks_total'] = $sla_array['checks_total'];
|
||||
$data['checks_ok'] = $sla_array['checks_ok'];
|
||||
$data['checks_error'] = $sla_array['checks_error'];
|
||||
$data['checks_unknown'] = $sla_array['checks_unknown'];
|
||||
$data['checks_not_init'] = $sla_array['checks_not_init'];
|
||||
$data['sla_value'] = $sla_array['SLA'];
|
||||
}
|
||||
|
||||
// checks whether or not it meets the SLA
|
||||
if ($data['sla_value'] >= $sla['sla_limit']) {
|
||||
$data['sla_status'] = 1;
|
||||
$sla_failed = false;
|
||||
} else {
|
||||
$sla_failed = true;
|
||||
$data['sla_status'] = 0;
|
||||
}
|
||||
|
||||
// Do not show right modules if 'only_display_wrong' is active
|
||||
if ($content['only_display_wrong'] && $sla_failed == false) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// find order
|
||||
$data['order'] = $data['sla_value'];
|
||||
$return['data'][] = $data;
|
||||
|
||||
$data_init = -1;
|
||||
$acum = 0;
|
||||
$sum = 0;
|
||||
$array_result = [];
|
||||
$i = 0;
|
||||
foreach ($raw_graph as $key => $value) {
|
||||
if ($data_init == -1) {
|
||||
$data_init = $value['data'];
|
||||
$acum = $value['utimestamp'];
|
||||
$sum = $value['data'];
|
||||
} else {
|
||||
if ($data_init == $value['data']) {
|
||||
$acum = ($acum + $value['utimestamp']);
|
||||
$sum = ($sum + $value['real_data']);
|
||||
} else {
|
||||
$array_result[$i]['data'] = $data_init;
|
||||
$array_result[$i]['utimestamp'] = $acum;
|
||||
$array_result[$i]['real_data'] = $sum;
|
||||
$i++;
|
||||
$data_init = $value['data'];
|
||||
$acum = $value['utimestamp'];
|
||||
$sum = $value['real_data'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$array_result[$i]['data'] = $data_init;
|
||||
$array_result[$i]['utimestamp'] = $acum;
|
||||
$array_result[$i]['real_data'] = $sum;
|
||||
|
||||
// Slice graphs calculation
|
||||
$dataslice = [];
|
||||
$dataslice['agent'] = modules_get_agentmodule_agent_alias($sla['id_agent_module']);
|
||||
$dataslice['module'] = modules_get_agentmodule_name($sla['id_agent_module']);
|
||||
$dataslice['order'] = $data['sla_value'];
|
||||
$dataslice['checks_total'] = $data['checks_total'];
|
||||
$dataslice['checks_ok'] = $data['checks_ok'];
|
||||
$dataslice['time_total'] = $data['time_total'];
|
||||
$dataslice['time_not_init'] = $data['time_not_init'];
|
||||
$dataslice['sla_status'] = $data['sla_status'];
|
||||
$dataslice['sla_value'] = $data['sla_value'];
|
||||
|
||||
$dataslice['chart'] = graph_sla_slicebar(
|
||||
$sla['id_agent_module'],
|
||||
$content['period'],
|
||||
$sla['sla_min'],
|
||||
$sla['sla_max'],
|
||||
$report['datetime'],
|
||||
$content,
|
||||
$content['time_from'],
|
||||
$content['time_to'],
|
||||
100,
|
||||
70,
|
||||
$urlImage,
|
||||
$ttl,
|
||||
$array_result,
|
||||
false
|
||||
);
|
||||
|
||||
$return['charts'][] = $dataslice;
|
||||
|
||||
if ($metaconsole_on) {
|
||||
// Restore db connection
|
||||
// Restore db connection.
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
}
|
||||
|
||||
// SLA items sorted descending ()
|
||||
// SLA items sorted descending.
|
||||
if ($content['top_n'] == 2) {
|
||||
arsort($return['data']['']);
|
||||
}
|
||||
// SLA items sorted ascending
|
||||
else if ($content['top_n'] == 1) {
|
||||
} else if ($content['top_n'] == 1) {
|
||||
// SLA items sorted ascending.
|
||||
asort($sla_showed_values);
|
||||
}
|
||||
|
||||
// order data for ascending or descending
|
||||
// Order data for ascending or descending.
|
||||
if ($content['top_n'] != 0) {
|
||||
switch ($content['top_n']) {
|
||||
case 1:
|
||||
// order tables
|
||||
// Order tables.
|
||||
$temp = [];
|
||||
foreach ($return['data'] as $row) {
|
||||
$i = 0;
|
||||
|
@ -6730,7 +6586,7 @@ function reporting_availability_graph($report, $content, $pdf=false)
|
|||
|
||||
$return['data'] = $temp;
|
||||
|
||||
// order graphs
|
||||
// Order graphs.
|
||||
$temp = [];
|
||||
foreach ($return['charts'] as $row) {
|
||||
$i = 0;
|
||||
|
@ -6746,11 +6602,10 @@ function reporting_availability_graph($report, $content, $pdf=false)
|
|||
}
|
||||
|
||||
$return['charts'] = $temp;
|
||||
|
||||
break;
|
||||
|
||||
case 2:
|
||||
// order tables
|
||||
// Order tables.
|
||||
$temp = [];
|
||||
foreach ($return['data'] as $row) {
|
||||
$i = 0;
|
||||
|
@ -6767,7 +6622,7 @@ function reporting_availability_graph($report, $content, $pdf=false)
|
|||
|
||||
$return['data'] = $temp;
|
||||
|
||||
// order graph
|
||||
// Order graph.
|
||||
$temp = [];
|
||||
foreach ($return['charts'] as $row) {
|
||||
$i = 0;
|
||||
|
@ -6783,7 +6638,10 @@ function reporting_availability_graph($report, $content, $pdf=false)
|
|||
}
|
||||
|
||||
$return['charts'] = $temp;
|
||||
break;
|
||||
|
||||
default:
|
||||
// If not posible.
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -6793,6 +6651,311 @@ function reporting_availability_graph($report, $content, $pdf=false)
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return data db uncompress for module.
|
||||
*
|
||||
* @param array $sla Data neccesary for db_uncompress.
|
||||
* @param array $content Conetent report.
|
||||
* @param array $datetime Date.
|
||||
* @param integer $slice Defined slice.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function data_db_uncompress_module($sla, $content, $datetime, $slice=0)
|
||||
{
|
||||
// Controller min and max == 0 then dinamic min and max critical.
|
||||
$dinamic_text = 0;
|
||||
if ($sla['sla_min'] == 0 && $sla['sla_max'] == 0) {
|
||||
$sla['sla_min'] = null;
|
||||
$sla['sla_max'] = null;
|
||||
$dinamic_text = __('Dynamic');
|
||||
}
|
||||
|
||||
// Controller inverse interval.
|
||||
$inverse_interval = 0;
|
||||
if ((isset($sla['sla_max'])) && (isset($sla['sla_min']))) {
|
||||
if ($sla['sla_max'] < $sla['sla_min']) {
|
||||
$content_sla_max = $sla['sla_max'];
|
||||
$sla['sla_max'] = $sla['sla_min'];
|
||||
$sla['sla_min'] = $content_sla_max;
|
||||
$inverse_interval = 1;
|
||||
$dinamic_text = __('Inverse');
|
||||
}
|
||||
}
|
||||
|
||||
if ($slice === 0) {
|
||||
// For graph slice for module-interval, if not slice=0.
|
||||
$module_interval = modules_get_interval($sla['id_agent_module']);
|
||||
$slice = ($content['period'] / $module_interval);
|
||||
}
|
||||
|
||||
// Call functions sla.
|
||||
$sla_array = [];
|
||||
$sla_array = reporting_advanced_sla(
|
||||
$sla['id_agent_module'],
|
||||
($datetime - $content['period']),
|
||||
$datetime,
|
||||
$sla['sla_min'],
|
||||
$sla['sla_max'],
|
||||
$inverse_interval,
|
||||
[
|
||||
'1' => $content['sunday'],
|
||||
'2' => $content['monday'],
|
||||
'3' => $content['tuesday'],
|
||||
'4' => $content['wednesday'],
|
||||
'5' => $content['thursday'],
|
||||
'6' => $content['friday'],
|
||||
'7' => $content['saturday'],
|
||||
],
|
||||
$content['time_from'],
|
||||
$content['time_to'],
|
||||
$slice
|
||||
);
|
||||
|
||||
return $sla_array;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return array planned downtimes.
|
||||
*
|
||||
* @param integer $id_agent_module Id module.
|
||||
* @param integer $datetime Date utimestamp.
|
||||
* @param integer $period Period utimestamp.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function reporting_get_planned_downtimes_sla($id_agent_module, $datetime, $period)
|
||||
{
|
||||
$planned_downtimes = reporting_get_planned_downtimes_intervals(
|
||||
$id_agent_module,
|
||||
($datetime - $period),
|
||||
$datetime
|
||||
);
|
||||
|
||||
if ((is_array($planned_downtimes))
|
||||
&& (count($planned_downtimes) > 0)
|
||||
) {
|
||||
// Sort retrieved planned downtimes.
|
||||
usort(
|
||||
$planned_downtimes,
|
||||
function ($a, $b) {
|
||||
$a = intval($a['date_from']);
|
||||
$b = intval($b['date_from']);
|
||||
if ($a == $b) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return ($a < $b) ? (-1) : 1;
|
||||
}
|
||||
);
|
||||
|
||||
// Compress (overlapped) planned downtimes.
|
||||
$npd = count($planned_downtimes);
|
||||
for ($i = 0; $i < $npd; $i++) {
|
||||
if (isset($planned_downtimes[($i + 1)])) {
|
||||
if ($planned_downtimes[$i]['date_to'] >= $planned_downtimes[($i + 1)]['date_from']) {
|
||||
// Merge.
|
||||
$planned_downtimes[$i]['date_to'] = $planned_downtimes[($i + 1)]['date_to'];
|
||||
array_splice($planned_downtimes, ($i + 1), 1);
|
||||
$npd--;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$planned_downtimes = [];
|
||||
}
|
||||
|
||||
return $planned_downtimes;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Prepare data for Paint in report.
|
||||
*
|
||||
* @param array $sla Data Module to sla.
|
||||
* @param array $sla_array Data uncompressed.
|
||||
* @param array $content Content report data.
|
||||
* @param integer $datetime Date.
|
||||
* @param array $return Array return.
|
||||
* @param string $secondary Type secondaary primary, failover, Result.
|
||||
*
|
||||
* @return array Return modify.
|
||||
*/
|
||||
function prepare_data_for_paint(
|
||||
$sla,
|
||||
$sla_array,
|
||||
$content,
|
||||
$datetime,
|
||||
$return,
|
||||
$secondary=''
|
||||
) {
|
||||
$data = [];
|
||||
$alias_agent = modules_get_agentmodule_agent_alias(
|
||||
$sla['id_agent_module']
|
||||
);
|
||||
$name_module = modules_get_agentmodule_name(
|
||||
$sla['id_agent_module']
|
||||
);
|
||||
|
||||
$data['agent'] = $alias_agent;
|
||||
$data['module'] = $name_module;
|
||||
$data['max'] = $sla['sla_max'];
|
||||
$data['min'] = $sla['sla_min'];
|
||||
$data['sla_limit'] = $sla['sla_limit'];
|
||||
$data['dinamic_text'] = $dinamic_text;
|
||||
$data['secondary'] = $secondary;
|
||||
if (isset($sla_array[0])) {
|
||||
$data['time_total'] = 0;
|
||||
$data['time_ok'] = 0;
|
||||
$data['time_error'] = 0;
|
||||
$data['time_unknown'] = 0;
|
||||
$data['time_not_init'] = 0;
|
||||
$data['time_downtime'] = 0;
|
||||
$data['checks_total'] = 0;
|
||||
$data['checks_ok'] = 0;
|
||||
$data['checks_error'] = 0;
|
||||
$data['checks_unknown'] = 0;
|
||||
$data['checks_not_init'] = 0;
|
||||
|
||||
$raw_graph = [];
|
||||
$i = 0;
|
||||
foreach ($sla_array as $value_sla) {
|
||||
$data['time_total'] += $value_sla['time_total'];
|
||||
$data['time_ok'] += $value_sla['time_ok'];
|
||||
$data['time_error'] += $value_sla['time_error'];
|
||||
$data['time_unknown'] += $value_sla['time_unknown'];
|
||||
$data['time_downtime'] += $value_sla['time_downtime'];
|
||||
$data['time_not_init'] += $value_sla['time_not_init'];
|
||||
$data['checks_total'] += $value_sla['checks_total'];
|
||||
$data['checks_ok'] += $value_sla['checks_ok'];
|
||||
$data['checks_error'] += $value_sla['checks_error'];
|
||||
$data['checks_unknown'] += $value_sla['checks_unknown'];
|
||||
$data['checks_not_init'] += $value_sla['checks_not_init'];
|
||||
|
||||
// Generate raw data for graph.
|
||||
$period = reporting_sla_get_status_period(
|
||||
$value_sla,
|
||||
$priority_mode
|
||||
);
|
||||
$raw_graph[$i]['data'] = reporting_translate_sla_status_for_graph(
|
||||
$period
|
||||
);
|
||||
$raw_graph[$i]['utimestamp'] = ($value_sla['date_to'] - $value_sla['date_from']);
|
||||
$i++;
|
||||
}
|
||||
|
||||
$data['sla_value'] = reporting_sla_get_compliance_from_array(
|
||||
$data
|
||||
);
|
||||
$data['sla_fixed'] = sla_truncate(
|
||||
$data['sla_value'],
|
||||
$config['graph_precision']
|
||||
);
|
||||
} else {
|
||||
// Show only table not divider in slice for defect slice=1.
|
||||
$data['time_total'] = $sla_array['time_total'];
|
||||
$data['time_ok'] = $sla_array['time_ok'];
|
||||
$data['time_error'] = $sla_array['time_error'];
|
||||
$data['time_unknown'] = $sla_array['time_unknown'];
|
||||
$data['time_downtime'] = $sla_array['time_downtime'];
|
||||
$data['time_not_init'] = $sla_array['time_not_init'];
|
||||
$data['checks_total'] = $sla_array['checks_total'];
|
||||
$data['checks_ok'] = $sla_array['checks_ok'];
|
||||
$data['checks_error'] = $sla_array['checks_error'];
|
||||
$data['checks_unknown'] = $sla_array['checks_unknown'];
|
||||
$data['checks_not_init'] = $sla_array['checks_not_init'];
|
||||
$data['sla_value'] = $sla_array['SLA'];
|
||||
}
|
||||
|
||||
// Checks whether or not it meets the SLA.
|
||||
if ($data['sla_value'] >= $sla['sla_limit']) {
|
||||
$data['sla_status'] = 1;
|
||||
$sla_failed = false;
|
||||
} else {
|
||||
$sla_failed = true;
|
||||
$data['sla_status'] = 0;
|
||||
}
|
||||
|
||||
// Do not show right modules if 'only_display_wrong' is active.
|
||||
if ($content['only_display_wrong'] && $sla_failed == false) {
|
||||
return $return;
|
||||
}
|
||||
|
||||
// Find order.
|
||||
$data['order'] = $data['sla_value'];
|
||||
$return['data'][] = $data;
|
||||
|
||||
$data_init = -1;
|
||||
$acum = 0;
|
||||
$sum = 0;
|
||||
$array_result = [];
|
||||
$i = 0;
|
||||
foreach ($raw_graph as $key => $value) {
|
||||
if ($data_init == -1) {
|
||||
$data_init = $value['data'];
|
||||
$acum = $value['utimestamp'];
|
||||
$sum = $value['data'];
|
||||
} else {
|
||||
if ($data_init == $value['data']) {
|
||||
$acum = ($acum + $value['utimestamp']);
|
||||
$sum = ($sum + $value['real_data']);
|
||||
} else {
|
||||
$array_result[$i]['data'] = $data_init;
|
||||
$array_result[$i]['utimestamp'] = $acum;
|
||||
$array_result[$i]['real_data'] = $sum;
|
||||
$i++;
|
||||
$data_init = $value['data'];
|
||||
$acum = $value['utimestamp'];
|
||||
$sum = $value['real_data'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$array_result[$i]['data'] = $data_init;
|
||||
$array_result[$i]['utimestamp'] = $acum;
|
||||
$array_result[$i]['real_data'] = $sum;
|
||||
|
||||
// Slice graphs calculation.
|
||||
$dataslice = [];
|
||||
$dataslice['agent'] = $alias_agent;
|
||||
$dataslice['module'] = $name_module;
|
||||
$dataslice['order'] = $data['sla_value'];
|
||||
$dataslice['checks_total'] = $data['checks_total'];
|
||||
$dataslice['checks_ok'] = $data['checks_ok'];
|
||||
$dataslice['time_total'] = $data['time_total'];
|
||||
$dataslice['time_not_init'] = $data['time_not_init'];
|
||||
$dataslice['sla_status'] = $data['sla_status'];
|
||||
$dataslice['sla_value'] = $data['sla_value'];
|
||||
|
||||
$height = 80;
|
||||
if ($secondary !== '' && $secondary !== 'result') {
|
||||
$height = 50;
|
||||
}
|
||||
|
||||
$dataslice['chart'] = graph_sla_slicebar(
|
||||
$sla['id_agent_module'],
|
||||
$content['period'],
|
||||
$sla['sla_min'],
|
||||
$sla['sla_max'],
|
||||
$datetime,
|
||||
$content,
|
||||
$content['time_from'],
|
||||
$content['time_to'],
|
||||
100,
|
||||
$height,
|
||||
$urlImage,
|
||||
$ttl,
|
||||
$array_result,
|
||||
false
|
||||
);
|
||||
|
||||
$return['charts'][] = $dataslice;
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* reporting_increment
|
||||
*
|
||||
|
|
|
@ -3252,15 +3252,7 @@ function reporting_html_availability_graph($table, $item, $pdf=0)
|
|||
|
||||
$tables_chart = '';
|
||||
|
||||
$table1 = new stdClass();
|
||||
$table1->width = '99%';
|
||||
$table1->data = [];
|
||||
$table1->size = [];
|
||||
$table1->size[0] = '10%';
|
||||
$table1->size[1] = '80%';
|
||||
$table1->size[2] = '5%';
|
||||
$table1->size[3] = '5%';
|
||||
foreach ($item['charts'] as $chart) {
|
||||
foreach ($item['charts'] as $k_chart => $chart) {
|
||||
$checks_resume = '';
|
||||
$sla_value = '';
|
||||
if (reporting_sla_is_not_init_from_array($chart)) {
|
||||
|
@ -3291,14 +3283,74 @@ function reporting_html_availability_graph($table, $item, $pdf=0)
|
|||
$checks_resume = '('.$chart['checks_ok'].'/'.$chart['checks_total'].')';
|
||||
}
|
||||
|
||||
$table1->data[0][0] = $chart['agent'].'<br />'.$chart['module'];
|
||||
$table1->data[0][1] = $chart['chart'];
|
||||
$table1->data[0][2] = "<span style = 'font: bold 2em Arial, Sans-serif; color: ".$color."'>".$sla_value.'</span>';
|
||||
$table1->data[0][3] = $checks_resume;
|
||||
$tables_chart .= html_print_table(
|
||||
$table1,
|
||||
true
|
||||
);
|
||||
// Check failover availability report.
|
||||
if ($item['data'][$k_chart]['secondary'] === '') {
|
||||
$table1 = new stdClass();
|
||||
$table1->width = '99%';
|
||||
$table1->data = [];
|
||||
$table1->size = [];
|
||||
$table1->size[0] = '10%';
|
||||
$table1->size[1] = '80%';
|
||||
$table1->size[2] = '5%';
|
||||
$table1->size[3] = '5%';
|
||||
$table1->data[0][0] = $chart['agent'].'<br />'.$chart['module'];
|
||||
$table1->data[0][1] = $chart['chart'];
|
||||
$table1->data[0][2] = "<span style = 'font: bold 2em Arial, Sans-serif; color: ".$color."'>".$sla_value.'</span>';
|
||||
$table1->data[0][3] = $checks_resume;
|
||||
$tables_chart .= html_print_table(
|
||||
$table1,
|
||||
true
|
||||
);
|
||||
} else {
|
||||
if ($item['data'][$k_chart]['secondary'] === 'primary') {
|
||||
$table1 = new stdClass();
|
||||
$table1->width = '99%';
|
||||
$table1->data = [];
|
||||
$table1->size = [];
|
||||
$table1->size[0] = '10%';
|
||||
$table1->size[1] = '80%';
|
||||
$table1->size[2] = '5%';
|
||||
$table1->size[3] = '5%';
|
||||
}
|
||||
|
||||
$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']) {
|
||||
case 'primary':
|
||||
$title = '<b>'.__('Primary').'</b>';
|
||||
$title .= '<br />'.$chart['agent'];
|
||||
$title .= '<br />'.$chart['module'];
|
||||
break;
|
||||
|
||||
case 'failover':
|
||||
$title = '<b>'.__('Failover').'</b>';
|
||||
$title .= '<br />'.$chart['agent'];
|
||||
$title .= '<br />'.$chart['module'];
|
||||
break;
|
||||
|
||||
case 'result':
|
||||
default:
|
||||
$title = '<b>'.__('Result').'</b>';
|
||||
$sla_value_text = "<span style = 'font: bold 3em Arial, Sans-serif; color: ".$color."'>".$sla_value.'</span>';
|
||||
$checks_resume_text = '<span style = "font-size: 12pt;">';
|
||||
$checks_resume_text .= $checks_resume;
|
||||
$checks_resume_text .= '</span>';
|
||||
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;
|
||||
|
||||
if ($item['data'][$k_chart]['secondary'] === 'result') {
|
||||
$tables_chart .= html_print_table(
|
||||
$table1,
|
||||
true
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($item['type'] == 'availability_graph') {
|
||||
|
|
|
@ -1464,6 +1464,7 @@ 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,
|
||||
`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,
|
||||
|
|
|
@ -114,10 +114,10 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES
|
|||
('custom_report_front_logo', 'images/pandora_logo_white.jpg'),
|
||||
('custom_report_front_header', ''),
|
||||
('custom_report_front_footer', ''),
|
||||
('MR', 29),
|
||||
('MR', 30),
|
||||
('identification_reminder', 1),
|
||||
('identification_reminder_timestamp', 0),
|
||||
('current_package_enterprise', '736'),
|
||||
('current_package_enterprise', '737'),
|
||||
('post_process_custom_values', '{"0.00000038580247":"Seconds to months","0.00000165343915":"Seconds to weeks","0.00001157407407":"Seconds to days","0.01666666666667":"Seconds to minutes","0.00000000093132":"Bytes to Gigabytes","0.00000095367432":"Bytes to Megabytes","0.0009765625":"Bytes to Kilobytes","0.00000001653439":"Timeticks to weeks","0.00000011574074":"Timeticks to days"}'),
|
||||
('custom_docs_logo', 'default_docs.png'),
|
||||
('custom_support_logo', 'default_support.png'),
|
||||
|
|
Loading…
Reference in New Issue