mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-27 15:54:29 +02:00
Added failover in templates
This commit is contained in:
parent
c68f83f013
commit
81fe77d9fd
@ -703,7 +703,6 @@ if ($config['menu_type'] == 'classic') {
|
|||||||
},
|
},
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
$('#result_order').html(data);
|
$('#result_order').html(data);
|
||||||
console.log(data);
|
|
||||||
},
|
},
|
||||||
error: function (data) {
|
error: function (data) {
|
||||||
console.error("Fatal error in AJAX call to interpreter order", data)
|
console.error("Fatal error in AJAX call to interpreter order", data)
|
||||||
|
@ -6245,6 +6245,14 @@ function reporting_availability($report, $content, $date=false, $time=false)
|
|||||||
$return['kind_availability'] = 'module';
|
$return['kind_availability'] = 'module';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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) {
|
||||||
|
$data[$key]['SLA'] = $item_data['sla_value'];
|
||||||
|
$data[$key]['availability_item'] = $item_data['module'];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
if (empty($content['subitems'])) {
|
if (empty($content['subitems'])) {
|
||||||
if (is_metaconsole()) {
|
if (is_metaconsole()) {
|
||||||
metaconsole_restore_db();
|
metaconsole_restore_db();
|
||||||
@ -6337,30 +6345,6 @@ 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']) {
|
||||||
@ -6473,8 +6457,7 @@ function reporting_availability($report, $content, $date=false, $time=false)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
hd($data);
|
|
||||||
|
|
||||||
$return['data'] = $data;
|
$return['data'] = $data;
|
||||||
$return['resume'] = [];
|
$return['resume'] = [];
|
||||||
@ -6498,8 +6481,6 @@ 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6513,7 +6494,7 @@ function reporting_availability($report, $content, $date=false, $time=false)
|
|||||||
*
|
*
|
||||||
* @return array Generates a structure the report.
|
* @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;
|
global $config;
|
||||||
$return = [];
|
$return = [];
|
||||||
@ -6555,7 +6536,7 @@ function reporting_availability_graph($report, $content, $pdf=false)
|
|||||||
|
|
||||||
$slas = io_safe_output(
|
$slas = io_safe_output(
|
||||||
db_get_all_rows_field_filter(
|
db_get_all_rows_field_filter(
|
||||||
'treport_content_sla_combined',
|
($failover) ? 'treport_content_item' : 'treport_content_sla_combined',
|
||||||
'id_report_content',
|
'id_report_content',
|
||||||
$content['id_rc']
|
$content['id_rc']
|
||||||
)
|
)
|
||||||
@ -6623,7 +6604,6 @@ 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,
|
||||||
@ -6961,9 +6941,19 @@ function prepare_data_for_paint(
|
|||||||
$alias_agent = modules_get_agentmodule_agent_alias(
|
$alias_agent = modules_get_agentmodule_agent_alias(
|
||||||
$sla['id_agent_module']
|
$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(
|
$name_module = modules_get_agentmodule_name(
|
||||||
$sla['id_agent_module']
|
$sla['id_agent_module']
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
$data['agent'] = $alias_agent;
|
$data['agent'] = $alias_agent;
|
||||||
$data['module'] = $name_module;
|
$data['module'] = $name_module;
|
||||||
|
@ -3028,6 +3028,10 @@ function reporting_html_availability($table, $item, $pdf=0)
|
|||||||
$table1->data = [];
|
$table1->data = [];
|
||||||
|
|
||||||
$table1->head = [];
|
$table1->head = [];
|
||||||
|
if (isset($item['data'][0]['failover'])) {
|
||||||
|
$table1->head[-1] = __('Failover');
|
||||||
|
}
|
||||||
|
|
||||||
$table1->head[0] = __('Agent');
|
$table1->head[0] = __('Agent');
|
||||||
// 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.
|
||||||
@ -3076,6 +3080,10 @@ function reporting_html_availability($table, $item, $pdf=0)
|
|||||||
$table1->head[8] = __('% Ok');
|
$table1->head[8] = __('% Ok');
|
||||||
|
|
||||||
$table1->headstyle = [];
|
$table1->headstyle = [];
|
||||||
|
if (isset($item['data'][0]['failover'])) {
|
||||||
|
$table1->headstyle[-1] = 'text-align: left';
|
||||||
|
}
|
||||||
|
|
||||||
$table1->headstyle[0] = 'text-align: left';
|
$table1->headstyle[0] = 'text-align: left';
|
||||||
$table1->headstyle[1] = 'text-align: left';
|
$table1->headstyle[1] = 'text-align: left';
|
||||||
$table1->headstyle[2] = 'text-align: center';
|
$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[7] = 'text-align: right';
|
||||||
$table1->headstyle[8] = '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[0] = 'text-align: left';
|
||||||
$table1->style[1] = 'text-align: left';
|
$table1->style[1] = 'text-align: left';
|
||||||
$table1->style[2] = 'text-align: center';
|
$table1->style[2] = 'text-align: center';
|
||||||
@ -3101,6 +3113,10 @@ function reporting_html_availability($table, $item, $pdf=0)
|
|||||||
$table2->data = [];
|
$table2->data = [];
|
||||||
|
|
||||||
$table2->head = [];
|
$table2->head = [];
|
||||||
|
if (isset($item['data'][0]['failover'])) {
|
||||||
|
$table2->head[-1] = __('Failover');
|
||||||
|
}
|
||||||
|
|
||||||
$table2->head[0] = __('Agent');
|
$table2->head[0] = __('Agent');
|
||||||
// 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.
|
||||||
@ -3135,6 +3151,10 @@ function reporting_html_availability($table, $item, $pdf=0)
|
|||||||
}
|
}
|
||||||
|
|
||||||
$table2->headstyle = [];
|
$table2->headstyle = [];
|
||||||
|
if (isset($item['data'][0]['failover'])) {
|
||||||
|
$table2->headstyle[-1] = 'text-align: left';
|
||||||
|
}
|
||||||
|
|
||||||
$table2->headstyle[0] = 'text-align: left';
|
$table2->headstyle[0] = 'text-align: left';
|
||||||
$table2->headstyle[1] = 'text-align: left';
|
$table2->headstyle[1] = 'text-align: left';
|
||||||
$table2->headstyle[2] = 'text-align: right';
|
$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[4] = 'text-align: right';
|
||||||
$table2->headstyle[5] = '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[0] = 'text-align: left';
|
||||||
$table2->style[1] = 'text-align: left';
|
$table2->style[1] = 'text-align: left';
|
||||||
$table2->style[2] = 'text-align: right';
|
$table2->style[2] = 'text-align: right';
|
||||||
@ -3151,8 +3175,17 @@ function reporting_html_availability($table, $item, $pdf=0)
|
|||||||
|
|
||||||
foreach ($item['data'] as $row) {
|
foreach ($item['data'] as $row) {
|
||||||
$table_row = [];
|
$table_row = [];
|
||||||
|
if (isset($row['failover'])) {
|
||||||
|
$table_row[] = ucfirst($row['failover']);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($row['failover']) && $row['failover'] === 'result') {
|
||||||
|
$table_row[] = '--';
|
||||||
|
$table_row[] = '--';
|
||||||
|
} else {
|
||||||
$table_row[] = $row['agent'];
|
$table_row[] = $row['agent'];
|
||||||
$table_row[] = $row['availability_item'];
|
$table_row[] = $row['availability_item'];
|
||||||
|
}
|
||||||
|
|
||||||
if ($row['time_total'] != 0 && $item['fields']['total_time']) {
|
if ($row['time_total'] != 0 && $item['fields']['total_time']) {
|
||||||
$table_row[] = human_time_description_raw(
|
$table_row[] = human_time_description_raw(
|
||||||
@ -3229,6 +3262,10 @@ function reporting_html_availability($table, $item, $pdf=0)
|
|||||||
$table_row[] = '<span style="font-size: '.$font_size.'; font-weight:bold;">'.sla_truncate($row['SLA'], $config['graph_precision']).'%</span>';
|
$table_row[] = '<span style="font-size: '.$font_size.'; font-weight:bold;">'.sla_truncate($row['SLA'], $config['graph_precision']).'%</span>';
|
||||||
|
|
||||||
$table_row2 = [];
|
$table_row2 = [];
|
||||||
|
if (isset($row['failover'])) {
|
||||||
|
$table_row2[] = ucfirst($row['failover']);
|
||||||
|
}
|
||||||
|
|
||||||
$table_row2[] = $row['agent'];
|
$table_row2[] = $row['agent'];
|
||||||
$table_row2[] = $row['availability_item'];
|
$table_row2[] = $row['availability_item'];
|
||||||
if ($item['fields']['total_checks']) {
|
if ($item['fields']['total_checks']) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user