2014-06-04 Sergio Martin <sergio.martin@artica.es>
* include/constants.php include/functions_graph.php include/functions_reporting.php include/graphs/functions_pchart.php include/graphs/functions_flot.php include/functions.php include/functions_events.php: Fix a lot of errors on events items on reports using now the same query as events view, etc. * include/styles/pandora.css: Little aesthetic improvement in focus buttons and unset webfont git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@10105 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
945bcf23d6
commit
0f2c9f28c5
|
@ -1,3 +1,18 @@
|
|||
2014-06-04 Sergio Martin <sergio.martin@artica.es>
|
||||
|
||||
* include/constants.php
|
||||
include/functions_graph.php
|
||||
include/functions_reporting.php
|
||||
include/graphs/functions_pchart.php
|
||||
include/graphs/functions_flot.php
|
||||
include/functions.php
|
||||
include/functions_events.php: Fix a lot of errors
|
||||
on events items on reports using now the same query
|
||||
as events view, etc.
|
||||
|
||||
* include/styles/pandora.css: Little aesthetic
|
||||
improvement in focus buttons and unset webfont
|
||||
|
||||
2014-06-04 Miguel de Dios <miguel.dedios@artica.es>
|
||||
|
||||
* include/javascript/mergely/*: added mergely javascript library.
|
||||
|
|
|
@ -126,7 +126,7 @@ define('COL_NORMAL','#6EB432');
|
|||
define('COL_NOTINIT','#3BA0FF');
|
||||
define('COL_UNKNOWN','#AAAAAA');
|
||||
define('COL_ALERTFIRED','#FF8800');
|
||||
define('COL_MINOR','#FF92E9');
|
||||
define('COL_MINOR','#F099A2');
|
||||
define('COL_MAJOR','#C97A4A');
|
||||
define('COL_INFORMATIONAL','#E4E4E4');
|
||||
define('COL_MAINTENANCE','#3BA0FF');
|
||||
|
|
|
@ -1126,6 +1126,45 @@ function get_priority_class($priority) {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get priority style from priority class (CSS class).
|
||||
*
|
||||
* @param string priority class.
|
||||
*
|
||||
* @return string CSS priority class.
|
||||
*/
|
||||
function get_priority_style($priority_class) {
|
||||
switch ($priority_class) {
|
||||
case "datos_blue":
|
||||
$style_css_criticity = 'background-color: ' . COL_INFORMATIONAL . '; color: #FFFFFF;';
|
||||
break;
|
||||
case "datos_grey":
|
||||
$style_css_criticity = 'background-color: ' . COL_UNKNOWN . '; color: #FFFFFF;';
|
||||
break;
|
||||
case "datos_green":
|
||||
$style_css_criticity = 'background-color: ' . COL_NORMAL . '; color: #FFFFFF;';
|
||||
break;
|
||||
case "datos_yellow":
|
||||
$style_css_criticity = 'background-color: ' . COL_WARNING . ';';
|
||||
break;
|
||||
case "datos_red":
|
||||
$style_css_criticity = 'background-color: ' . COL_CRITICAL . '; color: #FFFFFF;';
|
||||
break;
|
||||
case "datos_pink":
|
||||
$style_css_criticity = 'background-color: ' . COL_MINOR . ';';
|
||||
break;
|
||||
case "datos_brown":
|
||||
$style_css_criticity = 'background-color: ' . COL_MAJOR . '; color: #FFFFFF;';
|
||||
break;
|
||||
case "datos_grey":
|
||||
default:
|
||||
$style_css_criticity = 'background-color: ' . COL_UNKNOWN . '; color: #FFFFFF;';
|
||||
break;
|
||||
}
|
||||
|
||||
return $style_css_criticity;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the enterprise version is installed.
|
||||
*
|
||||
|
|
|
@ -1102,22 +1102,10 @@ function events_get_group_events ($id_group, $period, $date,
|
|||
if ($filter_event_no_validated) {
|
||||
$sql_where .= ' AND estado = 0 ';
|
||||
}
|
||||
$sql_where .= sprintf(' AND id_grupo IN (%s) AND utimestamp > %d
|
||||
AND utimestamp <= %d ', implode (",", $id_group), $datelimit, $date);
|
||||
|
||||
|
||||
$sql = sprintf ('SELECT *,
|
||||
(SELECT t2.nombre
|
||||
FROM tagente AS t2
|
||||
WHERE t2.id_agente = t3.id_agente) AS agent_name,
|
||||
(SELECT t2.fullname
|
||||
FROM tusuario AS t2
|
||||
WHERE t2.id_user = t3.id_usuario) AS user_name
|
||||
FROM tevento AS t3
|
||||
WHERE utimestamp > %d AND utimestamp <= %d
|
||||
AND id_grupo IN (%s) ' . $sql_where . '
|
||||
ORDER BY utimestamp ASC',
|
||||
$datelimit, $date, implode (",", $id_group));
|
||||
|
||||
return db_get_all_rows_sql ($sql);
|
||||
return events_get_events_grouped($sql_where, 0, 1000);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1205,7 +1193,8 @@ function events_get_agent ($id_agent, $period, $date = 0,
|
|||
|
||||
$datelimit = $date - $period;
|
||||
|
||||
$sql_where = ' AND 1 = 1 ';
|
||||
$sql_where = '';
|
||||
|
||||
$criticities = array();
|
||||
if ($filter_event_critical) {
|
||||
$criticities[] = 4;
|
||||
|
@ -1224,10 +1213,10 @@ function events_get_agent ($id_agent, $period, $date = 0,
|
|||
$sql_where .= ' AND estado = 0 ';
|
||||
}
|
||||
|
||||
$sql_where .= sprintf(' id_agente = %d AND utimestamp > %d
|
||||
$sql_where .= sprintf(' AND id_agente = %d AND utimestamp > %d
|
||||
AND utimestamp <= %d ', $id_agent, $datelimit, $date);
|
||||
|
||||
return events_get_events_grouped($sql_where);
|
||||
return events_get_events_grouped($sql_where, 0, 1000);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1251,6 +1240,11 @@ function events_get_module ($id_agent_module, $period, $date = 0) {
|
|||
|
||||
$datelimit = $date - $period;
|
||||
|
||||
$sql_where .= sprintf(' AND id_agentmodule = %d AND utimestamp > %d
|
||||
AND utimestamp <= %d ', $id_agent_module, $datelimit, $date);
|
||||
|
||||
return events_get_events_grouped($sql_where, 0, 1000);
|
||||
|
||||
$sql = sprintf ('SELECT evento, event_type, criticity, count(*) as count_rep, max(timestamp) AS time2
|
||||
FROM tevento
|
||||
WHERE id_agentmodule = %d AND utimestamp > %d AND utimestamp <= %d
|
||||
|
|
|
@ -4051,4 +4051,35 @@ function graph_nodata_image($width = 300, $height = 110, $type = 'area', $text =
|
|||
|
||||
return $div;
|
||||
}
|
||||
|
||||
function get_criticity_pie_colors ($data_graph) {
|
||||
$colors = array();
|
||||
foreach (array_keys($data_graph) as $crit) {
|
||||
switch ($crit) {
|
||||
case __('Maintenance'):
|
||||
$colors[$crit] = COL_MAINTENANCE;
|
||||
break;
|
||||
case __('Informational'):
|
||||
$colors[$crit] = COL_INFORMATIONAL;
|
||||
break;
|
||||
case __('Normal'):
|
||||
$colors[$crit] = COL_NORMAL;
|
||||
break;
|
||||
case __('Warning'):
|
||||
$colors[$crit] = COL_WARNING;
|
||||
break;
|
||||
case __('Critical'):
|
||||
$colors[$crit] = COL_CRITICAL;
|
||||
break;
|
||||
case __('Minor'):
|
||||
$colors[$crit] = COL_MINOR;
|
||||
break;
|
||||
case __('Major'):
|
||||
$colors[$crit] = COL_MAJOR;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return $colors;
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -2555,7 +2555,11 @@ function reporting_get_agents_detailed_event ($id_agents, $period = 0,
|
|||
}
|
||||
}
|
||||
|
||||
if ($events)
|
||||
if ($events) {
|
||||
$note = '';
|
||||
if (count($events) >= 1000) {
|
||||
$note .= '* ' . __('Maximum of events shown') . ' (1000)<br>';
|
||||
}
|
||||
foreach ($events as $eventRow) {
|
||||
foreach ($eventRow as $k => $event) {
|
||||
//First pass along the class of this row
|
||||
|
@ -2583,7 +2587,6 @@ function reporting_get_agents_detailed_event ($id_agents, $period = 0,
|
|||
$data[] = html_print_image ($img_st, true,
|
||||
array ("class" => "image_status",
|
||||
"width" => 16,
|
||||
"height" => 16,
|
||||
"title" => $title_st));
|
||||
|
||||
$data[] = $event['event_rep'];
|
||||
|
@ -2607,9 +2610,10 @@ function reporting_get_agents_detailed_event ($id_agents, $period = 0,
|
|||
array_push ($table->data, $data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($events)
|
||||
return html_print_table ($table, $return);
|
||||
return html_print_table ($table, $return) . $note;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2628,6 +2632,8 @@ function reporting_get_group_detailed_event ($id_group, $period = 0,
|
|||
$filter_event_validated = false, $filter_event_critical = false,
|
||||
$filter_event_warning = false, $filter_event_no_validated = false) {
|
||||
|
||||
global $config;
|
||||
|
||||
if (!is_numeric ($date)) {
|
||||
$date = strtotime ($date);
|
||||
}
|
||||
|
@ -2661,6 +2667,10 @@ function reporting_get_group_detailed_event ($id_group, $period = 0,
|
|||
$filter_event_warning, $filter_event_no_validated);
|
||||
|
||||
if ($events) {
|
||||
$note = '';
|
||||
if (count($events) >= 1000) {
|
||||
$note .= '* ' . __('Maximum of events shown') . ' (1000)<br>';
|
||||
}
|
||||
foreach ($events as $k => $event) {
|
||||
//First pass along the class of this row
|
||||
$table->cellclass[$k][1] = $table->cellclass[$k][3] =
|
||||
|
@ -2688,7 +2698,6 @@ function reporting_get_group_detailed_event ($id_group, $period = 0,
|
|||
$data[] = html_print_image ($img_st, true,
|
||||
array ("class" => "image_status",
|
||||
"width" => 16,
|
||||
"height" => 16,
|
||||
"title" => $title_st,
|
||||
"id" => 'status_img_' . $event["id_evento"]));
|
||||
|
||||
|
@ -2699,20 +2708,26 @@ function reporting_get_group_detailed_event ($id_group, $period = 0,
|
|||
//$data[1] = $event['event_type'];
|
||||
$data[] = events_print_type_img ($event["event_type"], true);
|
||||
|
||||
if (!empty($event['agent_name']))
|
||||
$data[] = $event['agent_name'];
|
||||
if (!empty($event['id_agente']))
|
||||
$data[] = agents_get_name($event['id_agente']);
|
||||
else
|
||||
$data[] = __('Pandora System');
|
||||
$data[] = get_priority_name ($event['criticity']);
|
||||
$data[] = io_safe_output($event['user_name']);
|
||||
if (empty($event['id_usuario']) && $event['estado'] == EVENT_VALIDATE) {
|
||||
$data[] = '<i>' . __('System') . '</i>';
|
||||
}
|
||||
else {
|
||||
$user_name = db_get_value ('fullname', 'tusuario', 'id_user', $event['id_usuario']);
|
||||
$data[] = io_safe_output($user_name);
|
||||
}
|
||||
$data[] = '<font style="font-size: 6pt;">' .
|
||||
$event['timestamp'] .
|
||||
date($config['date_format'], $event['timestamp_rep']) .
|
||||
'</font>';
|
||||
array_push ($table->data, $data);
|
||||
}
|
||||
|
||||
if ($html) {
|
||||
return html_print_table ($table, $return);
|
||||
return html_print_table ($table, $return) . $note;
|
||||
}
|
||||
else {
|
||||
return $table;
|
||||
|
@ -2739,6 +2754,8 @@ function reporting_get_group_detailed_event ($id_group, $period = 0,
|
|||
* @return mixed A table object (XHTML) or object table is false the html.
|
||||
*/
|
||||
function reporting_get_module_detailed_event ($id_modules, $period = 0, $date = 0, $return = false, $html = true) {
|
||||
global $config;
|
||||
|
||||
$id_modules = (array)safe_int ($id_modules, 1);
|
||||
|
||||
if (!is_numeric ($date)) {
|
||||
|
@ -2755,11 +2772,14 @@ function reporting_get_module_detailed_event ($id_modules, $period = 0, $date =
|
|||
$table->width = '99%';
|
||||
$table->data = array ();
|
||||
$table->head = array ();
|
||||
$table->head[0] = __('Event name');
|
||||
$table->head[1] = __('Event type');
|
||||
$table->head[2] = __('Criticity');
|
||||
$table->head[3] = __('Count');
|
||||
$table->head[4] = __('Timestamp');
|
||||
$table->head[0] = __('Status');
|
||||
$table->head[1] = __('Event name');
|
||||
$table->head[2] = __('Event type');
|
||||
$table->head[3] = __('Criticity');
|
||||
$table->head[4] = __('Count');
|
||||
$table->head[5] = __('Timestamp');
|
||||
$table->style[0] = 'text-align: center;';
|
||||
$table->style[4] = 'text-align: center;';
|
||||
|
||||
$events = array ();
|
||||
|
||||
|
@ -2771,20 +2791,51 @@ function reporting_get_module_detailed_event ($id_modules, $period = 0, $date =
|
|||
}
|
||||
|
||||
if ($events) {
|
||||
$note = '';
|
||||
if (count($events) >= 1000) {
|
||||
$note .= '* ' . __('Maximum of events shown') . ' (1000)<br>';
|
||||
}
|
||||
foreach ($events as $eventRow) {
|
||||
foreach ($eventRow as $event) {
|
||||
foreach ($eventRow as $k => $event) {
|
||||
//$k = count($table->data);
|
||||
$table->cellclass[$k][1] = $table->cellclass[$k][2] =
|
||||
$table->cellclass[$k][3] = $table->cellclass[$k][4] =
|
||||
$table->cellclass[$k][5] = get_priority_class ($event["criticity"]);
|
||||
|
||||
$data = array ();
|
||||
$data[0] = io_safe_output($event['evento']);
|
||||
$data[1] = $event['event_type'];
|
||||
$data[2] = get_priority_name ($event['criticity']);
|
||||
$data[3] = $event['count_rep'];
|
||||
$data[4] = $event['time2'];
|
||||
|
||||
// Colored box
|
||||
switch ($event['estado']) {
|
||||
case 0:
|
||||
$img_st = "images/star.png";
|
||||
$title_st = __('New event');
|
||||
break;
|
||||
case 1:
|
||||
$img_st = "images/tick.png";
|
||||
$title_st = __('Event validated');
|
||||
break;
|
||||
case 2:
|
||||
$img_st = "images/hourglass.png";
|
||||
$title_st = __('Event in process');
|
||||
break;
|
||||
}
|
||||
$data[0] = html_print_image ($img_st, true,
|
||||
array ("class" => "image_status",
|
||||
"width" => 16,
|
||||
"title" => $title_st,
|
||||
"id" => 'status_img_' . $event["id_evento"]));
|
||||
|
||||
$data[1] = io_safe_output($event['evento']);
|
||||
$data[2] = $event['event_type'];
|
||||
$data[3] = get_priority_name ($event['criticity']);
|
||||
$data[4] = $event['event_rep'];
|
||||
$data[5] = date($config['date_format'], $event['timestamp_rep']);
|
||||
array_push ($table->data, $data);
|
||||
}
|
||||
}
|
||||
|
||||
if ($html) {
|
||||
return html_print_table ($table, $return);
|
||||
return html_print_table ($table, $return) . $note;
|
||||
}
|
||||
else {
|
||||
return $table;
|
||||
|
@ -3802,6 +3853,8 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
|||
$filter_event_no_validated);
|
||||
|
||||
$table_event_graph = null;
|
||||
$table_event_graph->width = '100%';
|
||||
$table_event_graph->style[0] = 'text-align: center;';
|
||||
$table_event_graph->head[0] = __('Events validated by user');
|
||||
|
||||
$table_event_graph->data[0][0] = pie3d_graph(
|
||||
|
@ -3825,13 +3878,17 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
|||
$filter_event_warning,
|
||||
$filter_event_no_validated);
|
||||
|
||||
$colors = get_criticity_pie_colors($data_graph);
|
||||
|
||||
$table_event_graph = null;
|
||||
$table_event_graph->width = '100%';
|
||||
$table_event_graph->style[0] = 'text-align: center;';
|
||||
$table_event_graph->head[0] = __('Events by criticity');
|
||||
|
||||
$table_event_graph->data[0][0] = pie3d_graph(
|
||||
false, $data_graph, 500, 150, __("other"), "",
|
||||
$config['homedir'] . "/images/logo_vertical_water.png",
|
||||
$config['fontpath'], $config['font_size']);
|
||||
$config['fontpath'], $config['font_size'], 1, false, $colors);
|
||||
|
||||
$data[0] = html_print_table($table_event_graph, true);
|
||||
|
||||
|
@ -3850,6 +3907,8 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
|||
$filter_event_no_validated);
|
||||
|
||||
$table_event_graph = null;
|
||||
$table_event_graph->width = '100%';
|
||||
$table_event_graph->style[0] = 'text-align: center;';
|
||||
$table_event_graph->head[0] = __('Amount events validated');
|
||||
|
||||
$table_event_graph->data[0][0] = pie3d_graph(
|
||||
|
@ -4061,6 +4120,8 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
|||
$filter_event_no_validated);
|
||||
|
||||
$table_event_graph = null;
|
||||
$table_event_graph->width = '100%';
|
||||
$table_event_graph->style[0] = 'text-align: center;';
|
||||
$table_event_graph->head[0] = __('Events by agent');
|
||||
|
||||
$table_event_graph->data[0][0] = pie3d_graph(
|
||||
|
@ -4086,6 +4147,8 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
|||
|
||||
$table_event_graph = null;
|
||||
$table_event_graph->head[0] = __('Events validated by user');
|
||||
$table_event_graph->width = '100%';
|
||||
$table_event_graph->style[0] = 'text-align: center;';
|
||||
|
||||
$table_event_graph->data[0][0] = pie3d_graph(
|
||||
false, $data_graph, 500, 150, __("other"), "",
|
||||
|
@ -4108,13 +4171,17 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
|||
$filter_event_warning,
|
||||
$filter_event_no_validated);
|
||||
|
||||
$colors = get_criticity_pie_colors($data_graph);
|
||||
|
||||
$table_event_graph = null;
|
||||
$table_event_graph->head[0] = __('Events by criticity');
|
||||
$table_event_graph->width = '100%';
|
||||
$table_event_graph->style[0] = 'text-align: center;';
|
||||
|
||||
$table_event_graph->data[0][0] = pie3d_graph(
|
||||
false, $data_graph, 500, 150, __("other"), "",
|
||||
$config['homedir'] . "/images/logo_vertical_water.png",
|
||||
$config['fontpath'], $config['font_size']);
|
||||
$config['fontpath'], $config['font_size'], 1, false, $colors);
|
||||
|
||||
$data[0] = html_print_table($table_event_graph, true);
|
||||
|
||||
|
@ -4134,6 +4201,8 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
|||
|
||||
$table_event_graph = null;
|
||||
$table_event_graph->head[0] = __('Amount events validated');
|
||||
$table_event_graph->width = '100%';
|
||||
$table_event_graph->style[0] = 'text-align: center;';
|
||||
|
||||
$table_event_graph->data[0][0] = pie3d_graph(
|
||||
false, $data_graph, 500, 150, __("other"), "",
|
||||
|
|
|
@ -414,10 +414,9 @@ function pch_pie_graph ($graph_type, $data_values, $legend_values, $width,
|
|||
|
||||
/* Create the pPie object */
|
||||
$PieChart = new pPie($myPicture,$MyData);
|
||||
|
||||
foreach ($data_values as $key => $value) {
|
||||
if (isset($colors[$key])) {
|
||||
$PieChart->setSliceColor($key, hex_2_rgb($colors[$key]));
|
||||
foreach ($legend_values as $key => $value) {
|
||||
if (isset($colors[$value])) {
|
||||
$PieChart->setSliceColor($key, hex_2_rgb($colors[$value]));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ Description: The default Pandora FMS theme layout
|
|||
*/
|
||||
|
||||
* {
|
||||
font-family: Nunito, verdana, sans-serif;
|
||||
font-family: verdana, sans-serif;
|
||||
letter-spacing: 0.03pt;
|
||||
font-size: 8pt;
|
||||
color: #3F3F3F;
|
||||
|
@ -448,7 +448,7 @@ IMG.login_logo {
|
|||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
a:focus, input:focus {
|
||||
a:focus, input:focus, button:focus {
|
||||
utline-width: 0;
|
||||
outline: 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue