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>
* extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql

View File

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

View File

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

View File

@ -78,6 +78,16 @@ $sla_sorted_by = 0;
$id_agents = '';
$inventory_modules = array();
$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;
$max_values = 0;
$resolution = 0;
@ -85,7 +95,6 @@ $resolution = 0;
switch ($action) {
case 'new':
$actionParameter = 'save';
$type = get_parameter('type', 'SLA');
$description = null;
$sql = null;
@ -308,15 +317,40 @@ switch ($action) {
$idAgent = db_get_value_filter('id_agente', 'tagente_modulo', array('id_agente' => $item['id_agent']));
$period = $item['period'];
break;
case 'alert_report_group':
$description = $item['description'];
$period = $item['period'];
$group = $item['id_group'];
break;
case 'event_report_agent':
$description = $item['description'];
$idAgent = $item['id_agent'];
$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;
case 'event_report_group':
$description = $item['description'];
$period = $item['period'];
$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;
case 'event_report_module':
$description = $item['description'];
@ -333,6 +367,7 @@ switch ($action) {
$show_graph = $item['show_graph'];
break;
case 'group_report':
$description = $item['description'];
$group = $item['id_group'];
break;
case 'top_n':
@ -364,6 +399,9 @@ switch ($action) {
$date = $es['date'];
$inventory_modules = $es['inventory_modules'];
$id_agents = $es['id_agents'];
$idAgent = $es['id_agents'];
$idAgentModule = $inventory_modules;
break;
case 'inventory_changes':
$period = $item['period'];
@ -548,7 +586,8 @@ html_print_input_hidden('id_item', $idItem);
<tr id="row_group" style="" class="datos">
<td style="vertical-align: top;"><?php echo __('Group');?></td>
<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>
</tr>
<tr id="row_module_group" style="" class="datos">
@ -652,7 +691,7 @@ html_print_input_hidden('id_item', $idItem);
if ((empty($agents)) || $agents == -1) $agents = array();
$agents_select = array();
foreach($agents as $a) {
foreach ($agents as $a) {
$agents_select[$a['id_agente']] = $a['nombre'];
}
html_print_select($agents_select, 'id_agents[]', $id_agents, $script = '', __('All'), -1, false, true, true, '', false, "min-width: 180px");
@ -664,7 +703,13 @@ html_print_input_hidden('id_item', $idItem);
<td>
<?php
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>
</tr>
@ -672,8 +717,11 @@ html_print_input_hidden('id_item', $idItem);
<td style="vertical-align: top;"><?php echo __('Date'); ?></td>
<td style="max-width: 180px">
<?php
$dates = enterprise_hook('inventory_get_dates',array($idAgentModule, $idAgent, $group));
if($dates === ENTERPRISE_NOT_HOOK) {
$dates = enterprise_hook(
'inventory_get_dates',
array($idAgentModule, $idAgent, $group));
if ($dates === ENTERPRISE_NOT_HOOK) {
$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 html_print_checkbox('checkbox_show_resume', 1, $show_resume);?></td>
</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">
<td><?php echo __('Show in two columns');?></td>
<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 id="row_show_in_landscape" style="" class="datos">
<td><?php echo __('Show in landscape');?></td>
<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>
<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>
</tbody>
</table>
@ -1584,6 +1666,8 @@ function chooseType() {
$("#row_date").hide();
$("#row_agent_multi").hide();
$("#row_module_multi").hide();
$("#row_event_filter").hide();
$("#row_event_graphs").hide();
$("#row_netflow_filter").hide();
$("#row_max_values").hide();
$("#row_resolution").hide();
@ -1595,6 +1679,8 @@ function chooseType() {
$("#row_servers").show();
$("#row_group").show();
$("#row_show_in_two_columns").show();
$("#row_event_filter").show();
$("#row_event_graphs").show();
break;
case 'simple_graph':
case 'simple_baseline_graph':
@ -1772,6 +1858,12 @@ function chooseType() {
$("#row_period").show();
$("#row_show_in_two_columns").show();
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':
$("#row_description").show();
$("#row_agent").show();
@ -1783,6 +1875,8 @@ function chooseType() {
$("#row_agent").show();
$("#row_period").show();
$("#row_show_in_two_columns").show();
$("#row_event_filter").show();
$("#row_event_graphs").show();
break;
case 'event_report_module':
$("#row_description").show();
@ -1803,6 +1897,7 @@ function chooseType() {
case 'group_report':
$("#row_group").show();
$("#row_servers").show();
$("#row_description").show();
break;
case 'top_n':
$("#row_description").show();
@ -1874,6 +1969,7 @@ function chooseType() {
updateInventoryDates();
});
if (!$("#hidden-date_selected").val())
updateInventoryDates();
break;
case 'inventory_changes':

View File

@ -382,6 +382,7 @@ switch ($action) {
}
foreach ($reports as $report) {
if (!is_user_admin ($config["id_user"])){
if ($report["private"] && $report["id_user"] != $config['id_user'])
if (!check_acl ($config["id_user"], $report["id_group"], "RR"))
@ -465,7 +466,7 @@ switch ($action) {
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 '<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"');
echo "</div>";
echo "</form>";
@ -485,7 +486,8 @@ switch ($action) {
break;
case 'item_editor':
$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'];
$idGroupReport = $report['id_group'];
@ -705,6 +707,14 @@ switch ($action) {
$resultOperationDB = false;
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 ($config['metaconsole'] == 1 && defined('METACONSOLE')) {
@ -734,6 +744,7 @@ switch ($action) {
$agent_name = substr($agent_name_server, 0, $separator_pos);
}
}
}
@ -757,9 +768,25 @@ switch ($action) {
$style = array();
$style['show_in_two_columns'] = get_parameter('show_in_two_columns', 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));
if ($good_format){
if ($good_format) {
$resultOperationDB = db_process_sql_update('treport_content', $values, array('id_rc' => $idItem));
}
else{
@ -856,7 +883,7 @@ switch ($action) {
break;
case "oracle":
$only_display_wrong_tmp = get_parameter('checkbox_only_display_wrong');
if (empty($only_display_wrong_tmp)){
if (empty($only_display_wrong_tmp)) {
$values['only_display_wrong'] = 0;
}
else{
@ -932,10 +959,35 @@ switch ($action) {
$style = array();
$style['show_in_two_columns'] = get_parameter('show_in_two_columns', 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));
if ($good_format) {
$result = db_process_sql_insert('treport_content', $values);
$result = db_process_sql_insert(
'treport_content', $values);
if ($result === false) {
$resultOperationDB = false;
@ -945,13 +997,17 @@ switch ($action) {
switch ($config["dbtype"]) {
case "mysql":
$max = db_get_all_rows_sql('SELECT max(`order`) AS max
FROM treport_content WHERE id_report = ' . $idReport . ';');
$max = db_get_all_rows_sql(
'SELECT max(`order`) AS max
FROM treport_content
WHERE id_report = ' . $idReport . ';');
break;
case "postgresql":
case "oracle":
$max = db_get_all_rows_sql('SELECT max("order") AS max
FROM treport_content WHERE id_report = ' . $idReport);
$max = db_get_all_rows_sql(
'SELECT max("order") AS max
FROM treport_content
WHERE id_report = ' . $idReport);
break;
}
if ($max === false) {
@ -980,7 +1036,6 @@ switch ($action) {
}
break;
default:
if ($enterpriseEnable and $activeTab != 'advanced') {
$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
*

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.
*/
function get_module_alert_fired ($id_agent_module, $id_alert, $period, $date = 0) {
if (!is_numeric ($date)) {
$date = strtotime ($date);
}

View File

@ -170,7 +170,7 @@ function events_get_similar_ids ($id) {
function events_delete_event ($id_event, $similar = true, $meta = false) {
global $config;
if($meta) {
if ($meta) {
$table_event = 'tmetaconsole_event';
}
else {
@ -191,7 +191,7 @@ function events_delete_event ($id_event, $similar = true, $meta = false) {
$errors = 0;
foreach ($id_event as $event) {
if($meta) {
if ($meta) {
$event_group = events_meta_get_group ($event);
}
else {
@ -221,7 +221,8 @@ function events_delete_event ($id_event, $similar = true, $meta = false) {
if ($errors > 0) {
return false;
} else {
}
else {
return true;
}
}
@ -239,7 +240,7 @@ function events_delete_event ($id_event, $similar = true, $meta = false) {
function events_validate_event ($id_event, $similars = true, $new_status = 1, $meta = false) {
global $config;
if($meta) {
if ($meta) {
$table_event = 'tmetaconsole_event';
}
else {
@ -249,7 +250,7 @@ function events_validate_event ($id_event, $similars = true, $new_status = 1, $m
//Cleans up the selection for all unwanted values also casts any single values as an array
$id_event = (array) safe_int ($id_event, 1);
if($new_status) {
if ($new_status) {
$ack_utimestamp = time();
$ack_user = $config['id_user'];
}
@ -266,7 +267,7 @@ function events_validate_event ($id_event, $similars = true, $new_status = 1, $m
$id_event = array_unique($id_event);
}
switch($new_status) {
switch ($new_status) {
case 0:
$status_string = 'New';
break;
@ -288,7 +289,7 @@ function events_validate_event ($id_event, $similars = true, $new_status = 1, $m
$alerts = array();
foreach ($id_event as $event) {
if($meta) {
if ($meta) {
$event_group = events_meta_get_group ($event);
$event = events_meta_get_event ($event);
$server_id = $event['server_id'];
@ -324,13 +325,13 @@ function events_validate_event ($id_event, $similars = true, $new_status = 1, $m
db_process_sql_commit ();
if($meta && !empty($alerts)) {
if ($meta && !empty($alerts)) {
$server = metaconsole_get_connection_by_id ($server_id);
metaconsole_connect($server);
}
// Put the alerts in standby or not depends the new status
foreach($alerts as $alert) {
foreach ($alerts as $alert) {
switch($new_status) {
case EVENT_NEW:
case EVENT_VALIDATE:
@ -342,7 +343,7 @@ function events_validate_event ($id_event, $similars = true, $new_status = 1, $m
}
}
if($meta && !empty($alerts)) {
if ($meta && !empty($alerts)) {
metaconsole_restore_db();
}
@ -362,7 +363,7 @@ function events_validate_event ($id_event, $similars = true, $new_status = 1, $m
function events_change_status ($id_event, $new_status, $meta) {
global $config;
if($meta) {
if ($meta) {
$event_table = 'tmetaconsole_event';
}
else {
@ -373,7 +374,7 @@ function events_change_status ($id_event, $new_status, $meta) {
$id_event = (array) safe_int ($id_event, 1);
// Update ack info if the new status is validated
if($new_status == EVENT_STATUS_VALIDATED) {
if ($new_status == EVENT_STATUS_VALIDATED) {
$ack_utimestamp = time();
$ack_user = $config['id_user'];
}
@ -421,7 +422,7 @@ function events_change_status ($id_event, $new_status, $meta) {
}
}
if(empty($id_event)) {
if (empty($id_event)) {
return false;
}
@ -439,14 +440,14 @@ function events_change_status ($id_event, $new_status, $meta) {
events_comment($id_event, '', "Change status to $status_string");
if($meta && !empty($alerts)) {
if ($meta && !empty($alerts)) {
$server = metaconsole_get_connection_by_id ($server_id);
metaconsole_connect($server);
}
// Put the alerts in standby or not depends the new status
foreach($alerts as $alert) {
switch($new_status) {
foreach ($alerts as $alert) {
switch ($new_status) {
case EVENT_NEW:
case EVENT_VALIDATE:
alerts_agent_module_standby ($alert, 0);
@ -457,7 +458,7 @@ function events_change_status ($id_event, $new_status, $meta) {
}
}
if($meta && !empty($alerts)) {
if ($meta && !empty($alerts)) {
metaconsole_restore_db();
}
@ -477,7 +478,7 @@ function events_change_status ($id_event, $new_status, $meta) {
function events_change_owner ($id_event, $new_owner = false, $force = false, $meta = false) {
global $config;
if($meta) {
if ($meta) {
$event_table = 'tmetaconsole_event';
}
else {
@ -546,7 +547,7 @@ function events_change_owner ($id_event, $new_owner = false, $force = false, $me
function events_comment ($id_event, $comment = '', $action = 'Added comment', $meta = false) {
global $config;
if($meta) {
if ($meta) {
$event_table = 'tmetaconsole_event';
}
else {
@ -557,7 +558,7 @@ function events_comment ($id_event, $comment = '', $action = 'Added comment', $m
$id_event = (array) safe_int ($id_event, 1);
foreach ($id_event as $k => $id) {
if($meta) {
if ($meta) {
$event_group = events_meta_get_group ($id);
}
else {
@ -570,7 +571,7 @@ function events_comment ($id_event, $comment = '', $action = 'Added comment', $m
}
}
if(empty($id_event)) {
if (empty($id_event)) {
return false;
}
@ -587,7 +588,7 @@ function events_comment ($id_event, $comment = '', $action = 'Added comment', $m
$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
switch ($config['dbtype']) {
@ -717,7 +718,8 @@ function events_print_event_table ($filter = "", $limit = 10, $width = 440, $ret
if ($result === false) {
echo '<div class="nf">'.__('No events').'</div>';
} else {
}
else {
$table->cellpadding = 4;
$table->cellspacing = 4;
$table->width = $width;
@ -1049,7 +1051,9 @@ function events_print_type_description ($type, $return = false) {
*
* @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;
$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;
$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
AND id_grupo IN (%s)
AND id_grupo IN (%s) ' . $sql_where . '
ORDER BY utimestamp ASC',
$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.
*/
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)) {
$date = strtotime ($date);
}
@ -1091,10 +1117,26 @@ function events_get_agent ($id_agent, $period, $date = 0) {
$datelimit = $date - $period;
$sql = sprintf ('SELECT evento, event_type, criticity, count(*) as count_rep,
max(timestamp) AS time2, id_agentmodule, estado, user_comment, tags, source, id_extra, owner_user
FROM tevento
WHERE id_agente = %d AND utimestamp > %d AND utimestamp <= %d
$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,
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
ORDER BY time2 DESC', $id_agent, $datelimit, $date);
@ -2011,8 +2053,8 @@ function events_page_comments ($event) {
$col = 0;
$data = array();
foreach($comments_array as $c) {
switch($col) {
foreach ($comments_array as $c) {
switch ($col) {
case 0:
$row_text = preg_replace('/\s*--\s*/',"",$c);
$row_text = preg_replace('/\<\/b\>/',"</i>",$row_text);
@ -2035,7 +2077,7 @@ function events_page_comments ($event) {
}
}
if(count($comments_array) == 1 && $comments_array[0] == '') {
if (count($comments_array) == 1 && $comments_array[0] == '') {
$table_comments->style[0] = 'text-align:center;';
$table_comments->colspan[0][0] = 2;
$data = array();
@ -2055,4 +2097,283 @@ function events_page_comments ($event) {
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
if ($stats['sum']['min'] == null) {
$stats['sum']['min'] = $item['sum'];
} else if ($item['sum'] < $stats['sum']['min']) {
}
else if ($item['sum'] < $stats['sum']['min']) {
$stats['sum']['min'] = $item['sum'];
}
//Get maximum
if ($stats['sum']['max'] == null) {
$stats['sum']['max'] = $item['sum'];
} else if ($item['sum'] > $stats['sum']['max']) {
}
else if ($item['sum'] > $stats['sum']['max']) {
$stats['sum']['max'] = $item['sum'];
}
}
//Get stats for min graph
@ -138,16 +141,19 @@ function get_statwin_graph_statistics ($chart_array, $series_suffix = '') {
//Get minimum
if ($stats['min']['min'] == null) {
$stats['min']['min'] = $item['min'];
} else if ($item['min'] < $stats['min']['min']) {
}
else if ($item['min'] < $stats['min']['min']) {
$stats['min']['min'] = $item['min'];
}
//Get maximum
if ($stats['min']['max'] == null) {
$stats['min']['max'] = $item['min'];
} else if ($item['min'] > $stats['min']['max']) {
}
else if ($item['min'] > $stats['min']['max']) {
$stats['min']['max'] = $item['min'];
}
}
//Get stats for max graph
@ -158,14 +164,16 @@ function get_statwin_graph_statistics ($chart_array, $series_suffix = '') {
//Get minimum
if ($stats['max']['min'] == null) {
$stats['max']['min'] = $item['max'];
} else if ($item['max'] < $stats['max']['min']) {
}
else if ($item['max'] < $stats['max']['min']) {
$stats['max']['min'] = $item['max'];
}
//Get maximum
if ($stats['max']['max'] == null) {
$stats['max']['max'] = $item['max'];
} else if ($item['max'] > $stats['max']['max']) {
}
else if ($item['max'] > $stats['max']['max']) {
$stats['max']['max'] = $item['max'];
}
}
@ -626,19 +634,19 @@ function grafico_modulo_sparse_data ($agent_module_id, $period, $show_events,
// Only show caption if graph is not small
if ($width > MIN_WIDTH_CAPTION && $height > MIN_HEIGHT)
//Flash chart
$caption = __('Max. Value').$series_suffix_str . ': ' . $graph_stats['sum']['max'] . ' ' . __('Avg. Value').$series_suffix_str . ': ' . $graph_stats['sum']['avg'] . ' ' . __('Min. Value').$series_suffix_str . ': ' . $graph_stats['sum']['min'] . ' ' . __('Units. Value').$series_suffix_str . ': ' . $unit;
$caption = __('Max. Value') . $series_suffix_str . ': ' . $graph_stats['sum']['max'] . ' ' . __('Avg. Value').$series_suffix_str . ': ' . $graph_stats['sum']['avg'] . ' ' . __('Min. Value').$series_suffix_str . ': ' . $graph_stats['sum']['min'] . ' ' . __('Units. Value').$series_suffix_str . ': ' . $unit;
else
$caption = array();
///////
// Color commented not to restrict serie colors
if($show_events) {
if ($show_events) {
$color['event'.$series_suffix] = array('border' => '#ff0000', 'color' => '#ff0000', 'alpha' => 50);
}
if($show_alerts) {
if ($show_alerts) {
$color['alert'.$series_suffix] = array('border' => '#ff7f00', 'color' => '#ff7f00', 'alpha' => 50);
}
if($show_unknown) {
if ($show_unknown) {
$color['unknown'.$series_suffix] = array('border' => '#999999', 'color' => '#999999', 'alpha' => 50);
}
$color['max'.$series_suffix] = array('border' => '#000000', 'color' => $config['graph_color3'], 'alpha' => 50);
@ -652,7 +660,7 @@ function grafico_modulo_sparse_data ($agent_module_id, $period, $show_events,
$legend['event'.$series_suffix_str] = __('Events').$series_suffix_str;
$chart_extra_data['legend_events'] = $legend['event'].$series_suffix_str;
}
if($show_alerts) {
if ($show_alerts) {
$legend['alert'.$series_suffix] = __('Alerts').$series_suffix_str;
$chart_extra_data['legend_alerts'] = $legend['alert'.$series_suffix_str];
}
@ -705,8 +713,9 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events,
grafico_modulo_sparse_data ($agent_module_id, $period, $show_events,
$width, $height, $title, $unit_name,
$show_alerts, $avg_only, $date-$period, $unit, $baseline, $return_data,
$show_title, $projection, $adapt_key, $compare,
$show_alerts, $avg_only,
$date-$period, $unit, $baseline, $return_data, $show_title,
$projection, $adapt_key, $compare,
$series_suffix, $series_suffix_str, $show_unknown);
switch($compare) {
@ -730,8 +739,9 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events,
// Build the data of the current period
$data_returned = grafico_modulo_sparse_data ($agent_module_id, $period, $show_events,
$width, $height , $title, $unit_name,
$show_alerts, $avg_only, $date, $unit, $baseline,
$return_data, $show_title, $projection, $adapt_key, $compare, '', '', $show_unknown);
$show_alerts, $avg_only,
$date, $unit, $baseline, $return_data, $show_title,
$projection, $adapt_key, $compare, '', '', $show_unknown);
if ($return_data) {
return $data_returned;
@ -1479,12 +1489,16 @@ function grafico_db_agentes_purge ($id_agent, $width = 380, $height = 300) {
// All data (now)
$time["all"] = get_system_time ();
// 1 day ago
$time["1day"] = $time["all"] - SECONDS_1DAY;
// 1 week ago
$time["1week"] = $time["all"] - SECONDS_1WEEK;
// 1 month ago
$time["1month"] = $time["all"] - SECONDS_1MONTH;
// Three months ago
$time["3month"] = $time["all"] - SECONDS_3MONTHS;
@ -1856,7 +1870,8 @@ function grafico_eventos_grupo ($width = 300, $height = 200, $url = "", $meta =
global $config;
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 ();
$loop = 0;
define ('NUM_PIECES_PIE', 6);
@ -1920,7 +1935,7 @@ function grafico_eventos_grupo ($width = 300, $height = 200, $url = "", $meta =
$system_events += $row["count"];
}
else {
if($meta) {
if ($meta) {
$name = mb_substr (io_safe_output($row['agent_name']), 0, 14)." (".$row["count"].")";
}
else {
@ -1932,12 +1947,12 @@ function grafico_eventos_grupo ($width = 300, $height = 200, $url = "", $meta =
$loop++;
}
if($system_events > 0) {
if ($system_events > 0) {
$name = __('SYSTEM')." (".$system_events.")";
$data[$name] = $system_events;
}
if($other_events > 0) {
if ($other_events > 0) {
$name = __('Other')." (".$other_events.")";
$data[$name] = $other_events;
}
@ -1967,31 +1982,36 @@ function grafico_eventos_total($filter = "") {
$legend = array ();
$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);
if ($data[__('Maintenance')] == 0) {
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);
if ($data[__('Informational')] == 0) {
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);
if ($data[__('Normal')] == 0) {
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);
if ($data[__('Warning')] == 0) {
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);
if ($data[__('Critical')] == 0) {
unset($data[__('Critical')]);
@ -2240,8 +2260,8 @@ function fs_error_image () {
}
function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events,
$unit_name, $show_alerts, $avg_only = 0, $date = 0, $series_suffix = '',
$series_suffix_str = '', $show_unknown = false) {
$unit_name, $show_alerts, $avg_only = 0,
$date = 0, $series_suffix = '', $series_suffix_str = '', $show_unknown = false) {
global $config;
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;
//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;
} 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;
}
@ -3244,7 +3265,7 @@ function graphic_module_events ($id_module, $width, $height, $period = 0, $homeu
$pixels_between_xdata = 25;
$max_xdata_display = round($width / $pixels_between_xdata);
$ndata = count($data);
if($max_xdata_display > $ndata) {
if ($max_xdata_display > $ndata) {
$xdata_display = $ndata;
}
else {
@ -3256,7 +3277,7 @@ function graphic_module_events ($id_module, $width, $height, $period = 0, $homeu
$colors = array(1 => '#38B800', 2 => '#FFFF00', 3 => '#FF0000', 4 => '#C3C3C3');
// Draw slicebar graph
if($config['flash_charts']) {
if ($config['flash_charts']) {
echo flot_slicesbar_graph($data, $period, $width, 15, $legend, $colors, $config['fontpath'], $config['round_corner'], $homeurl, '', $adapt_key);
}
else {
@ -3610,6 +3631,7 @@ function grafico_modulo_log4x_format_y_axis ( $number , $decimals=2, $dec_point=
break;
default:
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'));
$types['alert_report_agent'] = array('optgroup' => __('Alerts'),
'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)) {
return '<img src="'.$no_data_image.'">';
return '<img src="' . $no_data_image . '" />';
}
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);
if (empty($chart_data)) {
return '<img src="'.$no_data_image.'">';
return '<img src="' . $no_data_image . '" />';
}
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);
if (empty($chart_data)) {
return '<img src="'.$no_data_image.'">';
return '<img src="' . $no_data_image . '" />';
}
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);
if (empty($chart_data)) {
return '<img src="'.$no_data_image.'">';
return '<img src="' . $no_data_image . '" />';
}
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="") {
if (empty($chart_data)) {
return '<img src="'.$no_data_image.'">';
return '<img src="' . $no_data_image . '" />';
}
$graph = array();
@ -471,7 +471,7 @@ function pie_graph($graph_type, $flash_chart, $chart_data, $width, $height,
$chart_data = $chart_data_trunc;
}
if($flash_chart) {
if ($flash_chart) {
return flot_pie_chart(array_values($chart_data), array_keys($chart_data), $width, $height, $water_mark_url, $font, $font_size);
}
else {

View File

@ -1482,11 +1482,17 @@ tfoot.scwFoot {
/* Cells divs to set individual styles with the table objects */
div.cellBold {
width:100%;
height:100%;
width: 100%;
height: 100%;
font-weight: bold;
}
div.cellRight {
width: 100%;
height: 100%;
text-align: right;
}
div.cellCenter {
width:100%;
height:100%;
@ -1494,63 +1500,63 @@ div.cellCenter {
}
div.cellWhite {
width:100%;
height:100%;
width: 100%;
height: 100%;
background: #fff;
color: #000;
}
div.cellNormal {
width:100%;
height:100%;
width: 100%;
height: 100%;
background: #008e00;
color: #fff;
}
div.cellCritical {
width:100%;
height:100%;
width: 100%;
height: 100%;
background: #cc0000;
color: #fff;
}
div.cellWarning {
width:100%;
height:100%;
width: 100%;
height: 100%;
background: #fce94f;
color: #000;
}
div.cellUnknown {
width:100%;
height:100%;
width: 100%;
height: 100%;
background: #babdb6;
color: #000;
}
div.cellNotInit {
width:100%;
height:100%;
width: 100%;
height: 100%;
background: #729fcf;
color: #000;
}
div.cellAlert {
width:100%;
height:100%;
width: 100%;
height: 100%;
background: #ffa300;
color: #000;
}
div.cellBorder1 {
width:100%;
height:100%;
width: 100%;
height: 100%;
border: 1px solid black;
}
div.cellBig {
width:100%;
height:100%;
width: 100%;
height: 100%;
font-size: 18px;
}

View File

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

View File

@ -168,7 +168,8 @@ else {
}
else {
//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)) . ")";
}
}
@ -181,7 +182,7 @@ switch ($status) {
case 0:
case 1:
case 2:
$sql_post .= " AND estado = ".$status;
$sql_post .= " AND estado = " . $status;
break;
case 3:
$sql_post .= " AND (estado = 0 OR estado = 2)";
@ -189,7 +190,7 @@ switch ($status) {
}
if ($search != "") {
$sql_post .= " AND evento LIKE '%".io_safe_input($search)."%'";
$sql_post .= " AND evento LIKE '%" . io_safe_input($search) . "%'";
}
if ($event_type != "") {
@ -568,13 +569,13 @@ else {
if ($group_rep == 0) {
switch ($config["dbtype"]) {
case "mysql":
$sql = "SELECT *
$sql = "SELECT *, 1 event_rep
FROM $event_table
WHERE 1=1 ".$sql_post."
ORDER BY utimestamp DESC LIMIT ".$offset.",".$pagination;
break;
case "postgresql":
$sql = "SELECT *
$sql = "SELECT *, 1 event_rep
FROM $event_table
WHERE 1=1 ".$sql_post."
ORDER BY utimestamp DESC LIMIT ".$pagination." OFFSET ".$offset;
@ -583,7 +584,7 @@ if ($group_rep == 0) {
$set = array();
$set['limit'] = $pagination;
$set['offset'] = $offset;
$sql = "SELECT *
$sql = "SELECT *, 1 event_rep
FROM $event_table
WHERE 1=1 ".$sql_post."
ORDER BY utimestamp DESC";

View File

@ -221,7 +221,7 @@ $(document).ready (function () {
<?php
if ($datetime === false || $datetime == -1) {
echo '<h3 class="error">'.__('Invalid date selected').'</h3>';
echo '<h3 class="error">' . __('Invalid date selected') . '</h3>';
return;
}
@ -239,13 +239,16 @@ $report["group_name"] = groups_get_name ($report['id_group']);
switch ($config["dbtype"]) {
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;
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;
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;
}
if ($contents === false) {