mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-28 08:14:38 +02:00
availability failover
This commit is contained in:
parent
c1a124c970
commit
c68f83f013
@ -2,5 +2,6 @@ START TRANSACTION;
|
|||||||
|
|
||||||
ALTER TABLE `tmap` ADD COLUMN `id_group_map` INT(10) 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 `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;
|
COMMIT;
|
||||||
|
@ -628,6 +628,8 @@ switch ($action) {
|
|||||||
$unknown_checks = $item['unknown_checks'];
|
$unknown_checks = $item['unknown_checks'];
|
||||||
$agent_max_value = $item['agent_max_value'];
|
$agent_max_value = $item['agent_max_value'];
|
||||||
$agent_min_value = $item['agent_min_value'];
|
$agent_min_value = $item['agent_min_value'];
|
||||||
|
$failover_mode = $item['failover_mode'];
|
||||||
|
$failover_type = $item['failover_type'];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'group_report':
|
case 'group_report':
|
||||||
@ -3263,6 +3265,13 @@ function print_General_list($width, $action, $idItem=null, $type='general')
|
|||||||
$meta = false;
|
$meta = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$failover_mode = db_get_value(
|
||||||
|
'failover_mode',
|
||||||
|
'treport_content',
|
||||||
|
'id_rc',
|
||||||
|
$idItem
|
||||||
|
);
|
||||||
|
|
||||||
$operation = [
|
$operation = [
|
||||||
'avg' => __('rate'),
|
'avg' => __('rate'),
|
||||||
'max' => __('max'),
|
'max' => __('max'),
|
||||||
@ -3284,6 +3293,18 @@ function print_General_list($width, $action, $idItem=null, $type='general')
|
|||||||
<th class="header" scope="col">
|
<th class="header" scope="col">
|
||||||
<?php echo __('Module'); ?>
|
<?php echo __('Module'); ?>
|
||||||
</th>
|
</th>
|
||||||
|
<?php
|
||||||
|
if ($failover_mode) {
|
||||||
|
?>
|
||||||
|
<th class="header" scope="col">
|
||||||
|
<?php echo __('Agent Failover'); ?>
|
||||||
|
</th>
|
||||||
|
<th class="header" scope="col">
|
||||||
|
<?php echo __('Module Failover'); ?>
|
||||||
|
</th>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
<th class="header" scope="col">
|
<th class="header" scope="col">
|
||||||
<?php echo __('Action'); ?>
|
<?php echo __('Action'); ?>
|
||||||
</th>
|
</th>
|
||||||
@ -3365,12 +3386,42 @@ function print_General_list($width, $action, $idItem=null, $type='general')
|
|||||||
['id_agente_modulo' => $item['id_agent_module']]
|
['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 = '';
|
$server_name_element = '';
|
||||||
if ($meta && $server_name != '') {
|
if ($meta && $server_name != '') {
|
||||||
$server_name_element .= ' ('.$server_name.')';
|
$server_name_element .= ' ('.$server_name.')';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($type == 'availability') {
|
if ($type == 'availability') {
|
||||||
|
if ($failover_mode) {
|
||||||
|
echo '<tr id="general_'.$item['id'].'" style="" class="datos">
|
||||||
|
<td>'.printSmallFont($nameAgent).$server_name_element.'</td>
|
||||||
|
<td>'.printSmallFont($nameModule).'</td>
|
||||||
|
<td>'.printSmallFont($nameAgentFailover).$server_name_element.'</td>
|
||||||
|
<td>'.printSmallFont($nameModuleFailover).'</td>
|
||||||
|
<td style="text-align: center;">
|
||||||
|
<a href="javascript: deleteGeneralRow('.$item['id'].');">'.html_print_image('images/cross.png', true).'</a>
|
||||||
|
</td>
|
||||||
|
</tr>';
|
||||||
|
} else {
|
||||||
echo '<tr id="general_'.$item['id'].'" style="" class="datos">
|
echo '<tr id="general_'.$item['id'].'" style="" class="datos">
|
||||||
<td>'.printSmallFont($nameAgent).$server_name_element.'</td>
|
<td>'.printSmallFont($nameAgent).$server_name_element.'</td>
|
||||||
<td>'.printSmallFont($nameModule).'</td>
|
<td>'.printSmallFont($nameModule).'</td>
|
||||||
@ -3378,6 +3429,7 @@ function print_General_list($width, $action, $idItem=null, $type='general')
|
|||||||
<a href="javascript: deleteGeneralRow('.$item['id'].');">'.html_print_image('images/cross.png', true).'</a>
|
<a href="javascript: deleteGeneralRow('.$item['id'].');">'.html_print_image('images/cross.png', true).'</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>';
|
</tr>';
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
echo '<tr id="general_'.$item['id'].'" style="" class="datos">
|
echo '<tr id="general_'.$item['id'].'" style="" class="datos">
|
||||||
<td>'.printSmallFont($nameAgent).$server_name_element.'</td>
|
<td>'.printSmallFont($nameAgent).$server_name_element.'</td>
|
||||||
@ -3403,6 +3455,15 @@ function print_General_list($width, $action, $idItem=null, $type='general')
|
|||||||
<td class="agent_name"></td>
|
<td class="agent_name"></td>
|
||||||
<td class="module_name"></td>
|
<td class="module_name"></td>
|
||||||
<?php
|
<?php
|
||||||
|
if ($type == 'availability'
|
||||||
|
&& $failover_mode
|
||||||
|
) {
|
||||||
|
?>
|
||||||
|
<td class="agent_name_failover"></td>
|
||||||
|
<td class="module_name_failover"></td>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
if ($type != 'availability') {
|
if ($type != 'availability') {
|
||||||
?>
|
?>
|
||||||
<td class="operation_name"></td>
|
<td class="operation_name"></td>
|
||||||
@ -3456,6 +3517,43 @@ function print_General_list($width, $action, $idItem=null, $type='general')
|
|||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
<?php
|
<?php
|
||||||
|
if ($type == 'availability' && $failover_mode) {
|
||||||
|
?>
|
||||||
|
<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_failover';
|
||||||
|
$params['value'] = '';
|
||||||
|
$params['use_hidden_input_idagent'] = true;
|
||||||
|
$params['hidden_input_idagent_id'] = 'hidden-id_agent_failover';
|
||||||
|
$params['javascript_is_function_select'] = true;
|
||||||
|
$params['selectbox_id'] = 'id_agent_module_failover';
|
||||||
|
$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_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');
|
||||||
|
?>
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<?php
|
||||||
if ($type !== 'availability') {
|
if ($type !== 'availability') {
|
||||||
?>
|
?>
|
||||||
<td>
|
<td>
|
||||||
@ -4495,6 +4593,10 @@ function addGeneralRow() {
|
|||||||
var idAgent = $("input[name=id_agent_general]").val();
|
var idAgent = $("input[name=id_agent_general]").val();
|
||||||
var serverId = $("input[name=id_server]").val();
|
var serverId = $("input[name=id_server]").val();
|
||||||
var idModule = $("#id_agent_module_general").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;
|
var operation;
|
||||||
if ($("#id_operation_module_general").length) {
|
if ($("#id_operation_module_general").length) {
|
||||||
operation = $("#id_operation_module_general").val();
|
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=
|
||||||
|
<?php
|
||||||
|
echo '"'.ui_get_full_url(
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
false
|
||||||
|
).'"';
|
||||||
|
?>
|
||||||
|
+ "/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=
|
||||||
|
<?php
|
||||||
|
echo '"'.ui_get_full_url(
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
false
|
||||||
|
).'"';
|
||||||
|
?>
|
||||||
|
+ "/ajax.php",
|
||||||
|
async: false,
|
||||||
|
timeout: 10000,
|
||||||
|
success: function (data) {
|
||||||
|
nameModuleFailover = data;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
var params = [];
|
var params = [];
|
||||||
params.push("add_general=1");
|
params.push("add_general=1");
|
||||||
params.push("id=" + $("input[name=id_item]").val());
|
params.push("id=" + $("input[name=id_item]").val());
|
||||||
params.push("id_module=" + idModule);
|
params.push("id_module=" + idModule);
|
||||||
|
params.push("id_module_failover=" + idModuleFailover);
|
||||||
params.push("id_server=" + serverId);
|
params.push("id_server=" + serverId);
|
||||||
params.push("operation=" + operation);
|
params.push("operation=" + operation);
|
||||||
params.push("id_agent=" + idAgent);
|
params.push("id_agent=" + idAgent);
|
||||||
@ -4610,6 +4765,8 @@ function addGeneralRow() {
|
|||||||
$("#row", row).attr('id', 'general_' + data['id']);
|
$("#row", row).attr('id', 'general_' + data['id']);
|
||||||
$(".agent_name", row).html(nameAgent);
|
$(".agent_name", row).html(nameAgent);
|
||||||
$(".module_name", row).html(nameModule);
|
$(".module_name", row).html(nameModule);
|
||||||
|
$(".agent_name_failover", row).html(nameAgentFailover);
|
||||||
|
$(".module_name_failover", row).html(nameModuleFailover);
|
||||||
$(".operation_name", row).html(nameOperation);
|
$(".operation_name", row).html(nameOperation);
|
||||||
$(".delete_button", row).attr(
|
$(".delete_button", row).attr(
|
||||||
'href',
|
'href',
|
||||||
@ -4624,6 +4781,15 @@ function addGeneralRow() {
|
|||||||
$("#id_operation_module_general").val('avg');
|
$("#id_operation_module_general").val('avg');
|
||||||
$("#id_agent_module_general").empty();
|
$("#id_agent_module_general").empty();
|
||||||
$("#id_agent_module_general").attr('disabled', 'true');
|
$("#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(
|
||||||
|
$("<option></option>")
|
||||||
|
.attr ("value", 0)
|
||||||
|
.html ($("#module_sla_text").html()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -5111,6 +5277,12 @@ function chooseType() {
|
|||||||
$("#row_select_fields3").hide();
|
$("#row_select_fields3").hide();
|
||||||
}
|
}
|
||||||
$("#row_historical_db_check").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;
|
break;
|
||||||
|
|
||||||
case 'group_report':
|
case 'group_report':
|
||||||
|
@ -1609,6 +1609,14 @@ switch ($action) {
|
|||||||
$values['agent_min_value'] = get_parameter(
|
$values['agent_min_value'] = get_parameter(
|
||||||
'agent_min_value'
|
'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;
|
$good_format = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -111,6 +111,7 @@ if ($add_general) {
|
|||||||
$id_module = get_parameter('id_module', 0);
|
$id_module = get_parameter('id_module', 0);
|
||||||
$id_server = (int) get_parameter('id_server', 0);
|
$id_server = (int) get_parameter('id_server', 0);
|
||||||
$operation = get_parameter('operation', '');
|
$operation = get_parameter('operation', '');
|
||||||
|
$id_module_failover = (int) get_parameter('id_module_failover', 0);
|
||||||
|
|
||||||
$include_enterprise = enterprise_include('include/functions_metaconsole.php');
|
$include_enterprise = enterprise_include('include/functions_metaconsole.php');
|
||||||
|
|
||||||
@ -130,6 +131,7 @@ if ($add_general) {
|
|||||||
'id_agent_module' => $id_module,
|
'id_agent_module' => $id_module,
|
||||||
'server_name' => $connection['server_name'],
|
'server_name' => $connection['server_name'],
|
||||||
'operation' => $operation,
|
'operation' => $operation,
|
||||||
|
'id_agent_module_failover' => $id_module_failover,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -6252,7 +6252,7 @@ function reporting_availability($report, $content, $date=false, $time=false)
|
|||||||
|
|
||||||
$sql = sprintf(
|
$sql = sprintf(
|
||||||
'
|
'
|
||||||
SELECT id_agent_module,
|
SELECT id_agent_module, id_agent_module_failover,
|
||||||
server_name, operation
|
server_name, operation
|
||||||
FROM treport_content_item
|
FROM treport_content_item
|
||||||
WHERE id_report_content = %d',
|
WHERE id_report_content = %d',
|
||||||
@ -6337,6 +6337,30 @@ function reporting_availability($report, $content, $date=false, $time=false)
|
|||||||
$content['time_to']
|
$content['time_to']
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// $row['data']= reporting_advanced_sla(
|
||||||
|
// $item['id_agent_module_failover'],
|
||||||
|
// ($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']
|
||||||
|
// );
|
||||||
|
hd($row['data']);
|
||||||
|
|
||||||
// HACK it is saved in show_graph field.
|
// HACK it is saved in show_graph field.
|
||||||
// Show interfaces instead the modules
|
// Show interfaces instead the modules
|
||||||
if ($content['show_graph']) {
|
if ($content['show_graph']) {
|
||||||
@ -6450,6 +6474,8 @@ function reporting_availability($report, $content, $date=false, $time=false)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hd($data);
|
||||||
|
|
||||||
$return['data'] = $data;
|
$return['data'] = $data;
|
||||||
$return['resume'] = [];
|
$return['resume'] = [];
|
||||||
$return['resume']['resume'] = $content['show_resume'];
|
$return['resume']['resume'] = $content['show_resume'];
|
||||||
@ -6472,6 +6498,8 @@ function reporting_availability($report, $content, $date=false, $time=false)
|
|||||||
$return['fields']['agent_max_value'] = $content['agent_max_value'];
|
$return['fields']['agent_max_value'] = $content['agent_max_value'];
|
||||||
$return['fields']['agent_min_value'] = $content['agent_min_value'];
|
$return['fields']['agent_min_value'] = $content['agent_min_value'];
|
||||||
|
|
||||||
|
hd(reporting_check_structure_content($return));
|
||||||
|
|
||||||
return reporting_check_structure_content($return);
|
return reporting_check_structure_content($return);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6595,6 +6623,7 @@ function reporting_availability_graph($report, $content, $pdf=false)
|
|||||||
$slice = ($content['period'] / $module_interval);
|
$slice = ($content['period'] / $module_interval);
|
||||||
$data_combined = [];
|
$data_combined = [];
|
||||||
|
|
||||||
|
// hd($sla_failover);
|
||||||
foreach ($sla_failover as $k_sla => $v_sla) {
|
foreach ($sla_failover as $k_sla => $v_sla) {
|
||||||
$sla_array = data_db_uncompress_module(
|
$sla_array = data_db_uncompress_module(
|
||||||
$v_sla,
|
$v_sla,
|
||||||
|
@ -1488,6 +1488,7 @@ CREATE TABLE IF NOT EXISTS `treport_content_item` (
|
|||||||
`id` INTEGER UNSIGNED NOT NULL auto_increment,
|
`id` INTEGER UNSIGNED NOT NULL auto_increment,
|
||||||
`id_report_content` INTEGER UNSIGNED NOT NULL,
|
`id_report_content` INTEGER UNSIGNED NOT NULL,
|
||||||
`id_agent_module` int(10) 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,
|
`server_name` text,
|
||||||
`operation` text,
|
`operation` text,
|
||||||
PRIMARY KEY(`id`),
|
PRIMARY KEY(`id`),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user