mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-29 16:55:05 +02:00
Added new checkbox to hide agents that its first data time is less than report final time. Ticket 2 Gitlab
(cherry picked from commit 2f462370e89f18e165a193c448bdc646b5e6736d)
This commit is contained in:
parent
06e37132a8
commit
910857d57f
@ -124,6 +124,7 @@ switch ($action) {
|
|||||||
$sql = null;
|
$sql = null;
|
||||||
$show_in_two_columns = 0;
|
$show_in_two_columns = 0;
|
||||||
$show_in_landscape = 0;
|
$show_in_landscape = 0;
|
||||||
|
$hide_notinit_agents = 0;
|
||||||
$server_name = '';
|
$server_name = '';
|
||||||
$server_id = 0;
|
$server_id = 0;
|
||||||
break;
|
break;
|
||||||
@ -156,6 +157,7 @@ switch ($action) {
|
|||||||
$sql = null;
|
$sql = null;
|
||||||
$show_in_two_columns = 0;
|
$show_in_two_columns = 0;
|
||||||
$show_in_landscape = 0;
|
$show_in_landscape = 0;
|
||||||
|
$hide_notinit_agents = 0;
|
||||||
$server_name = '';
|
$server_name = '';
|
||||||
$server_id = 0;
|
$server_id = 0;
|
||||||
$get_data_editor = false;
|
$get_data_editor = false;
|
||||||
@ -177,8 +179,10 @@ switch ($action) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$style = json_decode(io_safe_output($item['style']), true);
|
$style = json_decode(io_safe_output($item['style']), true);
|
||||||
|
|
||||||
$show_in_two_columns = $style['show_in_two_columns'];
|
$show_in_two_columns = $style['show_in_two_columns'];
|
||||||
$show_in_landscape = $style['show_in_landscape'];
|
$show_in_landscape = $style['show_in_landscape'];
|
||||||
|
$hide_notinit_agents = $style['hide_notinit_agents'];
|
||||||
$type = $item['type'];
|
$type = $item['type'];
|
||||||
$name = $item['name'];
|
$name = $item['name'];
|
||||||
|
|
||||||
@ -1302,6 +1306,16 @@ $class = 'databox filters';
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
<tr id="row_hide_notinit_agents" style="" class="datos">
|
||||||
|
<td style="font-weight:bold;"><?php echo __('Hide not init agents');?></td>
|
||||||
|
<td>
|
||||||
|
<?php
|
||||||
|
html_print_checkbox('hide_notinit_agents', 1,
|
||||||
|
$hide_notinit_agents, false, false);
|
||||||
|
?>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<tr id="row_filter_search" style="" class="datos">
|
<tr id="row_filter_search" style="" class="datos">
|
||||||
@ -1395,6 +1409,7 @@ function print_SLA_list($width, $action, $idItem = null) {
|
|||||||
'tagente_modulo',
|
'tagente_modulo',
|
||||||
array('id_agente_modulo' => $item['id_agent_module']));
|
array('id_agente_modulo' => $item['id_agent_module']));
|
||||||
$nameAgent = agents_get_name ($idAgent);
|
$nameAgent = agents_get_name ($idAgent);
|
||||||
|
|
||||||
$nameModule = db_get_value_filter('nombre',
|
$nameModule = db_get_value_filter('nombre',
|
||||||
'tagente_modulo',
|
'tagente_modulo',
|
||||||
array('id_agente_modulo' => $item['id_agent_module']));
|
array('id_agente_modulo' => $item['id_agent_module']));
|
||||||
@ -2139,7 +2154,7 @@ function addGeneralRow() {
|
|||||||
params.push("id_module=" + idModule);
|
params.push("id_module=" + idModule);
|
||||||
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("page=include/ajax/reporting.ajax");
|
params.push("page=include/ajax/reporting.ajax");
|
||||||
jQuery.ajax ({
|
jQuery.ajax ({
|
||||||
data: params.join ("&"),
|
data: params.join ("&"),
|
||||||
@ -2212,6 +2227,7 @@ function chooseType() {
|
|||||||
$("#row_exception_condition").hide();
|
$("#row_exception_condition").hide();
|
||||||
$("#row_show_in_two_columns").hide();
|
$("#row_show_in_two_columns").hide();
|
||||||
$("#row_show_in_landscape").hide();
|
$("#row_show_in_landscape").hide();
|
||||||
|
$('#row_hide_notinit_agents').hide();
|
||||||
$("#row_module_group").hide();
|
$("#row_module_group").hide();
|
||||||
$("#row_servers").hide();
|
$("#row_servers").hide();
|
||||||
$("#row_sort").hide();
|
$("#row_sort").hide();
|
||||||
@ -2313,6 +2329,7 @@ function chooseType() {
|
|||||||
$("#row_show_graph").show();
|
$("#row_show_graph").show();
|
||||||
$("#row_show_in_two_columns").show();
|
$("#row_show_in_two_columns").show();
|
||||||
$("#row_sort").show();
|
$("#row_sort").show();
|
||||||
|
$('#row_hide_notinit_agents').show();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'SLA_monthly':
|
case 'SLA_monthly':
|
||||||
@ -2564,6 +2581,7 @@ function chooseType() {
|
|||||||
$("#row_show_in_two_columns").show();
|
$("#row_show_in_two_columns").show();
|
||||||
$("#row_show_resume").show();
|
$("#row_show_resume").show();
|
||||||
$("#row_working_time").show();
|
$("#row_working_time").show();
|
||||||
|
$('#row_hide_notinit_agents').show();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'group_report':
|
case 'group_report':
|
||||||
|
@ -1101,6 +1101,7 @@ switch ($action) {
|
|||||||
$style = array();
|
$style = array();
|
||||||
$style['show_in_two_columns'] = get_parameter('show_in_two_columns', 0);
|
$style['show_in_two_columns'] = get_parameter('show_in_two_columns', 0);
|
||||||
$style['show_in_landscape'] = get_parameter('show_in_landscape', 0);
|
$style['show_in_landscape'] = get_parameter('show_in_landscape', 0);
|
||||||
|
$style['hide_notinit_agents'] = get_parameter('hide_notinit_agents', 0);
|
||||||
|
|
||||||
switch ($values['type']) {
|
switch ($values['type']) {
|
||||||
case 'event_report_agent':
|
case 'event_report_agent':
|
||||||
@ -1362,6 +1363,7 @@ switch ($action) {
|
|||||||
$style = array();
|
$style = array();
|
||||||
$style['show_in_two_columns'] = get_parameter('show_in_two_columns', 0);
|
$style['show_in_two_columns'] = get_parameter('show_in_two_columns', 0);
|
||||||
$style['show_in_landscape'] = get_parameter('show_in_landscape', 0);
|
$style['show_in_landscape'] = get_parameter('show_in_landscape', 0);
|
||||||
|
$style['hide_notinit_agents'] = get_parameter('hide_notinit_agents', 0);
|
||||||
|
|
||||||
switch ($values['type']) {
|
switch ($values['type']) {
|
||||||
case 'event_report_agent':
|
case 'event_report_agent':
|
||||||
|
@ -476,6 +476,7 @@ function reporting_SLA($report, $content, $type = 'dinamic',
|
|||||||
$height = $force_height_chart;
|
$height = $force_height_chart;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$return["id_rc"] = $content['id_rc'];
|
||||||
|
|
||||||
$edge_interval = 10;
|
$edge_interval = 10;
|
||||||
|
|
||||||
@ -3733,7 +3734,6 @@ function reporting_sql($report, $content) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function reporting_availability($report, $content) {
|
function reporting_availability($report, $content) {
|
||||||
|
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
$return = array();
|
$return = array();
|
||||||
@ -3751,6 +3751,8 @@ function reporting_availability($report, $content) {
|
|||||||
$report,
|
$report,
|
||||||
$content);
|
$content);
|
||||||
|
|
||||||
|
$return['id_rc'] = $content['id_rc'];
|
||||||
|
|
||||||
if ($content['show_graph']) {
|
if ($content['show_graph']) {
|
||||||
$return['kind_availability'] = "address";
|
$return['kind_availability'] = "address";
|
||||||
}
|
}
|
||||||
|
@ -281,6 +281,11 @@ function reporting_html_print_report($report, $mini = false) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function reporting_html_SLA($table, $item, $mini) {
|
function reporting_html_SLA($table, $item, $mini) {
|
||||||
|
$style = db_get_value('style', 'treport_content', 'id_rc', $item['id_rc']);
|
||||||
|
$style = json_decode(io_safe_output($style), true);
|
||||||
|
$hide_notinit_agent = $style['hide_notinit_agents'];
|
||||||
|
$same_agent_in_resume = "";
|
||||||
|
|
||||||
if ($mini) {
|
if ($mini) {
|
||||||
$font_size = '1.5';
|
$font_size = '1.5';
|
||||||
}
|
}
|
||||||
@ -331,29 +336,60 @@ function reporting_html_SLA($table, $item, $mini) {
|
|||||||
$table1->headstyle[5] = 'text-align: right';
|
$table1->headstyle[5] = 'text-align: right';
|
||||||
|
|
||||||
foreach ($item['data'] as $sla) {
|
foreach ($item['data'] as $sla) {
|
||||||
$row = array();
|
$the_first_men_time = get_agent_first_time(io_safe_output($sla['agent']));
|
||||||
$row[] = $sla['agent'];
|
if (!$hide_notinit_agent) {
|
||||||
$row[] = $sla['module'];
|
$row = array();
|
||||||
$row[] = $sla['max'] . " / " . $sla['min'];
|
$row[] = $sla['agent'];
|
||||||
$row[] = round($sla['sla_limit'], 2) . "%";
|
$row[] = $sla['module'];
|
||||||
|
$row[] = $sla['max'] . " / " . $sla['min'];
|
||||||
if ($sla['sla_value_unknown']) {
|
$row[] = round($sla['sla_limit'], 2) . "%";
|
||||||
$row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_UNKNOWN.';">' .
|
|
||||||
__('N/A') . '</span>';
|
if ($sla['sla_value_unknown']) {
|
||||||
$row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_UNKNOWN.';">' .
|
$row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_UNKNOWN.';">' .
|
||||||
__('Unknown') . '</span>';
|
__('N/A') . '</span>';
|
||||||
}
|
$row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_UNKNOWN.';">' .
|
||||||
elseif ($sla['sla_status']) {
|
__('Unknown') . '</span>';
|
||||||
$row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_NORMAL.';">' .
|
}
|
||||||
round($sla['sla_value'], 2) . "%" . '</span>';
|
elseif ($sla['sla_status']) {
|
||||||
$row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_NORMAL.';">' .
|
$row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_NORMAL.';">' .
|
||||||
__('OK') . '</span>';
|
round($sla['sla_value'], 2) . "%" . '</span>';
|
||||||
|
$row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_NORMAL.';">' .
|
||||||
|
__('OK') . '</span>';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_CRITICAL.';">' .
|
||||||
|
round($sla['sla_value'], 2) . "%" . '</span>';
|
||||||
|
$row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_CRITICAL.';">' .
|
||||||
|
__('Fail') . '</span>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_CRITICAL.';">' .
|
if ($item['date']['to'] > $the_first_men_time) {
|
||||||
round($sla['sla_value'], 2) . "%" . '</span>';
|
$row = array();
|
||||||
$row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_CRITICAL.';">' .
|
$row[] = $sla['agent'];
|
||||||
__('Fail') . '</span>';
|
$row[] = $sla['module'];
|
||||||
|
$row[] = $sla['max'] . " / " . $sla['min'];
|
||||||
|
$row[] = round($sla['sla_limit'], 2) . "%";
|
||||||
|
|
||||||
|
if ($sla['sla_value_unknown']) {
|
||||||
|
$row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_UNKNOWN.';">' .
|
||||||
|
__('N/A') . '</span>';
|
||||||
|
$row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_UNKNOWN.';">' .
|
||||||
|
__('Unknown') . '</span>';
|
||||||
|
}
|
||||||
|
elseif ($sla['sla_status']) {
|
||||||
|
$row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_NORMAL.';">' .
|
||||||
|
round($sla['sla_value'], 2) . "%" . '</span>';
|
||||||
|
$row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_NORMAL.';">' .
|
||||||
|
__('OK') . '</span>';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_CRITICAL.';">' .
|
||||||
|
round($sla['sla_value'], 2) . "%" . '</span>';
|
||||||
|
$row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_CRITICAL.';">' .
|
||||||
|
__('Fail') . '</span>';
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$table1->data[] = $row;
|
$table1->data[] = $row;
|
||||||
@ -1641,6 +1677,10 @@ function reporting_html_text(&$table, $item) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function reporting_html_availability(&$table, $item) {
|
function reporting_html_availability(&$table, $item) {
|
||||||
|
$style = db_get_value('style', 'treport_content', 'id_rc', $item['id_rc']);
|
||||||
|
$style = json_decode(io_safe_output($style), true);
|
||||||
|
$hide_notinit_agent = $style['hide_notinit_agents'];
|
||||||
|
$same_agent_in_resume = "";
|
||||||
|
|
||||||
if (!empty($item["data"])) {
|
if (!empty($item["data"])) {
|
||||||
$table1 = new stdClass();
|
$table1 = new stdClass();
|
||||||
@ -1682,15 +1722,35 @@ function reporting_html_availability(&$table, $item) {
|
|||||||
$table1->style[7] = 'text-align: right';
|
$table1->style[7] = 'text-align: right';
|
||||||
|
|
||||||
foreach ($item['data'] as $row) {
|
foreach ($item['data'] as $row) {
|
||||||
$table_row = array();
|
$the_first_men_time = get_agent_first_time(io_safe_output($row['agent']));
|
||||||
$table_row[] = $row['agent'];
|
|
||||||
$table_row[] = $row['availability_item'];
|
if (!$hide_notinit_agent) {
|
||||||
$table_row[] = $row['checks'];
|
$table_row = array();
|
||||||
$table_row[] = $row['failed'];
|
$table_row[] = $row['agent'];
|
||||||
$table_row[] = $row['fail'];
|
$table_row[] = $row['availability_item'];
|
||||||
$table_row[] = $row['poling_time'];
|
$table_row[] = $row['checks'];
|
||||||
$table_row[] = $row['time_unavaliable'];
|
$table_row[] = $row['failed'];
|
||||||
$table_row[] = $row['ok'];
|
$table_row[] = $row['fail'];
|
||||||
|
$table_row[] = $row['poling_time'];
|
||||||
|
$table_row[] = $row['time_unavaliable'];
|
||||||
|
$table_row[] = $row['ok'];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if ($item['date']['to'] > $the_first_men_time) {
|
||||||
|
$table_row = array();
|
||||||
|
$table_row[] = $row['agent'];
|
||||||
|
$table_row[] = $row['availability_item'];
|
||||||
|
$table_row[] = $row['checks'];
|
||||||
|
$table_row[] = $row['failed'];
|
||||||
|
$table_row[] = $row['fail'];
|
||||||
|
$table_row[] = $row['poling_time'];
|
||||||
|
$table_row[] = $row['time_unavaliable'];
|
||||||
|
$table_row[] = $row['ok'];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$same_agent_in_resume = $row['agent'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$table1->data[] = $table_row;
|
$table1->data[] = $table_row;
|
||||||
}
|
}
|
||||||
@ -1710,45 +1770,56 @@ function reporting_html_availability(&$table, $item) {
|
|||||||
$table1->width = '99%';
|
$table1->width = '99%';
|
||||||
$table1->data = array ();
|
$table1->data = array ();
|
||||||
|
|
||||||
|
if (($same_agent_in_resume == "") && (strpos($item['resume']['min_text'], $same_agent_in_resume) === false)) {
|
||||||
|
$table1->head = array ();
|
||||||
$table1->head = array ();
|
$table1->head['min_text'] = __('Agent max');
|
||||||
$table1->head['min_text'] = __('Agent max');
|
$table1->head['min'] = __('Min Value');
|
||||||
$table1->head['min'] = __('Min Value');
|
$table1->head['avg'] = __('Average Value');
|
||||||
$table1->head['avg'] = __('Average Value');
|
$table1->head['max_text'] = __('Agent min');
|
||||||
$table1->head['max_text'] = __('Agent min');
|
$table1->head['max'] = __('Max Value');
|
||||||
$table1->head['max'] = __('Max Value');
|
|
||||||
|
$table1->headstyle = array();
|
||||||
$table1->headstyle = array();
|
$table1->headstyle['min_text'] = 'text-align: left';
|
||||||
$table1->headstyle['min_text'] = 'text-align: left';
|
$table1->headstyle['min'] = 'text-align: right';
|
||||||
$table1->headstyle['min'] = 'text-align: right';
|
$table1->headstyle['avg'] = 'text-align: right';
|
||||||
$table1->headstyle['avg'] = 'text-align: right';
|
$table1->headstyle['max_text'] = 'text-align: left';
|
||||||
$table1->headstyle['max_text'] = 'text-align: left';
|
$table1->headstyle['max'] = 'text-align: right';
|
||||||
$table1->headstyle['max'] = 'text-align: right';
|
|
||||||
|
|
||||||
|
$table1->style = array();
|
||||||
$table1->style = array();
|
$table1->style['min_text'] = 'text-align: left';
|
||||||
$table1->style['min_text'] = 'text-align: left';
|
$table1->style['min'] = 'text-align: right';
|
||||||
$table1->style['min'] = 'text-align: right';
|
$table1->style['avg'] = 'text-align: right';
|
||||||
$table1->style['avg'] = 'text-align: right';
|
$table1->style['max_text'] = 'text-align: left';
|
||||||
$table1->style['max_text'] = 'text-align: left';
|
$table1->style['max'] = 'text-align: right';
|
||||||
$table1->style['max'] = 'text-align: right';
|
|
||||||
|
$table1->data[] = array(
|
||||||
$table1->data[] = array(
|
'min_text' => $item['resume']['min_text'],
|
||||||
'min_text' => $item['resume']['min_text'],
|
'min' => format_numeric($item['resume']['min'], 2) . "%",
|
||||||
'min' => format_numeric($item['resume']['min'], 2) . "%",
|
'avg' => format_numeric($item['resume']['avg'], 2) . "%",
|
||||||
'avg' => format_numeric($item['resume']['avg'], 2) . "%",
|
'max_text' => $item['resume']['max_text'],
|
||||||
'max_text' => $item['resume']['max_text'],
|
'max' => format_numeric($item['resume']['max'], 2) . "%"
|
||||||
'max' => format_numeric($item['resume']['max'], 2) . "%"
|
);
|
||||||
);
|
|
||||||
|
$table->colspan[2][0] = 3;
|
||||||
$table->colspan[2][0] = 3;
|
$data = array();
|
||||||
$data = array();
|
$data[0] = html_print_table($table1, true);
|
||||||
$data[0] = html_print_table($table1, true);
|
array_push ($table->data, $data);
|
||||||
array_push ($table->data, $data);
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function get_agent_first_time ($agent_name) {
|
||||||
|
$id = agents_get_agent_id($agent_name, true);
|
||||||
|
|
||||||
|
$utimestamp = db_get_all_rows_sql("SELECT utimestamp FROM tagente_datos WHERE id_agente_modulo IN
|
||||||
|
(SELECT id_agente_modulo FROM tagente_modulo WHERE id_agente = " . $id . ")
|
||||||
|
ORDER BY utimestamp ASC LIMIT 1");
|
||||||
|
$utimestamp = $utimestamp[0]['utimestamp'];
|
||||||
|
|
||||||
|
return $utimestamp;
|
||||||
|
}
|
||||||
|
|
||||||
function reporting_html_general(&$table, $item) {
|
function reporting_html_general(&$table, $item) {
|
||||||
|
|
||||||
if (!empty($item["data"])) {
|
if (!empty($item["data"])) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user