2013-01-03 Miguel de Dios <miguel.dedios@artica.es>

* extensions/resource_registration.php,
	extensions/resource_exportation.php,
	operation/events/event_statistics.php,
	operation/events/events_list.php,
	operation/reporting/reporting_viewer.php,
	godmode/reporting/reporting_builder.php,
	godmode/reporting/reporting_builder.item_editor.php,
	include/functions_alerts.php, include/functions_reports.php,
	include/functions_events.php, include/graphs/fgraph.php,
	include/functions_graph.php, include/styles/pandora.css,
	include/functions_reporting.php, include/functions_agents.php: a lot
	of changes and fixes from the branch for the reports.
	
	MERGED FROM PANDORA_4.0




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7351 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2013-01-03 18:52:21 +00:00
parent 6007bf45ea
commit d99abb39bb
16 changed files with 1630 additions and 451 deletions

View File

@ -1,3 +1,20 @@
2013-01-03 Miguel de Dios <miguel.dedios@artica.es>
* extensions/resource_registration.php,
extensions/resource_exportation.php,
operation/events/event_statistics.php,
operation/events/events_list.php,
operation/reporting/reporting_viewer.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/reporting_builder.item_editor.php,
include/functions_alerts.php, include/functions_reports.php,
include/functions_events.php, include/graphs/fgraph.php,
include/functions_graph.php, include/styles/pandora.css,
include/functions_reporting.php, include/functions_agents.php: a lot
of changes and fixes from the branch for the reports.
MERGED FROM PANDORA_4.0
2013-01-02 Juan Manuel Ramon <juanmanuel.ramon@artica.es> 2013-01-02 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
* extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql * extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql

View File

@ -209,6 +209,8 @@ function output_xml_report($id) {
break; break;
case 'alert_report_agent': case 'alert_report_agent':
break; break;
case 'alert_report_group':
break;
case 'url': case 'url':
echo "<url><![CDATA[" . io_safe_output($values["external_source"]) . "]]></url>"; echo "<url><![CDATA[" . io_safe_output($values["external_source"]) . "]]></url>";
break; break;

View File

@ -301,6 +301,8 @@ function process_upload_xml_report($xml, $group_filter = 0) {
break; break;
case 'alert_report_agent': case 'alert_report_agent':
break; break;
case 'alert_report_group':
break;
case 'url': case 'url':
$values["external_source"] = io_safe_input($item['url']); $values["external_source"] = io_safe_input($item['url']);
break; break;

View File

@ -78,6 +78,16 @@ $sla_sorted_by = 0;
$id_agents = ''; $id_agents = '';
$inventory_modules = array(); $inventory_modules = array();
$date = null; $date = null;
//Added for events items
$filter_event_validated = false;
$filter_event_critical = false;
$filter_event_warning = false;
$event_graph_by_agent = false;
$event_graph_by_user_validator = false;
$event_graph_by_criticity = false;
$event_graph_validated_vs_unvalidated = false;
$netflow_filter = 0; $netflow_filter = 0;
$max_values = 0; $max_values = 0;
$resolution = 0; $resolution = 0;
@ -85,7 +95,6 @@ $resolution = 0;
switch ($action) { switch ($action) {
case 'new': case 'new':
$actionParameter = 'save'; $actionParameter = 'save';
$type = get_parameter('type', 'SLA'); $type = get_parameter('type', 'SLA');
$description = null; $description = null;
$sql = null; $sql = null;
@ -308,15 +317,40 @@ switch ($action) {
$idAgent = db_get_value_filter('id_agente', 'tagente_modulo', array('id_agente' => $item['id_agent'])); $idAgent = db_get_value_filter('id_agente', 'tagente_modulo', array('id_agente' => $item['id_agent']));
$period = $item['period']; $period = $item['period'];
break; break;
case 'alert_report_group':
$description = $item['description'];
$period = $item['period'];
$group = $item['id_group'];
break;
case 'event_report_agent': case 'event_report_agent':
$description = $item['description']; $description = $item['description'];
$idAgent = $item['id_agent']; $idAgent = $item['id_agent'];
$period = $item['period']; $period = $item['period'];
//Added for events items
$filter_event_validated = $style['filter_event_validated'];
$filter_event_critical = $style['filter_event_critical'];
$filter_event_warning = $style['filter_event_warning'];
$event_graph_by_agent = $style['event_graph_by_agent'];
$event_graph_by_user_validator = $style['event_graph_by_user_validator'];
$event_graph_by_criticity = $style['event_graph_by_criticity'];
$event_graph_validated_vs_unvalidated = $style['event_graph_validated_vs_unvalidated'];
break; break;
case 'event_report_group': case 'event_report_group':
$description = $item['description']; $description = $item['description'];
$period = $item['period']; $period = $item['period'];
$group = $item['id_group']; $group = $item['id_group'];
//Added for events items
$filter_event_validated = $style['filter_event_validated'];
$filter_event_critical = $style['filter_event_critical'];
$filter_event_warning = $style['filter_event_warning'];
$event_graph_by_agent = $style['event_graph_by_agent'];
$event_graph_by_user_validator = $style['event_graph_by_user_validator'];
$event_graph_by_criticity = $style['event_graph_by_criticity'];
$event_graph_validated_vs_unvalidated = $style['event_graph_validated_vs_unvalidated'];
break; break;
case 'event_report_module': case 'event_report_module':
$description = $item['description']; $description = $item['description'];
@ -333,6 +367,7 @@ switch ($action) {
$show_graph = $item['show_graph']; $show_graph = $item['show_graph'];
break; break;
case 'group_report': case 'group_report':
$description = $item['description'];
$group = $item['id_group']; $group = $item['id_group'];
break; break;
case 'top_n': case 'top_n':
@ -364,6 +399,9 @@ switch ($action) {
$date = $es['date']; $date = $es['date'];
$inventory_modules = $es['inventory_modules']; $inventory_modules = $es['inventory_modules'];
$id_agents = $es['id_agents']; $id_agents = $es['id_agents'];
$idAgent = $es['id_agents'];
$idAgentModule = $inventory_modules;
break; break;
case 'inventory_changes': case 'inventory_changes':
$period = $item['period']; $period = $item['period'];
@ -548,7 +586,8 @@ html_print_input_hidden('id_item', $idItem);
<tr id="row_group" style="" class="datos"> <tr id="row_group" style="" class="datos">
<td style="vertical-align: top;"><?php echo __('Group');?></td> <td style="vertical-align: top;"><?php echo __('Group');?></td>
<td style=""> <td style="">
<?php html_print_select_groups($config['id_user'], "AR", true, 'combo_group', $group, '');?> <?php html_print_select_groups($config['id_user'],
"AR", true, 'combo_group', $group, '');?>
</td> </td>
</tr> </tr>
<tr id="row_module_group" style="" class="datos"> <tr id="row_module_group" style="" class="datos">
@ -664,7 +703,13 @@ html_print_input_hidden('id_item', $idItem);
<td> <td>
<?php <?php
html_print_select(array(), 'inventory_modules[]', '', $script = '', __('None'), 0, false, true, true, '', false, "min-width: 180px"); html_print_select(array(), 'inventory_modules[]', '', $script = '', __('None'), 0, false, true, true, '', false, "min-width: 180px");
html_print_input_hidden('inventory_modules_selected',implode(',',$inventory_modules)); if (empty($inventory_modules)) {
$array_inventory_modules = array(0 => 0);
}
else {
$array_inventory_modules = implode(',', $inventory_modules);
}
html_print_input_hidden('inventory_modules_selected', $array_inventory_modules);
?> ?>
</td> </td>
</tr> </tr>
@ -672,7 +717,10 @@ html_print_input_hidden('id_item', $idItem);
<td style="vertical-align: top;"><?php echo __('Date'); ?></td> <td style="vertical-align: top;"><?php echo __('Date'); ?></td>
<td style="max-width: 180px"> <td style="max-width: 180px">
<?php <?php
$dates = enterprise_hook('inventory_get_dates',array($idAgentModule, $idAgent, $group)); $dates = enterprise_hook(
'inventory_get_dates',
array($idAgentModule, $idAgent, $group));
if ($dates === ENTERPRISE_NOT_HOOK) { if ($dates === ENTERPRISE_NOT_HOOK) {
$dates = array(); $dates = array();
} }
@ -852,6 +900,35 @@ html_print_input_hidden('id_item', $idItem);
<td><?php echo __('Show resume') . ui_print_help_tip(__('Show a resume table with max, min, average of total modules on the report bottom'), true);?></td> <td><?php echo __('Show resume') . ui_print_help_tip(__('Show a resume table with max, min, average of total modules on the report bottom'), true);?></td>
<td><?php html_print_checkbox('checkbox_show_resume', 1, $show_resume);?></td> <td><?php html_print_checkbox('checkbox_show_resume', 1, $show_resume);?></td>
</tr> </tr>
<tr id="row_event_filter" style="" class="datos">
<td><?php echo __('Event filter'); ?></td>
<td>
<?php
echo __('Validated');
html_print_checkbox ('filter_event_validated', true, $filter_event_validated);
echo __('Critical');
html_print_checkbox ('filter_event_critical', true, $filter_event_critical);
echo __('Warning');
html_print_checkbox ('filter_event_warning', true, $filter_event_warning);
?>
</td>
</tr>
</tr>
<tr id="row_event_graphs" style="" class="datos">
<td><?php echo __('Event graphs'); ?></td>
<td>
<?php
echo __('By agent');
html_print_checkbox ('event_graph_by_agent', true, $event_graph_by_agent);
echo __('By user validator');
html_print_checkbox ('event_graph_by_user_validator', true, $event_graph_by_user_validator);
echo __('By criticity');
html_print_checkbox ('event_graph_by_criticity', true, $event_graph_by_criticity);
echo __('Validated vs unvalidated');
html_print_checkbox ('event_graph_validated_vs_unvalidated', true, $event_graph_validated_vs_unvalidated);
?>
</td>
</tr>
<tr id="row_show_in_two_columns" style="" class="datos"> <tr id="row_show_in_two_columns" style="" class="datos">
<td><?php echo __('Show in two columns');?></td> <td><?php echo __('Show in two columns');?></td>
<td><?php html_print_checkbox('show_in_two_columns', 1, $show_in_two_columns, false, <td><?php html_print_checkbox('show_in_two_columns', 1, $show_in_two_columns, false,
@ -863,8 +940,13 @@ html_print_input_hidden('id_item', $idItem);
</tr> </tr>
<tr id="row_show_in_landscape" style="" class="datos"> <tr id="row_show_in_landscape" style="" class="datos">
<td><?php echo __('Show in landscape');?></td> <td><?php echo __('Show in landscape');?></td>
<td><?php html_print_checkbox('show_in_landscape', 1, $show_in_landscape, false, false, <td>
'if ($(\'input[name=show_in_landscape]\').is(\':checked\')) $(\'input[name=show_in_two_columns]\').attr(\'checked\', false);');?></td> <?php
html_print_checkbox('show_in_landscape', 1,
$show_in_landscape, false, false,
'if ($(\'input[name=show_in_landscape]\').is(\':checked\')) $(\'input[name=show_in_two_columns]\').attr(\'checked\', false);');
?>
</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
@ -1584,6 +1666,8 @@ function chooseType() {
$("#row_date").hide(); $("#row_date").hide();
$("#row_agent_multi").hide(); $("#row_agent_multi").hide();
$("#row_module_multi").hide(); $("#row_module_multi").hide();
$("#row_event_filter").hide();
$("#row_event_graphs").hide();
$("#row_netflow_filter").hide(); $("#row_netflow_filter").hide();
$("#row_max_values").hide(); $("#row_max_values").hide();
$("#row_resolution").hide(); $("#row_resolution").hide();
@ -1595,6 +1679,8 @@ function chooseType() {
$("#row_servers").show(); $("#row_servers").show();
$("#row_group").show(); $("#row_group").show();
$("#row_show_in_two_columns").show(); $("#row_show_in_two_columns").show();
$("#row_event_filter").show();
$("#row_event_graphs").show();
break; break;
case 'simple_graph': case 'simple_graph':
case 'simple_baseline_graph': case 'simple_baseline_graph':
@ -1772,6 +1858,12 @@ function chooseType() {
$("#row_period").show(); $("#row_period").show();
$("#row_show_in_two_columns").show(); $("#row_show_in_two_columns").show();
break; break;
case 'alert_report_group':
$("#row_description").show();
$("#row_period").show();
$("#row_show_in_two_columns").show();
$("#row_group").show();
break;
case 'alert_report_agent': case 'alert_report_agent':
$("#row_description").show(); $("#row_description").show();
$("#row_agent").show(); $("#row_agent").show();
@ -1783,6 +1875,8 @@ function chooseType() {
$("#row_agent").show(); $("#row_agent").show();
$("#row_period").show(); $("#row_period").show();
$("#row_show_in_two_columns").show(); $("#row_show_in_two_columns").show();
$("#row_event_filter").show();
$("#row_event_graphs").show();
break; break;
case 'event_report_module': case 'event_report_module':
$("#row_description").show(); $("#row_description").show();
@ -1803,6 +1897,7 @@ function chooseType() {
case 'group_report': case 'group_report':
$("#row_group").show(); $("#row_group").show();
$("#row_servers").show(); $("#row_servers").show();
$("#row_description").show();
break; break;
case 'top_n': case 'top_n':
$("#row_description").show(); $("#row_description").show();
@ -1874,6 +1969,7 @@ function chooseType() {
updateInventoryDates(); updateInventoryDates();
}); });
if (!$("#hidden-date_selected").val())
updateInventoryDates(); updateInventoryDates();
break; break;
case 'inventory_changes': case 'inventory_changes':

View File

@ -382,6 +382,7 @@ switch ($action) {
} }
foreach ($reports as $report) { foreach ($reports as $report) {
if (!is_user_admin ($config["id_user"])){ if (!is_user_admin ($config["id_user"])){
if ($report["private"] && $report["id_user"] != $config['id_user']) if ($report["private"] && $report["id_user"] != $config['id_user'])
if (!check_acl ($config["id_user"], $report["id_group"], "RR")) if (!check_acl ($config["id_user"], $report["id_group"], "RR"))
@ -465,7 +466,7 @@ switch ($action) {
if (check_acl ($config['id_user'], 0, "RW")) { if (check_acl ($config['id_user'], 0, "RW")) {
echo '<form method="post" action="index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&tab=main&action=new&pure='.$pure.'">'; echo '<form method="post" action="index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&tab=main&action=new&pure='.$pure.'">';
echo '<div class="action-buttons" style="width: 98%;">'; echo '<div class="action-buttons" style="width: 98%; margin-top: 5px;">';
html_print_submit_button (__('Create report'), 'create', false, 'class="sub next"'); html_print_submit_button (__('Create report'), 'create', false, 'class="sub next"');
echo "</div>"; echo "</div>";
echo "</form>"; echo "</form>";
@ -485,7 +486,8 @@ switch ($action) {
break; break;
case 'item_editor': case 'item_editor':
$resultOperationDB = null; $resultOperationDB = null;
$report = db_get_row_filter('treport', array('id_report' => $idReport)); $report = db_get_row_filter('treport',
array('id_report' => $idReport));
$reportName = $report['name']; $reportName = $report['name'];
$idGroupReport = $report['id_group']; $idGroupReport = $report['id_group'];
@ -705,6 +707,14 @@ switch ($action) {
$resultOperationDB = false; $resultOperationDB = false;
break; break;
} }
$filter_event_validated = get_parameter('filter_event_validated', 0);
$filter_event_critical = get_parameter('filter_event_critical', 0);
$filter_event_warning = get_parameter('filter_event_warning', 0);
$event_graph_by_agent = get_parameter('event_graph_by_agent', 0);
$event_graph_by_user_validator = get_parameter('event_graph_by_user_validator', 0);
$event_graph_by_criticity = get_parameter('event_graph_by_criticity', 0);
$event_graph_validated_vs_unvalidated = get_parameter('event_graph_validated_vs_unvalidated', 0);
// If metaconsole is activated // If metaconsole is activated
if ($config['metaconsole'] == 1 && defined('METACONSOLE')) { if ($config['metaconsole'] == 1 && defined('METACONSOLE')) {
@ -734,6 +744,7 @@ switch ($action) {
$agent_name = substr($agent_name_server, 0, $separator_pos); $agent_name = substr($agent_name_server, 0, $separator_pos);
} }
} }
} }
@ -757,6 +768,22 @@ 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);
switch ($values['type']) {
case 'event_report_agent':
case 'event_report_group':
//Added for events items
$style['filter_event_validated'] = $filter_event_validated;
$style['filter_event_critical'] = $filter_event_critical;
$style['filter_event_warning'] = $filter_event_warning;
$style['event_graph_by_agent'] = $event_graph_by_agent;
$style['event_graph_by_user_validator'] = $event_graph_by_user_validator;
$style['event_graph_by_criticity'] = $event_graph_by_criticity;
$style['event_graph_validated_vs_unvalidated'] = $event_graph_validated_vs_unvalidated;
break;
}
$values['style'] = io_safe_input(json_encode($style)); $values['style'] = io_safe_input(json_encode($style));
if ($good_format) { if ($good_format) {
@ -932,10 +959,35 @@ 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);
switch ($values['type']) {
case 'event_report_agent':
case 'event_report_group':
$filter_event_validated = get_parameter('filter_event_validated', 0);
$filter_event_critical = get_parameter('filter_event_critical', 0);
$filter_event_warning = get_parameter('filter_event_warning', 0);
$event_graph_by_agent = get_parameter('event_graph_by_agent', 0);
$event_graph_by_user_validator = get_parameter('event_graph_by_user_validator', 0);
$event_graph_by_criticity = get_parameter('event_graph_by_criticity', 0);
$event_graph_validated_vs_unvalidated = get_parameter('event_graph_validated_vs_unvalidated', 0);
//Added for events items
$style['filter_event_validated'] = $filter_event_validated;
$style['filter_event_critical'] = $filter_event_critical;
$style['filter_event_warning'] = $filter_event_warning;
$style['event_graph_by_agent'] = $event_graph_by_agent;
$style['event_graph_by_user_validator'] = $event_graph_by_user_validator;
$style['event_graph_by_criticity'] = $event_graph_by_criticity;
$style['event_graph_validated_vs_unvalidated'] = $event_graph_validated_vs_unvalidated;
break;
}
$values['style'] = io_safe_input(json_encode($style)); $values['style'] = io_safe_input(json_encode($style));
if ($good_format) { if ($good_format) {
$result = db_process_sql_insert('treport_content', $values); $result = db_process_sql_insert(
'treport_content', $values);
if ($result === false) { if ($result === false) {
$resultOperationDB = false; $resultOperationDB = false;
@ -945,13 +997,17 @@ switch ($action) {
switch ($config["dbtype"]) { switch ($config["dbtype"]) {
case "mysql": case "mysql":
$max = db_get_all_rows_sql('SELECT max(`order`) AS max $max = db_get_all_rows_sql(
FROM treport_content WHERE id_report = ' . $idReport . ';'); 'SELECT max(`order`) AS max
FROM treport_content
WHERE id_report = ' . $idReport . ';');
break; break;
case "postgresql": case "postgresql":
case "oracle": case "oracle":
$max = db_get_all_rows_sql('SELECT max("order") AS max $max = db_get_all_rows_sql(
FROM treport_content WHERE id_report = ' . $idReport); 'SELECT max("order") AS max
FROM treport_content
WHERE id_report = ' . $idReport);
break; break;
} }
if ($max === false) { if ($max === false) {
@ -980,7 +1036,6 @@ switch ($action) {
} }
break; break;
default: default:
if ($enterpriseEnable and $activeTab != 'advanced') { if ($enterpriseEnable and $activeTab != 'advanced') {
$resultOperationDB = reporting_enterprise_update_action(); $resultOperationDB = reporting_enterprise_update_action();
} }

View File

@ -42,6 +42,17 @@ function agents_check_agent_exists($id_agent, $show_disabled = true) {
} }
} }
/**
* Get agent id from a module id that it has.
*
* @param int $id_module Id module is list modules this agent.
*
* @return int Id from the agent of the given id module.
*/
function agents_get_agent_id_by_module_id ($id_agente_modulo) {
return (int) db_get_value ('id_agente', 'tagente_modulo', 'id_agente_modulo', $id_agente_modulo);
}
/** /**
* Creates an agent * Creates an agent
* *

View File

@ -1699,6 +1699,7 @@ function get_agent_alert_fired ($id_agent, $id_alert, $period, $date = 0) {
* @return array An array with all the events happened. * @return array An array with all the events happened.
*/ */
function get_module_alert_fired ($id_agent_module, $id_alert, $period, $date = 0) { function get_module_alert_fired ($id_agent_module, $id_alert, $period, $date = 0) {
if (!is_numeric ($date)) { if (!is_numeric ($date)) {
$date = strtotime ($date); $date = strtotime ($date);
} }

View File

@ -221,7 +221,8 @@ function events_delete_event ($id_event, $similar = true, $meta = false) {
if ($errors > 0) { if ($errors > 0) {
return false; return false;
} else { }
else {
return true; return true;
} }
} }
@ -587,7 +588,7 @@ function events_comment ($id_event, $comment = '', $action = 'Added comment', $m
$commentbox = ''; $commentbox = '';
} }
$comment = '<b>-- ' . $action . ' by '.$config['id_user'].' '.'['.date ($config["date_format"]).'] --</b><br>'.$commentbox.'<br>'; $comment = '<b>-- ' . $action . ' ' . __('by') . ' '.$config['id_user'].' '.'['.date ($config["date_format"]).'] --</b><br>'.$commentbox.'<br>';
// Update comment // Update comment
switch ($config['dbtype']) { switch ($config['dbtype']) {
@ -717,7 +718,8 @@ function events_print_event_table ($filter = "", $limit = 10, $width = 440, $ret
if ($result === false) { if ($result === false) {
echo '<div class="nf">'.__('No events').'</div>'; echo '<div class="nf">'.__('No events').'</div>';
} else { }
else {
$table->cellpadding = 4; $table->cellpadding = 4;
$table->cellspacing = 4; $table->cellspacing = 4;
$table->width = $width; $table->width = $width;
@ -1049,7 +1051,9 @@ function events_print_type_description ($type, $return = false) {
* *
* @return array An array with all the events happened. * @return array An array with all the events happened.
*/ */
function events_get_group_events ($id_group, $period, $date) { function events_get_group_events ($id_group, $period, $date,
$filter_event_validated = false, $filter_event_critical = false,
$filter_event_warning = false) {
global $config; global $config;
$id_group = groups_safe_acl ($config["id_user"], $id_group, "ER"); $id_group = groups_safe_acl ($config["id_user"], $id_group, "ER");
@ -1061,9 +1065,28 @@ function events_get_group_events ($id_group, $period, $date) {
$datelimit = $date - $period; $datelimit = $date - $period;
$sql = sprintf ('SELECT * FROM tevento $sql_where = ' AND 1 = 1 ';
if ($filter_event_critical) {
$sql_where .= ' AND criticity = 4 ';
}
if ($filter_event_warning) {
$sql_where .= ' AND criticity = 3 ';
}
if ($filter_event_validated) {
$sql_where .= ' AND estado = 1 ';
}
$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 WHERE utimestamp > %d AND utimestamp <= %d
AND id_grupo IN (%s) AND id_grupo IN (%s) ' . $sql_where . '
ORDER BY utimestamp ASC', ORDER BY utimestamp ASC',
$datelimit, $date, implode (",", $id_group)); $datelimit, $date, implode (",", $id_group));
@ -1081,7 +1104,10 @@ function events_get_group_events ($id_group, $period, $date) {
* *
* @return array An array with all the events happened. * @return array An array with all the events happened.
*/ */
function events_get_agent ($id_agent, $period, $date = 0) { function events_get_agent ($id_agent, $period, $date = 0,
$filter_event_validated = false, $filter_event_critical = false,
$filter_event_warning = false) {
if (!is_numeric ($date)) { if (!is_numeric ($date)) {
$date = strtotime ($date); $date = strtotime ($date);
} }
@ -1091,10 +1117,26 @@ function events_get_agent ($id_agent, $period, $date = 0) {
$datelimit = $date - $period; $datelimit = $date - $period;
$sql = sprintf ('SELECT evento, event_type, criticity, count(*) as count_rep, $sql_where = ' AND 1 = 1 ';
max(timestamp) AS time2, id_agentmodule, estado, user_comment, tags, source, id_extra, owner_user if ($filter_event_critical) {
FROM tevento $sql_where .= ' AND criticity = 4 ';
WHERE id_agente = %d AND utimestamp > %d AND utimestamp <= %d }
if ($filter_event_warning) {
$sql_where .= ' AND criticity = 3 ';
}
if ($filter_event_validated) {
$sql_where .= ' AND estado = 1 ';
}
$sql = sprintf ('SELECT id_usuario,
(SELECT t2.fullname
FROM tusuario AS t2
WHERE t2.id_user = t3.id_usuario) AS user_name,
estado, id_agentmodule, evento, event_type, criticity,
count(*) AS count_rep, max(timestamp) AS time2
FROM tevento as t3
WHERE id_agente = %d AND utimestamp > %d
AND utimestamp <= %d ' . $sql_where . '
GROUP BY id_agentmodule, evento GROUP BY id_agentmodule, evento
ORDER BY time2 DESC', $id_agent, $datelimit, $date); ORDER BY time2 DESC', $id_agent, $datelimit, $date);
@ -2055,4 +2097,283 @@ function events_page_comments ($event) {
return $comments; return $comments;
} }
/**
* Get all the events happened in a group during a period of time.
*
* The returned events will be in the time interval ($date - $period, $date]
*
* @param mixed $id_group Group id to get events for.
* @param int $period Period of time in seconds to get events.
* @param int $date Beginning date to get events.
*
* @return array An array with all the events happened.
*/
function events_get_count_events_by_agent ($id_group, $period, $date,
$filter_event_validated = false, $filter_event_critical = false,
$filter_event_warning = false) {
global $config;
$id_group = groups_safe_acl ($config["id_user"], $id_group, "AR");
if (empty ($id_group)) {
//An empty array means the user doesn't have access
return false;
}
$datelimit = $date - $period;
$sql_where = ' AND 1 = 1 ';
if ($filter_event_critical) {
$sql_where .= ' AND criticity = 4 ';
}
if ($filter_event_warning) {
$sql_where .= ' AND criticity = 3 ';
}
if ($filter_event_validated) {
$sql_where .= ' AND estado = 1 ';
}
$sql = sprintf ('SELECT id_agente,
(SELECT t2.nombre
FROM tagente AS t2
WHERE t2.id_agente = t3.id_agente) AS agent_name,
COUNT(*) AS count
FROM tevento AS t3
WHERE utimestamp > %d AND utimestamp <= %d
AND id_grupo IN (%s) ' . $sql_where . '
GROUP BY id_agente',
$datelimit, $date, implode (",", $id_group));
$rows = db_get_all_rows_sql ($sql);
if ($rows == false)
$rows = array();
$return = array();
foreach ($rows as $row) {
$agent_name = $row['agent_name'];
if (empty($row['agent_name'])) {
$agent_name = __('Pandora System');
}
$return[$agent_name] = $row['count'];
}
return $return;
}
/**
* Get all the events happened in a group during a period of time.
*
* The returned events will be in the time interval ($date - $period, $date]
*
* @param mixed $id_group Group id to get events for.
* @param int $period Period of time in seconds to get events.
* @param int $date Beginning date to get events.
*
* @return array An array with all the events happened.
*/
function events_get_count_events_validated_by_user ($filter, $period, $date,
$filter_event_validated = false, $filter_event_critical = false,
$filter_event_warning = false) {
global $config;
$sql_filter = ' AND 1=1 ';
if (isset($filter['id_group'])) {
$id_group = groups_safe_acl ($config["id_user"], $filter['id_group'], "AR");
if (empty ($id_group)) {
//An empty array means the user doesn't have access
return false;
}
$sql_filter .=
sprintf(' AND id_grupo IN (%s) ', implode (",", $id_group));
}
if (!empty($filter['id_agent'])) {
$sql_filter .=
sprintf(' AND id_agente = %d ', $filter['id_agent']);
}
$datelimit = $date - $period;
$sql_where = ' AND 1 = 1 ';
if ($filter_event_critical) {
$sql_where .= ' AND criticity = 4 ';
}
if ($filter_event_warning) {
$sql_where .= ' AND criticity = 3 ';
}
if ($filter_event_validated) {
$sql_where .= ' AND estado = 1 ';
}
$sql = sprintf ('SELECT id_usuario,
(SELECT t2.fullname
FROM tusuario AS t2
WHERE t2.id_user = t3.id_usuario) AS user_name,
COUNT(*) AS count
FROM tevento AS t3
WHERE utimestamp > %d AND utimestamp <= %d
%s ' . $sql_where . '
GROUP BY id_usuario',
$datelimit, $date, $sql_filter);
$rows = db_get_all_rows_sql ($sql);
if ($rows == false)
$rows = array();
$return = array();
foreach ($rows as $row) {
$user_name = $row['user_name'];
if (empty($row['user_name'])) {
$user_name = __('Unknown');
}
$return[$user_name] = $row['count'];
}
return $return;
}
/**
* Get all the events happened in a group during a period of time.
*
* The returned events will be in the time interval ($date - $period, $date]
*
* @param mixed $id_group Group id to get events for.
* @param int $period Period of time in seconds to get events.
* @param int $date Beginning date to get events.
*
* @return array An array with all the events happened.
*/
function events_get_count_events_by_criticity ($filter, $period, $date,
$filter_event_validated = false, $filter_event_critical = false,
$filter_event_warning = false) {
global $config;
$sql_filter = ' AND 1=1 ';
if (isset($filter['id_group'])) {
$id_group = groups_safe_acl ($config["id_user"], $filter['id_group'], "AR");
if (empty ($id_group)) {
//An empty array means the user doesn't have access
return false;
}
$sql_filter .=
sprintf(' AND id_grupo IN (%s) ', implode (",", $id_group));
}
if (!empty($filter['id_agent'])) {
$sql_filter .=
sprintf(' AND id_agente = %d ', $filter['id_agent']);
}
$datelimit = $date - $period;
$sql_where = ' AND 1 = 1 ';
if ($filter_event_critical) {
$sql_where .= ' AND criticity = 4 ';
}
if ($filter_event_warning) {
$sql_where .= ' AND criticity = 3 ';
}
if ($filter_event_validated) {
$sql_where .= ' AND estado = 1 ';
}
$sql = sprintf ('SELECT criticity,
COUNT(*) AS count
FROM tevento
WHERE utimestamp > %d AND utimestamp <= %d
%s ' . $sql_where . '
GROUP BY criticity',
$datelimit, $date, $sql_filter);
$rows = db_get_all_rows_sql ($sql);
if ($rows == false)
$rows = array();
$return = array();
foreach ($rows as $row) {
$return[get_priority_name($row['criticity'])] = $row['count'];
}
return $return;
}
/**
* Get all the events happened in a group during a period of time.
*
* The returned events will be in the time interval ($date - $period, $date]
*
* @param mixed $id_group Group id to get events for.
* @param int $period Period of time in seconds to get events.
* @param int $date Beginning date to get events.
*
* @return array An array with all the events happened.
*/
function events_get_count_events_validated ($filter, $period, $date,
$filter_event_validated = false, $filter_event_critical = false,
$filter_event_warning = false) {
global $config;
$sql_filter = ' AND 1=1 ';
if (isset($filter['id_group'])) {
$id_group = groups_safe_acl ($config["id_user"], $filter['id_group'], "AR");
if (empty ($id_group)) {
//An empty array means the user doesn't have access
return false;
}
$sql_filter .=
sprintf(' AND id_grupo IN (%s) ', implode (",", $id_group));
}
if (!empty($filter['id_agent'])) {
$sql_filter .=
sprintf(' AND id_agente = %d ', $filter['id_agent']);
}
$datelimit = $date - $period;
$sql_where = ' AND 1 = 1 ';
if ($filter_event_critical) {
$sql_where .= ' AND criticity = 4 ';
}
if ($filter_event_warning) {
$sql_where .= ' AND criticity = 3 ';
}
if ($filter_event_validated) {
$sql_where .= ' AND estado = 1 ';
}
$sql = sprintf ('SELECT estado,
COUNT(*) AS count
FROM tevento
WHERE utimestamp > %d AND utimestamp <= %d
%s ' . $sql_where . '
GROUP BY estado',
$datelimit, $date, $sql_filter);
$rows = db_get_all_rows_sql ($sql);
if ($rows == false)
$rows = array();
$return = array();
$return[__('Validated')] = 0;
$return[__('Not validated')] = 0;
foreach ($rows as $row) {
if ($row['estado'] == 1) {
$return[__('Validated')] += $row['count'];
}
else {
$return[__('Not validated')] += $row['count'];
}
}
return $return;
}
?> ?>

View File

@ -118,16 +118,19 @@ function get_statwin_graph_statistics ($chart_array, $series_suffix = '') {
//Get minimum //Get minimum
if ($stats['sum']['min'] == null) { if ($stats['sum']['min'] == null) {
$stats['sum']['min'] = $item['sum']; $stats['sum']['min'] = $item['sum'];
} else if ($item['sum'] < $stats['sum']['min']) { }
else if ($item['sum'] < $stats['sum']['min']) {
$stats['sum']['min'] = $item['sum']; $stats['sum']['min'] = $item['sum'];
} }
//Get maximum //Get maximum
if ($stats['sum']['max'] == null) { if ($stats['sum']['max'] == null) {
$stats['sum']['max'] = $item['sum']; $stats['sum']['max'] = $item['sum'];
} else if ($item['sum'] > $stats['sum']['max']) { }
else if ($item['sum'] > $stats['sum']['max']) {
$stats['sum']['max'] = $item['sum']; $stats['sum']['max'] = $item['sum'];
} }
} }
//Get stats for min graph //Get stats for min graph
@ -138,16 +141,19 @@ function get_statwin_graph_statistics ($chart_array, $series_suffix = '') {
//Get minimum //Get minimum
if ($stats['min']['min'] == null) { if ($stats['min']['min'] == null) {
$stats['min']['min'] = $item['min']; $stats['min']['min'] = $item['min'];
} else if ($item['min'] < $stats['min']['min']) { }
else if ($item['min'] < $stats['min']['min']) {
$stats['min']['min'] = $item['min']; $stats['min']['min'] = $item['min'];
} }
//Get maximum //Get maximum
if ($stats['min']['max'] == null) { if ($stats['min']['max'] == null) {
$stats['min']['max'] = $item['min']; $stats['min']['max'] = $item['min'];
} else if ($item['min'] > $stats['min']['max']) { }
else if ($item['min'] > $stats['min']['max']) {
$stats['min']['max'] = $item['min']; $stats['min']['max'] = $item['min'];
} }
} }
//Get stats for max graph //Get stats for max graph
@ -158,14 +164,16 @@ function get_statwin_graph_statistics ($chart_array, $series_suffix = '') {
//Get minimum //Get minimum
if ($stats['max']['min'] == null) { if ($stats['max']['min'] == null) {
$stats['max']['min'] = $item['max']; $stats['max']['min'] = $item['max'];
} else if ($item['max'] < $stats['max']['min']) { }
else if ($item['max'] < $stats['max']['min']) {
$stats['max']['min'] = $item['max']; $stats['max']['min'] = $item['max'];
} }
//Get maximum //Get maximum
if ($stats['max']['max'] == null) { if ($stats['max']['max'] == null) {
$stats['max']['max'] = $item['max']; $stats['max']['max'] = $item['max'];
} else if ($item['max'] > $stats['max']['max']) { }
else if ($item['max'] > $stats['max']['max']) {
$stats['max']['max'] = $item['max']; $stats['max']['max'] = $item['max'];
} }
} }
@ -705,8 +713,9 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events,
grafico_modulo_sparse_data ($agent_module_id, $period, $show_events, grafico_modulo_sparse_data ($agent_module_id, $period, $show_events,
$width, $height, $title, $unit_name, $width, $height, $title, $unit_name,
$show_alerts, $avg_only, $date-$period, $unit, $baseline, $return_data, $show_alerts, $avg_only,
$show_title, $projection, $adapt_key, $compare, $date-$period, $unit, $baseline, $return_data, $show_title,
$projection, $adapt_key, $compare,
$series_suffix, $series_suffix_str, $show_unknown); $series_suffix, $series_suffix_str, $show_unknown);
switch($compare) { switch($compare) {
@ -730,8 +739,9 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events,
// Build the data of the current period // Build the data of the current period
$data_returned = grafico_modulo_sparse_data ($agent_module_id, $period, $show_events, $data_returned = grafico_modulo_sparse_data ($agent_module_id, $period, $show_events,
$width, $height , $title, $unit_name, $width, $height , $title, $unit_name,
$show_alerts, $avg_only, $date, $unit, $baseline, $show_alerts, $avg_only,
$return_data, $show_title, $projection, $adapt_key, $compare, '', '', $show_unknown); $date, $unit, $baseline, $return_data, $show_title,
$projection, $adapt_key, $compare, '', '', $show_unknown);
if ($return_data) { if ($return_data) {
return $data_returned; return $data_returned;
@ -1479,12 +1489,16 @@ function grafico_db_agentes_purge ($id_agent, $width = 380, $height = 300) {
// All data (now) // All data (now)
$time["all"] = get_system_time (); $time["all"] = get_system_time ();
// 1 day ago // 1 day ago
$time["1day"] = $time["all"] - SECONDS_1DAY; $time["1day"] = $time["all"] - SECONDS_1DAY;
// 1 week ago // 1 week ago
$time["1week"] = $time["all"] - SECONDS_1WEEK; $time["1week"] = $time["all"] - SECONDS_1WEEK;
// 1 month ago // 1 month ago
$time["1month"] = $time["all"] - SECONDS_1MONTH; $time["1month"] = $time["all"] - SECONDS_1MONTH;
// Three months ago // Three months ago
$time["3month"] = $time["all"] - SECONDS_3MONTHS; $time["3month"] = $time["all"] - SECONDS_3MONTHS;
@ -1856,7 +1870,8 @@ function grafico_eventos_grupo ($width = 300, $height = 200, $url = "", $meta =
global $config; global $config;
global $graphic_type; global $graphic_type;
$url = html_entity_decode (rawurldecode ($url), ENT_QUOTES); //It was urlencoded, so we urldecode it //It was urlencoded, so we urldecode it
$url = html_entity_decode (rawurldecode ($url), ENT_QUOTES);
$data = array (); $data = array ();
$loop = 0; $loop = 0;
define ('NUM_PIECES_PIE', 6); define ('NUM_PIECES_PIE', 6);
@ -1967,31 +1982,36 @@ function grafico_eventos_total($filter = "") {
$legend = array (); $legend = array ();
$total = 0; $total = 0;
$sql = "SELECT COUNT(id_evento) FROM tevento WHERE criticity = 0 $filter"; $sql = "SELECT COUNT(id_evento)
FROM tevento WHERE criticity = 0 $filter";
$data[__('Maintenance')] = db_get_sql ($sql); $data[__('Maintenance')] = db_get_sql ($sql);
if ($data[__('Maintenance')] == 0) { if ($data[__('Maintenance')] == 0) {
unset($data[__('Maintenance')]); unset($data[__('Maintenance')]);
} }
$sql = "SELECT COUNT(id_evento) FROM tevento WHERE criticity = 1 $filter"; $sql = "SELECT COUNT(id_evento)
FROM tevento WHERE criticity = 1 $filter";
$data[__('Informational')] = db_get_sql ($sql); $data[__('Informational')] = db_get_sql ($sql);
if ($data[__('Informational')] == 0) { if ($data[__('Informational')] == 0) {
unset($data[__('Informational')]); unset($data[__('Informational')]);
} }
$sql = "SELECT COUNT(id_evento) FROM tevento WHERE criticity = 2 $filter"; $sql = "SELECT COUNT(id_evento)
FROM tevento WHERE criticity = 2 $filter";
$data[__('Normal')] = db_get_sql ($sql); $data[__('Normal')] = db_get_sql ($sql);
if ($data[__('Normal')] == 0) { if ($data[__('Normal')] == 0) {
unset($data[__('Normal')]); unset($data[__('Normal')]);
} }
$sql = "SELECT COUNT(id_evento) FROM tevento WHERE criticity = 3 $filter"; $sql = "SELECT COUNT(id_evento)
FROM tevento WHERE criticity = 3 $filter";
$data[__('Warning')] = db_get_sql ($sql); $data[__('Warning')] = db_get_sql ($sql);
if ($data[__('Warning')] == 0) { if ($data[__('Warning')] == 0) {
unset($data[__('Warning')]); unset($data[__('Warning')]);
} }
$sql = "SELECT COUNT(id_evento) FROM tevento WHERE criticity = 4 $filter"; $sql = "SELECT COUNT(id_evento)
FROM tevento WHERE criticity = 4 $filter";
$data[__('Critical')] = db_get_sql ($sql); $data[__('Critical')] = db_get_sql ($sql);
if ($data[__('Critical')] == 0) { if ($data[__('Critical')] == 0) {
unset($data[__('Critical')]); unset($data[__('Critical')]);
@ -2240,8 +2260,8 @@ function fs_error_image () {
} }
function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events, function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events,
$unit_name, $show_alerts, $avg_only = 0, $date = 0, $series_suffix = '', $unit_name, $show_alerts, $avg_only = 0,
$series_suffix_str = '', $show_unknown = false) { $date = 0, $series_suffix = '', $series_suffix_str = '', $show_unknown = false) {
global $config; global $config;
global $chart; global $chart;
@ -2599,7 +2619,8 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events,
$legend['sum'.$series_suffix] = __('Data').$series_suffix_str.': '.__('Last').': '.$graph_stats['sum']['last'].' '.$unit.' ; '.__('Avg').': '.$graph_stats['sum']['avg'].' '.$unit.' ; '.__('Max').': '.$graph_stats['sum']['max'].' '.$unit.' ; '.__('Min').': '.$graph_stats['sum']['min'].' '.$unit; $legend['sum'.$series_suffix] = __('Data').$series_suffix_str.': '.__('Last').': '.$graph_stats['sum']['last'].' '.$unit.' ; '.__('Avg').': '.$graph_stats['sum']['avg'].' '.$unit.' ; '.__('Max').': '.$graph_stats['sum']['max'].' '.$unit.' ; '.__('Min').': '.$graph_stats['sum']['min'].' '.$unit;
//Boolean graph doesn't have min!!! //Boolean graph doesn't have min!!!
//$legend['min'.$series_suffix] = __('Min').$series_suffix_str .': '.__('Last').': '.$graph_stats['min']['last'].' '.$unit.' ; '.__('Avg').': '.$graph_stats['min']['avg'].' '.$unit.' ; '.__('Max').': '.$graph_stats['min']['max'].' '.$unit.' ; '.__('Min').': '.$graph_stats['min']['min'].' '.$unit; //$legend['min'.$series_suffix] = __('Min').$series_suffix_str .': '.__('Last').': '.$graph_stats['min']['last'].' '.$unit.' ; '.__('Avg').': '.$graph_stats['min']['avg'].' '.$unit.' ; '.__('Max').': '.$graph_stats['min']['max'].' '.$unit.' ; '.__('Min').': '.$graph_stats['min']['min'].' '.$unit;
} else { }
else {
$legend['sum'.$series_suffix] = __('Data').$series_suffix_str.': '.__('Last').': '.$graph_stats['sum']['last'].' '.$unit.' ; '.__('Avg').': '.$graph_stats['sum']['avg'].' '.$unit.' ; '.__('Max').': '.$graph_stats['sum']['max'].' '.$unit.' ; '.__('Min').': '.$graph_stats['sum']['min'].' '.$unit; $legend['sum'.$series_suffix] = __('Data').$series_suffix_str.': '.__('Last').': '.$graph_stats['sum']['last'].' '.$unit.' ; '.__('Avg').': '.$graph_stats['sum']['avg'].' '.$unit.' ; '.__('Max').': '.$graph_stats['sum']['max'].' '.$unit.' ; '.__('Min').': '.$graph_stats['sum']['min'].' '.$unit;
} }
@ -3610,6 +3631,7 @@ function grafico_modulo_log4x_format_y_axis ( $number , $decimals=2, $dec_point=
break; break;
default: default:
return ""; return "";
break;
} }
} }
?> ?>

File diff suppressed because it is too large Load Diff

View File

@ -583,6 +583,8 @@ function reports_get_report_types ($template = false, $not_editor = false) {
'name' => __('Alert report module')); 'name' => __('Alert report module'));
$types['alert_report_agent'] = array('optgroup' => __('Alerts'), $types['alert_report_agent'] = array('optgroup' => __('Alerts'),
'name' => __('Alert report agent')); 'name' => __('Alert report agent'));
$types['alert_report_group'] = array('optgroup' => __('Alerts'),
'name' => __('Alert report group'));

View File

@ -248,7 +248,7 @@ function area_graph($flash_chart, $chart_data, $width, $height, $color, $legend,
} }
if (empty($chart_data)) { if (empty($chart_data)) {
return '<img src="'.$no_data_image.'">'; return '<img src="' . $no_data_image . '" />';
} }
if ($flash_chart) { if ($flash_chart) {
@ -280,7 +280,7 @@ function stacked_area_graph($flash_chart, $chart_data, $width, $height, $color,
setup_watermark($water_mark, $water_mark_file, $water_mark_url); setup_watermark($water_mark, $water_mark_file, $water_mark_url);
if (empty($chart_data)) { if (empty($chart_data)) {
return '<img src="'.$no_data_image.'">'; return '<img src="' . $no_data_image . '" />';
} }
if($flash_chart) { if($flash_chart) {
@ -315,7 +315,7 @@ function stacked_line_graph($flash_chart, $chart_data, $width, $height, $color,
setup_watermark($water_mark, $water_mark_file, $water_mark_url); setup_watermark($water_mark, $water_mark_file, $water_mark_url);
if (empty($chart_data)) { if (empty($chart_data)) {
return '<img src="'.$no_data_image.'">'; return '<img src="' . $no_data_image . '" />';
} }
if($flash_chart) { if($flash_chart) {
@ -350,7 +350,7 @@ function line_graph($flash_chart, $chart_data, $width, $height, $color, $legend,
setup_watermark($water_mark, $water_mark_file, $water_mark_url); setup_watermark($water_mark, $water_mark_file, $water_mark_url);
if (empty($chart_data)) { if (empty($chart_data)) {
return '<img src="'.$no_data_image.'">'; return '<img src="' . $no_data_image . '" />';
} }
if($flash_chart) { if($flash_chart) {
@ -377,7 +377,7 @@ function line_graph($flash_chart, $chart_data, $width, $height, $color, $legend,
function kiviat_graph($graph_type, $flash_chart, $chart_data, $width, $height, $no_data_image, $ttl = 1, $homedir="") { function kiviat_graph($graph_type, $flash_chart, $chart_data, $width, $height, $no_data_image, $ttl = 1, $homedir="") {
if (empty($chart_data)) { if (empty($chart_data)) {
return '<img src="'.$no_data_image.'">'; return '<img src="' . $no_data_image . '" />';
} }
$graph = array(); $graph = array();

View File

@ -1487,6 +1487,12 @@ div.cellBold {
font-weight: bold; font-weight: bold;
} }
div.cellRight {
width: 100%;
height: 100%;
text-align: right;
}
div.cellCenter { div.cellCenter {
width:100%; width:100%;
height:100%; height:100%;

View File

@ -31,19 +31,32 @@ if (! check_acl ($config['id_user'], 0, "ER")) {
//header //header
ui_print_page_header (__('Statistics'), "images/lightning_go.png",false, false); ui_print_page_header (__('Statistics'), "images/lightning_go.png",false, false);
echo "<table width=95%>"; echo "<table width=95%>";
echo "<tr><td valign='top'>"; echo "<tr>";
echo "<td valign='top'>";
echo "<h3>" . __('Event graph') . "</h3>"; echo "<h3>" . __('Event graph') . "</h3>";
echo grafico_eventos_total(); echo grafico_eventos_total();
echo "</td>";
echo "</td><td valign='top'>"; echo "<td valign='top'>";
echo "<h3>" . __('Event graph by user') . "</h3>"; echo "<h3>" . __('Event graph by user') . "</h3>";
echo grafico_eventos_usuario(300, 200); echo grafico_eventos_usuario(300, 200);
echo "</td>";
echo "</td></tr>"; echo "</tr>";
echo "<tr><td>";
echo "<tr>";
echo "<td>";
echo "<h3>" . __('Event graph by group') . "</h3>"; echo "<h3>" . __('Event graph by group') . "</h3>";
echo grafico_eventos_grupo(300, 200); echo grafico_eventos_grupo(300, 200);
echo "</td>";
echo '</td></tr>'; echo "<td>";
echo "<h3>" . __('Amount events validated') . "</h3>";
echo graph_events_validated(300, 200);
echo "</td>";
echo "</tr>";
echo "</table>"; echo "</table>";
?> ?>

View File

@ -168,7 +168,8 @@ else {
} }
else { else {
//Otherwise select all groups the user has rights to. //Otherwise select all groups the user has rights to.
$sql_post = " AND id_grupo IN (".implode (",", array_keys ($groups)).")"; $sql_post = " AND id_grupo IN (" .
implode (",", array_keys ($groups)) . ")";
} }
} }
@ -568,13 +569,13 @@ else {
if ($group_rep == 0) { if ($group_rep == 0) {
switch ($config["dbtype"]) { switch ($config["dbtype"]) {
case "mysql": case "mysql":
$sql = "SELECT * $sql = "SELECT *, 1 event_rep
FROM $event_table FROM $event_table
WHERE 1=1 ".$sql_post." WHERE 1=1 ".$sql_post."
ORDER BY utimestamp DESC LIMIT ".$offset.",".$pagination; ORDER BY utimestamp DESC LIMIT ".$offset.",".$pagination;
break; break;
case "postgresql": case "postgresql":
$sql = "SELECT * $sql = "SELECT *, 1 event_rep
FROM $event_table FROM $event_table
WHERE 1=1 ".$sql_post." WHERE 1=1 ".$sql_post."
ORDER BY utimestamp DESC LIMIT ".$pagination." OFFSET ".$offset; ORDER BY utimestamp DESC LIMIT ".$pagination." OFFSET ".$offset;
@ -583,7 +584,7 @@ if ($group_rep == 0) {
$set = array(); $set = array();
$set['limit'] = $pagination; $set['limit'] = $pagination;
$set['offset'] = $offset; $set['offset'] = $offset;
$sql = "SELECT * $sql = "SELECT *, 1 event_rep
FROM $event_table FROM $event_table
WHERE 1=1 ".$sql_post." WHERE 1=1 ".$sql_post."
ORDER BY utimestamp DESC"; ORDER BY utimestamp DESC";

View File

@ -239,13 +239,16 @@ $report["group_name"] = groups_get_name ($report['id_group']);
switch ($config["dbtype"]) { switch ($config["dbtype"]) {
case "mysql": case "mysql":
$contents = db_get_all_rows_field_filter ("treport_content", "id_report", $id_report, "`order`"); $contents = db_get_all_rows_field_filter ("treport_content",
"id_report", $id_report, "`order`");
break; break;
case "postgresql": case "postgresql":
$contents = db_get_all_rows_field_filter ("treport_content", "id_report", $id_report, '"order"'); $contents = db_get_all_rows_field_filter ("treport_content",
"id_report", $id_report, '"order"');
break; break;
case "oracle": case "oracle":
$contents = db_get_all_rows_field_filter ("treport_content", "id_report", $id_report, '"order"'); $contents = db_get_all_rows_field_filter ("treport_content",
"id_report", $id_report, '"order"');
break; break;
} }
if ($contents === false) { if ($contents === false) {