From 557002d7fd94f5ae6f0c5b5f0075b6542dee39d8 Mon Sep 17 00:00:00 2001 From: daniel Date: Fri, 23 Nov 2018 10:32:58 +0100 Subject: [PATCH] fixed error events graphs --- pandora_console/include/functions_graph.php | 20 +++++++++---------- .../include/functions_treeview.php | 11 +++------- .../agentes/estado_generalagente.php | 2 +- 3 files changed, 13 insertions(+), 20 deletions(-) diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index cc993331ec..2953b6843d 100644 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -3188,16 +3188,14 @@ function graph_custom_sql_graph ($id, $width, $height, * @param string homeurl * @param bool return or echo the result */ -function graph_graphic_agentevents ($id_agent, $width, $height, $period = 0, $homeurl, $return = false, $from_agent_view = false) { +function graph_graphic_agentevents ($id_agent, $width, $height, $period = 0, $homeurl, $return = false, $from_agent_view = false, $widgets=false) { global $config; global $graphic_type; $data = array (); - //$resolution = $config['graph_res'] * ($period * 2 / $width); // Number of "slices" we want in graph - $resolution = 5 * ($period * 2 / $width); // Number of "slices" we want in graph - - $interval = (int) ($period / $resolution); + //TODO interval + $interval = 24; $date = get_system_time (); $datelimit = $date - $period; $periodtime = floor ($period / $interval); @@ -3206,7 +3204,7 @@ function graph_graphic_agentevents ($id_agent, $width, $height, $period = 0, $ho $legend = array(); $full_legend = array(); $full_legend_date = array(); - + $cont = 0; for ($i = 0; $i < $interval; $i++) { $bottom = $datelimit + ($periodtime * $i); @@ -3216,24 +3214,24 @@ function graph_graphic_agentevents ($id_agent, $width, $height, $period = 0, $ho else { $name = $bottom; } - + // Show less values in legend if ($cont == 0 or $cont % 2) $legend[$cont] = $name; - + if ($from_agent_view) { $full_date = date('Y/m/d', $bottom); $full_legend_date[$cont] = $full_date; } $full_legend[$cont] = $name; - + $top = $datelimit + ($periodtime * ($i + 1)); $event = db_get_row_filter ('tevento', array ('id_agente' => $id_agent, 'utimestamp > '.$bottom, 'utimestamp < '.$top), 'criticity, utimestamp'); - + if (!empty($event['utimestamp'])) { $data[$cont]['utimestamp'] = $periodtime; switch ($event['criticity']) { @@ -3258,7 +3256,7 @@ function graph_graphic_agentevents ($id_agent, $width, $height, $period = 0, $ho $colors = array(1 => COL_NORMAL, 2 => COL_WARNING, 3 => COL_CRITICAL, 4 => COL_UNKNOWN); // Draw slicebar graph - $out = flot_slicesbar_graph($data, $period, 100, 40, $full_legend, $colors, $config['fontpath'], $config['round_corner'], $homeurl, '', '', false, $id_agent, $full_legend_date); + $out = flot_slicesbar_graph($data, $period, $width, $height, $full_legend, $colors, $config['fontpath'], $config['round_corner'], $homeurl, '', '', false, $id_agent, $full_legend_date, 0, 1, $widgets); if ($return) { return $out; diff --git a/pandora_console/include/functions_treeview.php b/pandora_console/include/functions_treeview.php index 1fd26770c5..72a222becd 100755 --- a/pandora_console/include/functions_treeview.php +++ b/pandora_console/include/functions_treeview.php @@ -714,20 +714,15 @@ function treeview_printTable($id_agente, $server_data = array(), $no_head = fals ui_toggle($table_advanced, __('Advanced information')); - // Blank space below title, DONT remove this, this - // Breaks the layout when Flash charts are enabled :-o - //echo '
 
'; - if ($config["agentaccess"]) { $access_graph = '
'; - $access_graph .= graphic_agentaccess($id_agente, 380, 120, SECONDS_1DAY, true, true); + $access_graph .= graphic_agentaccess ($id_agente, 380, 120, SECONDS_1DAY, true, true); $access_graph .= '
'; ui_toggle($access_graph, __('Agent access rate (24h)')); } - $events_graph = '
'; - $events_graph .= graph_graphic_agentevents ($id_agente, 290, 15, - SECONDS_1DAY, '', true); + $events_graph = '
'; + $events_graph .= graph_graphic_agentevents ($id_agente, 375, 45, SECONDS_1DAY, '', true, false, true); $events_graph .= '

'; ui_toggle($events_graph, __('Events (24h)')); diff --git a/pandora_console/operation/agentes/estado_generalagente.php b/pandora_console/operation/agentes/estado_generalagente.php index e6f5a0d289..751f4f481c 100755 --- a/pandora_console/operation/agentes/estado_generalagente.php +++ b/pandora_console/operation/agentes/estado_generalagente.php @@ -645,7 +645,7 @@ $data[0][0] .= __('Events (24h)') . '' . '
' . - graph_graphic_agentevents ($id_agente, 450, 40, SECONDS_1DAY, '', true, true) . + graph_graphic_agentevents ($id_agente, 100, 45, SECONDS_1DAY, '', true, true) . '
' . '';