diff --git a/pandora_console/extras/mr/35.sql b/pandora_console/extras/mr/35.sql
index e540b29bef..94580edb15 100644
--- a/pandora_console/extras/mr/35.sql
+++ b/pandora_console/extras/mr/35.sql
@@ -4,5 +4,6 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_module_units', '{"bytes
ALTER TABLE `tserver` ADD COLUMN `port` int(5) unsigned NOT NULL default 0;
ALTER TABLE `tmap` ADD COLUMN `id_group_map` INT(10) UNSIGNED NOT NULL default 0;
ALTER TABLE `tevent_filter` MODIFY `severity` TEXT NOT NULL;
+ALTER TABLE `treport_content_item` ADD `id_agent_module_failover` int(10) unsigned NOT NULL DEFAULT 0;
COMMIT;
diff --git a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql
index 009fe931b4..95a0e4ba80 100644
--- a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql
+++ b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql
@@ -2437,6 +2437,21 @@ CREATE TABLE `tagent_repository` (
ON UPDATE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+-- ----------------------------------------------------------------------
+-- Table `treport_content_item`
+-- ----------------------------------------------------------------------
+CREATE TABLE IF NOT EXISTS `treport_content_item` (
+ `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_failover` int(10) unsigned NOT NULL DEFAULT 0,
+ `server_name` text,
+ `operation` text,
+ PRIMARY KEY(`id`),
+ FOREIGN KEY (`id_report_content`) REFERENCES treport_content(`id_rc`)
+ ON UPDATE CASCADE ON DELETE CASCADE
+) ENGINE = InnoDB DEFAULT CHARSET=utf8;
+
-- ----------------------------------------------------------------------
-- Table `tdeployment_hosts`
-- ----------------------------------------------------------------------
diff --git a/pandora_console/general/header.php b/pandora_console/general/header.php
index b0bc0bf1d1..8a29ff44a3 100644
--- a/pandora_console/general/header.php
+++ b/pandora_console/general/header.php
@@ -703,8 +703,7 @@ if ($config['menu_type'] == 'classic') {
},
success: function (data) {
$('#result_order').html(data);
- console.log(data);
- },
+ },
error: function (data) {
console.error("Fatal error in AJAX call to interpreter order", data)
}
diff --git a/pandora_console/godmode/reporting/reporting_builder.item_editor.php b/pandora_console/godmode/reporting/reporting_builder.item_editor.php
index 3e216679d6..daf5a39ca8 100755
--- a/pandora_console/godmode/reporting/reporting_builder.item_editor.php
+++ b/pandora_console/godmode/reporting/reporting_builder.item_editor.php
@@ -628,6 +628,8 @@ switch ($action) {
$unknown_checks = $item['unknown_checks'];
$agent_max_value = $item['agent_max_value'];
$agent_min_value = $item['agent_min_value'];
+ $failover_mode = $item['failover_mode'];
+ $failover_type = $item['failover_type'];
break;
case 'group_report':
@@ -3263,6 +3265,13 @@ function print_General_list($width, $action, $idItem=null, $type='general')
$meta = false;
}
+ $failover_mode = db_get_value(
+ 'failover_mode',
+ 'treport_content',
+ 'id_rc',
+ $idItem
+ );
+
$operation = [
'avg' => __('rate'),
'max' => __('max'),
@@ -3284,6 +3293,18 @@ function print_General_list($width, $action, $idItem=null, $type='general')
+
+
+
+
@@ -3365,19 +3386,50 @@ function print_General_list($width, $action, $idItem=null, $type='general')
['id_agente_modulo' => $item['id_agent_module']]
);
+ if (isset($item['id_agent_module_failover']) === true
+ && $item['id_agent_module_failover'] !== 0
+ ) {
+ $idAgentFailover = db_get_value_filter(
+ 'id_agente',
+ 'tagente_modulo',
+ ['id_agente_modulo' => $item['id_agent_module_failover']]
+ );
+ $nameAgentFailover = agents_get_alias(
+ $idAgentFailover
+ );
+
+ $nameModuleFailover = db_get_value_filter(
+ 'nombre',
+ 'tagente_modulo',
+ ['id_agente_modulo' => $item['id_agent_module_failover']]
+ );
+ }
+
$server_name_element = '';
if ($meta && $server_name != '') {
$server_name_element .= ' ('.$server_name.')';
}
if ($type == 'availability') {
- echo '
'.printSmallFont($nameAgent).$server_name_element.' |
@@ -3403,6 +3455,15 @@ function print_General_list($width, $action, $idItem=null, $type='general')
|
|
+ |
+ |
+
|
@@ -3456,6 +3517,43 @@ function print_General_list($width, $action, $idItem=null, $type='general')
+
+
+
+
+ |
+
+
+ |
+
+
@@ -4495,6 +4593,10 @@ function addGeneralRow() {
var idAgent = $("input[name=id_agent_general]").val();
var serverId = $("input[name=id_server]").val();
var idModule = $("#id_agent_module_general").val();
+ var nameAgentFailover = $("input[name=agent_failover]").val();
+ var idModuleFailover = $("#id_agent_module_failover").val();
+ var nameModuleFailover = $("#id_agent_module_failover :selected").text();
+
var operation;
if ($("#id_operation_module_general").length) {
operation = $("#id_operation_module_general").val();
@@ -4580,10 +4682,63 @@ function addGeneralRow() {
}
});
+ if (nameAgentFailover != '') {
+ //Truncate nameAgentFailover
+ var params = [];
+ params.push("truncate_text=1");
+ params.push("text=" + nameAgentFailover);
+ params.push("page=include/ajax/reporting.ajax");
+ jQuery.ajax ({
+ data: params.join ("&"),
+ type: 'POST',
+ url: action=
+
+ + "/ajax.php",
+ async: false,
+ timeout: 10000,
+ success: function (data) {
+ nameAgentFailover = data;
+ }
+ });
+
+ //Truncate nameModuleFailover
+ var params = [];
+ params.push("truncate_text=1");
+ params.push("text=" + nameModuleFailover);
+ params.push("page=include/ajax/reporting.ajax");
+ jQuery.ajax ({
+ data: params.join ("&"),
+ type: 'POST',
+ url: action=
+
+ + "/ajax.php",
+ async: false,
+ timeout: 10000,
+ success: function (data) {
+ nameModuleFailover = data;
+ }
+ });
+ }
+
var params = [];
params.push("add_general=1");
params.push("id=" + $("input[name=id_item]").val());
params.push("id_module=" + idModule);
+ params.push("id_module_failover=" + idModuleFailover);
params.push("id_server=" + serverId);
params.push("operation=" + operation);
params.push("id_agent=" + idAgent);
@@ -4610,6 +4765,8 @@ function addGeneralRow() {
$("#row", row).attr('id', 'general_' + data['id']);
$(".agent_name", row).html(nameAgent);
$(".module_name", row).html(nameModule);
+ $(".agent_name_failover", row).html(nameAgentFailover);
+ $(".module_name_failover", row).html(nameModuleFailover);
$(".operation_name", row).html(nameOperation);
$(".delete_button", row).attr(
'href',
@@ -4624,6 +4781,15 @@ function addGeneralRow() {
$("#id_operation_module_general").val('avg');
$("#id_agent_module_general").empty();
$("#id_agent_module_general").attr('disabled', 'true');
+
+ $("input[name=id_agent_failover]").val('');
+ $("input[name=agent_failover]").val('');
+ $("#id_agent_module_failover").empty();
+ $("#id_agent_module_failover").attr('disabled', 'true');
+ $("#id_agent_module_failover").append(
+ $("")
+ .attr ("value", 0)
+ .html ($("#module_sla_text").html()));
}
}
});
@@ -5111,6 +5277,12 @@ function chooseType() {
$("#row_select_fields3").hide();
}
$("#row_historical_db_check").hide();
+
+ $("#row_failover_mode").show();
+ var failover_checked = $("input[name='failover_mode']").prop("checked");
+ if(failover_checked){
+ $("#row_failover_type").show();
+ }
break;
case 'group_report':
diff --git a/pandora_console/godmode/reporting/reporting_builder.php b/pandora_console/godmode/reporting/reporting_builder.php
index 4ff734bef9..60464ee953 100755
--- a/pandora_console/godmode/reporting/reporting_builder.php
+++ b/pandora_console/godmode/reporting/reporting_builder.php
@@ -1609,6 +1609,14 @@ switch ($action) {
$values['agent_min_value'] = get_parameter(
'agent_min_value'
);
+ $values['failover_mode'] = get_parameter(
+ 'failover_mode',
+ 0
+ );
+ $values['failover_type'] = get_parameter(
+ 'failover_type',
+ REPORT_FAILOVER_TYPE_NORMAL
+ );
$good_format = true;
break;
diff --git a/pandora_console/include/ajax/reporting.ajax.php b/pandora_console/include/ajax/reporting.ajax.php
index dec331b6ef..a858f2083a 100755
--- a/pandora_console/include/ajax/reporting.ajax.php
+++ b/pandora_console/include/ajax/reporting.ajax.php
@@ -111,6 +111,7 @@ if ($add_general) {
$id_module = get_parameter('id_module', 0);
$id_server = (int) get_parameter('id_server', 0);
$operation = get_parameter('operation', '');
+ $id_module_failover = (int) get_parameter('id_module_failover', 0);
$include_enterprise = enterprise_include('include/functions_metaconsole.php');
@@ -126,10 +127,11 @@ if ($add_general) {
$result = db_process_sql_insert(
'treport_content_item',
[
- 'id_report_content' => $id,
- 'id_agent_module' => $id_module,
- 'server_name' => $connection['server_name'],
- 'operation' => $operation,
+ 'id_report_content' => $id,
+ 'id_agent_module' => $id_module,
+ 'server_name' => $connection['server_name'],
+ 'operation' => $operation,
+ 'id_agent_module_failover' => $id_module_failover,
]
);
diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php
index 00909b8d08..d10a5fe4d9 100755
--- a/pandora_console/include/functions_reporting.php
+++ b/pandora_console/include/functions_reporting.php
@@ -6256,27 +6256,6 @@ function reporting_availability($report, $content, $date=false, $time=false)
$return['kind_availability'] = 'module';
}
- if (empty($content['subitems'])) {
- if (is_metaconsole()) {
- metaconsole_restore_db();
- }
-
- $sql = sprintf(
- '
- SELECT id_agent_module,
- server_name, operation
- FROM treport_content_item
- WHERE id_report_content = %d',
- $content['id_rc']
- );
-
- $items = db_process_sql($sql);
- } else {
- $items = $content['subitems'];
- }
-
- $data = [];
-
$avg = 0;
$min = null;
$min_text = '';
@@ -6284,180 +6263,241 @@ function reporting_availability($report, $content, $date=false, $time=false)
$max_text = '';
$count = 0;
- $style = io_safe_output($content['style']);
- if ($style['hide_notinit_agents']) {
- $aux_id_agents = $agents;
- $i = 0;
- foreach ($items as $item) {
- $utimestamp = db_get_value('utimestamp', 'tagente_datos', 'id_agente_modulo', $item['id_agent_module'], true);
- if (($utimestamp === false) || (intval($utimestamp) > intval($datetime_to))) {
- unset($items[$i]);
+ if ($content['failover_mode']) {
+ $availability_graph_data = reporting_availability_graph($report, $content, false, true);
+ $data = $availability_graph_data['data'];
+
+ foreach ($data as $key => $item_data) {
+ $percent_ok = $item_data['sla_value'];
+ $data[$key]['SLA'] = $percent_ok;
+
+ if ($item_data['failover'] != 'result') {
+ $data[$key]['availability_item'] = $item_data['module'];
+ $text = $item_data['agent'].' ('.$item_data['module'].')';
+ $avg = ((($avg * $count) + $percent_ok) / ($count + 1));
+ if (is_null($min)) {
+ $min = $percent_ok;
+ $min_text = $text;
+ } else {
+ if ($min > $percent_ok) {
+ $min = $percent_ok;
+ $min_text = $text;
+ }
+ }
+
+ if (is_null($max)) {
+ $max = $percent_ok;
+ $max_text = $text;
+ } else {
+ if ($max < $percent_ok) {
+ $max = $percent_ok;
+ $max_text = $text;
+ }
+ }
+
+ $count++;
+ } else {
+ $data[$key]['availability_item'] = '--';
+ $data[$key]['agent'] = '--';
+ }
+ }
+ } else {
+ if (empty($content['subitems'])) {
+ if (is_metaconsole()) {
+ metaconsole_restore_db();
}
- $i++;
- }
- }
+ $sql = sprintf(
+ '
+ SELECT id_agent_module, id_agent_module_failover,
+ server_name, operation
+ FROM treport_content_item
+ WHERE id_report_content = %d',
+ $content['id_rc']
+ );
+
+ $items = db_process_sql($sql);
+ } else {
+ $items = $content['subitems'];
+ }
+
+ $data = [];
+
+ $style = io_safe_output($content['style']);
+ if ($style['hide_notinit_agents']) {
+ $aux_id_agents = $agents;
+ $i = 0;
+ foreach ($items as $item) {
+ $utimestamp = db_get_value('utimestamp', 'tagente_datos', 'id_agente_modulo', $item['id_agent_module'], true);
+ if (($utimestamp === false) || (intval($utimestamp) > intval($datetime_to))) {
+ unset($items[$i]);
+ }
+
+ $i++;
+ }
+ }
+
+ if (!empty($items)) {
+ foreach ($items as $item) {
+ // aaMetaconsole connection
+ $server_name = $item['server_name'];
+ if (($config['metaconsole'] == 1) && $server_name != '' && is_metaconsole()) {
+ $connection = metaconsole_get_connection($server_name);
+ if (metaconsole_load_external_db($connection) != NOERR) {
+ // ui_print_error_message ("Error connecting to ".$server_name);
+ continue;
+ }
+ }
+
+ if (modules_is_disable_agent($item['id_agent_module'])
+ || modules_is_not_init($item['id_agent_module'])
+ ) {
+ // Restore dbconnection
+ if (($config['metaconsole'] == 1) && $server_name != '' && is_metaconsole()) {
+ metaconsole_restore_db();
+ }
- if (!empty($items)) {
- foreach ($items as $item) {
- // aaMetaconsole connection
- $server_name = $item['server_name'];
- if (($config['metaconsole'] == 1) && $server_name != '' && is_metaconsole()) {
- $connection = metaconsole_get_connection($server_name);
- if (metaconsole_load_external_db($connection) != NOERR) {
- // ui_print_error_message ("Error connecting to ".$server_name);
continue;
}
- }
- if (modules_is_disable_agent($item['id_agent_module'])
- || modules_is_not_init($item['id_agent_module'])
- ) {
+ $row = [];
+
+ $text = '';
+
+ $row['data'] = reporting_advanced_sla(
+ $item['id_agent_module'],
+ ($report['datetime'] - $content['period']),
+ $report['datetime'],
+ null,
+ // min_value -> dynamic
+ null,
+ // max_value -> dynamic
+ null,
+ // 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']
+ );
+
+ // HACK it is saved in show_graph field.
+ // Show interfaces instead the modules
+ if ($content['show_graph']) {
+ $text = $row['data']['availability_item'] = agents_get_address(
+ modules_get_agentmodule_agent($item['id_agent_module'])
+ );
+
+ if (empty($text)) {
+ $text = $row['data']['availability_item'] = __('No Address');
+ }
+ } else {
+ $text = $row['data']['availability_item'] = modules_get_agentmodule_name(
+ $item['id_agent_module']
+ );
+ }
+
+ $row['data']['agent'] = modules_get_agentmodule_agent_alias(
+ $item['id_agent_module']
+ );
+
+ $text = $row['data']['agent'].' ('.$text.')';
+
// Restore dbconnection
if (($config['metaconsole'] == 1) && $server_name != '' && is_metaconsole()) {
metaconsole_restore_db();
}
- continue;
- }
+ // find order
+ $row['data']['order'] = $row['data']['SLA'];
- $row = [];
-
- $text = '';
-
- $row['data'] = reporting_advanced_sla(
- $item['id_agent_module'],
- ($report['datetime'] - $content['period']),
- $report['datetime'],
- null,
- // min_value -> dynamic
- null,
- // max_value -> dynamic
- null,
- // 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']
- );
-
- // HACK it is saved in show_graph field.
- // Show interfaces instead the modules
- if ($content['show_graph']) {
- $text = $row['data']['availability_item'] = agents_get_address(
- modules_get_agentmodule_agent($item['id_agent_module'])
- );
-
- if (empty($text)) {
- $text = $row['data']['availability_item'] = __('No Address');
- }
- } else {
- $text = $row['data']['availability_item'] = modules_get_agentmodule_name(
- $item['id_agent_module']
- );
- }
-
- $row['data']['agent'] = modules_get_agentmodule_agent_alias(
- $item['id_agent_module']
- );
-
- $text = $row['data']['agent'].' ('.$text.')';
-
- // Restore dbconnection
- if (($config['metaconsole'] == 1) && $server_name != '' && is_metaconsole()) {
- metaconsole_restore_db();
- }
-
- // find order
- $row['data']['order'] = $row['data']['SLA'];
-
- $percent_ok = $row['data']['SLA'];
- $avg = ((($avg * $count) + $percent_ok) / ($count + 1));
- if (is_null($min)) {
- $min = $percent_ok;
- $min_text = $text;
- } else {
- if ($min > $percent_ok) {
+ $percent_ok = $row['data']['SLA'];
+ $avg = ((($avg * $count) + $percent_ok) / ($count + 1));
+ if (is_null($min)) {
$min = $percent_ok;
$min_text = $text;
+ } else {
+ if ($min > $percent_ok) {
+ $min = $percent_ok;
+ $min_text = $text;
+ }
}
- }
- if (is_null($max)) {
- $max = $percent_ok;
- $max_text = $text;
- } else {
- if ($max < $percent_ok) {
+ if (is_null($max)) {
$max = $percent_ok;
$max_text = $text;
+ } else {
+ if ($max < $percent_ok) {
+ $max = $percent_ok;
+ $max_text = $text;
+ }
}
+
+ $data[] = $row['data'];
+ $count++;
}
- $data[] = $row['data'];
- $count++;
- }
+ switch ($content['order_uptodown']) {
+ case REPORT_ITEM_ORDER_BY_AGENT_NAME:
+ $temp = [];
+ foreach ($data as $row) {
+ $i = 0;
+ foreach ($temp as $t_row) {
+ if (strcmp($row['data']['agent'], $t_row['agent']) < 0) {
+ break;
+ }
- switch ($content['order_uptodown']) {
- case REPORT_ITEM_ORDER_BY_AGENT_NAME:
- $temp = [];
- foreach ($data as $row) {
- $i = 0;
- foreach ($temp as $t_row) {
- if (strcmp($row['data']['agent'], $t_row['agent']) < 0) {
- break;
+ $i++;
}
- $i++;
+ array_splice($temp, $i, 0, [$row]);
}
- array_splice($temp, $i, 0, [$row]);
- }
+ $data = $temp;
+ break;
- $data = $temp;
- break;
+ case REPORT_ITEM_ORDER_BY_ASCENDING:
+ $temp = [];
+ foreach ($data as $row) {
+ $i = 0;
+ foreach ($temp as $t_row) {
+ if ($row['data']['SLA'] < $t_row['order']) {
+ break;
+ }
- case REPORT_ITEM_ORDER_BY_ASCENDING:
- $temp = [];
- foreach ($data as $row) {
- $i = 0;
- foreach ($temp as $t_row) {
- if ($row['data']['SLA'] < $t_row['order']) {
- break;
+ $i++;
}
- $i++;
+ array_splice($temp, $i, 0, [$row]);
}
- array_splice($temp, $i, 0, [$row]);
- }
+ $data = $temp;
+ break;
- $data = $temp;
- break;
+ case REPORT_ITEM_ORDER_BY_DESCENDING:
+ $temp = [];
+ foreach ($data as $row) {
+ $i = 0;
+ foreach ($temp as $t_row) {
+ if ($row['data']['SLA'] > $t_row['order']) {
+ break;
+ }
- case REPORT_ITEM_ORDER_BY_DESCENDING:
- $temp = [];
- foreach ($data as $row) {
- $i = 0;
- foreach ($temp as $t_row) {
- if ($row['data']['SLA'] > $t_row['order']) {
- break;
+ $i++;
}
- $i++;
+ array_splice($temp, $i, 0, [$row]);
}
- array_splice($temp, $i, 0, [$row]);
- }
-
- $data = $temp;
- break;
+ $data = $temp;
+ break;
+ }
}
}
@@ -6496,7 +6536,7 @@ function reporting_availability($report, $content, $date=false, $time=false)
*
* @return array Generates a structure the report.
*/
-function reporting_availability_graph($report, $content, $pdf=false)
+function reporting_availability_graph($report, $content, $pdf=false, $failover=false)
{
global $config;
$return = [];
@@ -6538,7 +6578,7 @@ function reporting_availability_graph($report, $content, $pdf=false)
$slas = io_safe_output(
db_get_all_rows_field_filter(
- 'treport_content_sla_combined',
+ ($failover) ? 'treport_content_item' : 'treport_content_sla_combined',
'id_report_content',
$content['id_rc']
)
@@ -6943,9 +6983,19 @@ function prepare_data_for_paint(
$alias_agent = modules_get_agentmodule_agent_alias(
$sla['id_agent_module']
);
- $name_module = modules_get_agentmodule_name(
- $sla['id_agent_module']
- );
+
+ if ($content['show_graph']) {
+ $name_module = agents_get_address(
+ modules_get_agentmodule_agent($sla['id_agent_module'])
+ );
+ if (empty($name_module)) {
+ $name_module = __('No Address');
+ }
+ } else {
+ $name_module = modules_get_agentmodule_name(
+ $sla['id_agent_module']
+ );
+ }
$data['agent'] = $alias_agent;
$data['module'] = $name_module;
diff --git a/pandora_console/include/functions_reporting_html.php b/pandora_console/include/functions_reporting_html.php
index b81024559f..dc832dd870 100644
--- a/pandora_console/include/functions_reporting_html.php
+++ b/pandora_console/include/functions_reporting_html.php
@@ -3028,6 +3028,10 @@ function reporting_html_availability($table, $item, $pdf=0)
$table1->data = [];
$table1->head = [];
+ if (isset($item['data'][0]['failover'])) {
+ $table1->head[-1] = __('Failover');
+ }
+
$table1->head[0] = __('Agent');
// HACK it is saved in show_graph field.
// Show interfaces instead the modules.
@@ -3076,6 +3080,10 @@ function reporting_html_availability($table, $item, $pdf=0)
$table1->head[8] = __('% Ok');
$table1->headstyle = [];
+ if (isset($item['data'][0]['failover'])) {
+ $table1->headstyle[-1] = 'text-align: left';
+ }
+
$table1->headstyle[0] = 'text-align: left';
$table1->headstyle[1] = 'text-align: left';
$table1->headstyle[2] = 'text-align: center';
@@ -3086,6 +3094,10 @@ function reporting_html_availability($table, $item, $pdf=0)
$table1->headstyle[7] = 'text-align: right';
$table1->headstyle[8] = 'text-align: right';
+ if (isset($item['data'][0]['failover'])) {
+ $table1->style[-1] = 'text-align: left';
+ }
+
$table1->style[0] = 'text-align: left';
$table1->style[1] = 'text-align: left';
$table1->style[2] = 'text-align: center';
@@ -3101,6 +3113,10 @@ function reporting_html_availability($table, $item, $pdf=0)
$table2->data = [];
$table2->head = [];
+ if (isset($item['data'][0]['failover'])) {
+ $table2->head[-1] = __('Failover');
+ }
+
$table2->head[0] = __('Agent');
// HACK it is saved in show_graph field.
// Show interfaces instead the modules.
@@ -3135,6 +3151,10 @@ function reporting_html_availability($table, $item, $pdf=0)
}
$table2->headstyle = [];
+ if (isset($item['data'][0]['failover'])) {
+ $table2->headstyle[-1] = 'text-align: left';
+ }
+
$table2->headstyle[0] = 'text-align: left';
$table2->headstyle[1] = 'text-align: left';
$table2->headstyle[2] = 'text-align: right';
@@ -3142,6 +3162,10 @@ function reporting_html_availability($table, $item, $pdf=0)
$table2->headstyle[4] = 'text-align: right';
$table2->headstyle[5] = 'text-align: right';
+ if (isset($item['data'][0]['failover'])) {
+ $table2->style[-1] = 'text-align: left';
+ }
+
$table2->style[0] = 'text-align: left';
$table2->style[1] = 'text-align: left';
$table2->style[2] = 'text-align: right';
@@ -3151,8 +3175,21 @@ function reporting_html_availability($table, $item, $pdf=0)
foreach ($item['data'] as $row) {
$table_row = [];
- $table_row[] = $row['agent'];
- $table_row[] = $row['availability_item'];
+ if (isset($row['failover'])) {
+ if (strpos($row['failover'], 'failover') !== false) {
+ $table_row[] = __('Failover');
+ } else {
+ $table_row[] = ucfirst($row['failover']);
+ }
+ }
+
+ if (isset($row['failover']) && $row['failover'] === 'result') {
+ $table_row[] = '--';
+ $table_row[] = '--';
+ } else {
+ $table_row[] = $row['agent'];
+ $table_row[] = $row['availability_item'];
+ }
if ($row['time_total'] != 0 && $item['fields']['total_time']) {
$table_row[] = human_time_description_raw(
@@ -3229,6 +3266,10 @@ function reporting_html_availability($table, $item, $pdf=0)
$table_row[] = ''.sla_truncate($row['SLA'], $config['graph_precision']).'%';
$table_row2 = [];
+ if (isset($row['failover'])) {
+ $table_row2[] = ucfirst($row['failover']);
+ }
+
$table_row2[] = $row['agent'];
$table_row2[] = $row['availability_item'];
if ($item['fields']['total_checks']) {
diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql
index 562a63d80b..741a0dc1d8 100644
--- a/pandora_console/pandoradb.sql
+++ b/pandora_console/pandoradb.sql
@@ -1486,14 +1486,15 @@ CREATE TABLE IF NOT EXISTS `treport_content_sla_combined` (
-- Table `treport_content_item`
-- ----------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `treport_content_item` (
- `id` INTEGER UNSIGNED NOT NULL auto_increment,
- `id_report_content` INTEGER UNSIGNED NOT NULL,
- `id_agent_module` int(10) unsigned NOT NULL,
+ `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_failover` int(10) unsigned NOT NULL DEFAULT 0,
`server_name` text,
`operation` text,
PRIMARY KEY(`id`),
FOREIGN KEY (`id_report_content`) REFERENCES treport_content(`id_rc`)
- ON UPDATE CASCADE ON DELETE CASCADE
+ ON UPDATE CASCADE ON DELETE CASCADE
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
-- ---------------------------------------------------------------------
|