mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-04-08 18:55:09 +02:00
2013-01-16 Sergio Martin <sergio.martin@artica.es>
* include/ajax/events.php include/functions_graph.php include/functions_events.php include/javascript/pandora_events.js include/functions_config.php operation/events/events_list.php operation/events/events.php: Create a new event visor to metaconsole history events * include/functions_api.php: Added a new API function to create netflow filters git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7483 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
04b225288e
commit
6ce77b8977
@ -1,3 +1,17 @@
|
||||
2013-01-16 Sergio Martin <sergio.martin@artica.es>
|
||||
|
||||
* include/ajax/events.php
|
||||
include/functions_graph.php
|
||||
include/functions_events.php
|
||||
include/javascript/pandora_events.js
|
||||
include/functions_config.php
|
||||
operation/events/events_list.php
|
||||
operation/events/events.php: Create a new
|
||||
event visor to metaconsole history events
|
||||
|
||||
* include/functions_api.php: Added a new API function
|
||||
to create netflow filters
|
||||
|
||||
2013-01-16 Vanessa Gil <vanessa.gil@artica.es>
|
||||
|
||||
* include/functions_api.php: Change 'add comments' and
|
||||
|
@ -35,12 +35,13 @@ $get_response_params = (bool) get_parameter ('get_response_params');
|
||||
$get_response_description = (bool) get_parameter ('get_response_description');
|
||||
$get_event_name = (bool) get_parameter ('get_event_name');
|
||||
$meta = get_parameter ('meta', 0);
|
||||
$history = get_parameter ('history', 0);
|
||||
|
||||
if($get_event_name) {
|
||||
$event_id = get_parameter ('event_id');
|
||||
|
||||
if($meta) {
|
||||
$name = events_meta_get_event_name($event_id);
|
||||
$name = events_meta_get_event_name($event_id, $history);
|
||||
}
|
||||
else {
|
||||
$name = db_get_value('evento','tevento','id_evento',$event_id);
|
||||
@ -161,7 +162,7 @@ if($add_comment) {
|
||||
$comment = get_parameter ('comment');
|
||||
$event_id = get_parameter ('event_id');
|
||||
|
||||
$return = events_comment ($event_id, $comment, 'Added comment', $meta);
|
||||
$return = events_comment ($event_id, $comment, 'Added comment', $meta, $history);
|
||||
|
||||
if ($return)
|
||||
echo 'comment_ok';
|
||||
@ -175,7 +176,7 @@ if($change_status) {
|
||||
$event_ids = get_parameter ('event_ids');
|
||||
$new_status = get_parameter ('new_status');
|
||||
|
||||
$return = events_change_status (explode(',',$event_ids), $new_status, $meta);
|
||||
$return = events_change_status (explode(',',$event_ids), $new_status, $meta, $history);
|
||||
|
||||
if ($return)
|
||||
echo 'status_ok';
|
||||
@ -194,7 +195,7 @@ if($change_owner) {
|
||||
$new_owner = '';
|
||||
}
|
||||
|
||||
$return = events_change_owner($event_id, $new_owner, true);
|
||||
$return = events_change_owner($event_id, $new_owner, true, $meta, $history);
|
||||
|
||||
if ($return)
|
||||
echo 'owner_ok';
|
||||
@ -210,7 +211,7 @@ if($get_extended_event) {
|
||||
$event_id = get_parameter('event_id',false);
|
||||
|
||||
if($meta) {
|
||||
$event = events_meta_get_event($event_id);
|
||||
$event = events_meta_get_event($event_id, false, $history);
|
||||
}
|
||||
else {
|
||||
$event = events_get_event($event_id);
|
||||
@ -319,7 +320,10 @@ if($get_extended_event) {
|
||||
$server = metaconsole_get_connection_by_id ($server_id);
|
||||
metaconsole_connect($server);
|
||||
}
|
||||
|
||||
else {
|
||||
$server = "";
|
||||
}
|
||||
|
||||
$details = events_page_details($event, $server);
|
||||
|
||||
$custom_fields = events_page_custom_fields($event);
|
||||
|
@ -3757,6 +3757,78 @@ function api_set_create_group($id, $thrash1, $other, $thrash3) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new netflow filter. And return the id_group of the new group.
|
||||
*
|
||||
* @param $thrash1 Don't use.
|
||||
* @param $thrash2 Don't use.
|
||||
* @param array $other it's array, $other as param is <filter_name>;<group_id>;<filter>;<aggregate_by>;<output_format> in this order
|
||||
* and separator char (after text ; ) and separator (pass in param othermode as othermode=url_encode_separator_<separator>)
|
||||
*
|
||||
* Possible values of 'aggregate_by' field: dstip,dstport,none,proto,srcip,srcport
|
||||
* Possible values of 'output_format' field: kilobytes,kilobytespersecond,megabytes,megabytespersecond
|
||||
*
|
||||
* example:
|
||||
*
|
||||
* api.php?op=set&op2=create_netflow_filter&id=Filter name&other=9|host 192.168.50.3 OR host 192.168.50.4 or HOST 192.168.50.6|dstport|kilobytes&other_mode=url_encode_separator_|
|
||||
*
|
||||
* @param $thrash3 Don't use
|
||||
*/
|
||||
function api_set_create_netflow_filter($thrash1, $thrash2, $other, $thrash3) {
|
||||
if ($other['data'][0] == "") {
|
||||
returnError('error_create_netflow_filter', __('Error in netflow filter creation. Filter name cannot be left blank.'));
|
||||
return;
|
||||
}
|
||||
|
||||
if ($other['data'][1] == "") {
|
||||
returnError('error_create_netflow_filter', __('Error in netflow filter creation. Group id cannot be left blank.'));
|
||||
return;
|
||||
}
|
||||
else {
|
||||
$group = groups_get_group_by_id($other['data'][1]);
|
||||
|
||||
if ($group == false) {
|
||||
returnError('error_create_group', __('Error in group creation. Id_parent_group doesn\'t exists.'));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if ($other['data'][2] == "") {
|
||||
returnError('error_create_netflow_filter', __('Error in netflow filter creation. Filter cannot be left blank.'));
|
||||
return;
|
||||
}
|
||||
|
||||
if ($other['data'][3] == "") {
|
||||
returnError('error_create_netflow_filter', __('Error in netflow filter creation. Aggregate_by cannot be left blank.'));
|
||||
return;
|
||||
}
|
||||
|
||||
if ($other['data'][4] == "") {
|
||||
returnError('error_create_netflow_filter', __('Error in netflow filter creation. Output_format cannot be left blank.'));
|
||||
return;
|
||||
}
|
||||
|
||||
$values = array (
|
||||
'id_name'=> $other['data'][0],
|
||||
'id_group' => $other['data'][1],
|
||||
'advanced_filter'=> $other['data'][2],
|
||||
'aggregate'=> $other['data'][3],
|
||||
'output'=> $other['data'][4]
|
||||
);
|
||||
|
||||
// Save filter args
|
||||
$values['filter_args'] = netflow_get_filter_arguments ($values);
|
||||
|
||||
$id = db_process_sql_insert('tnetflow_filter', $values);
|
||||
|
||||
if ($id === false) {
|
||||
returnError('error_create_netflow_filter', __('Error in netflow filter creation.'));
|
||||
}
|
||||
else {
|
||||
returnData('string', array('type' => 'string', 'data' => $id));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get module data in CSV format.
|
||||
*
|
||||
|
@ -198,6 +198,7 @@ function config_update_config () {
|
||||
case 'godmode/setup/performance':
|
||||
//////// PERFORMANCE SETUP
|
||||
config_update_value ('event_purge', get_parameter ('event_purge'));
|
||||
config_update_value ('metaconsole_events_history', get_parameter ('metaconsole_events_history'));
|
||||
config_update_value ('trap_purge', get_parameter ('trap_purge'));
|
||||
config_update_value ('string_purge', get_parameter ('string_purge'));
|
||||
config_update_value ('audit_purge', get_parameter ('audit_purge'));
|
||||
@ -418,6 +419,10 @@ function config_process_config () {
|
||||
config_update_value ('event_purge', 15);
|
||||
}
|
||||
|
||||
if (!isset ($config["metaconsole_events_history"])) {
|
||||
config_update_value ('metaconsole_events_history', 0);
|
||||
}
|
||||
|
||||
if (!isset ($config["trap_purge"])) {
|
||||
config_update_value ('trap_purge', 7);
|
||||
}
|
||||
|
@ -66,18 +66,18 @@ function events_get_event ($id, $fields = false) {
|
||||
return $event;
|
||||
}
|
||||
|
||||
function events_get_events_grouped($sql_post, $offset = 0, $pagination = 1, $meta = false) {
|
||||
function events_get_events_grouped($sql_post, $offset = 0, $pagination = 1, $meta = false, $history = false) {
|
||||
global $config;
|
||||
|
||||
$table = events_get_events_table($meta, $history);
|
||||
|
||||
if($meta) {
|
||||
$table = 'tmetaconsole_event';
|
||||
$groupby_extra = ', server_id';
|
||||
}
|
||||
else {
|
||||
$table = 'tevento';
|
||||
$groupby_extra = '';
|
||||
}
|
||||
|
||||
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
db_process_sql ('SET group_concat_max_len = 9999999');
|
||||
@ -107,7 +107,7 @@ function events_get_events_grouped($sql_post, $offset = 0, $pagination = 1, $met
|
||||
$set['offset'] = $offset;
|
||||
// TODO: Remove duplicate user comments
|
||||
$sql = "SELECT a.*, b.event_rep, b.timestamp_rep
|
||||
FROM (SELECT * FROM tevento WHERE 1=1 ".$sql_post.") a,
|
||||
FROM (SELECT * FROM $table WHERE 1=1 ".$sql_post.") a,
|
||||
(SELECT MAX (id_evento) AS id_evento, to_char(evento) AS evento,
|
||||
id_agentmodule, COUNT(*) AS event_rep,
|
||||
LISTAGG(user_comment, '') AS user_comment, MAX(utimestamp) AS timestamp_rep,
|
||||
@ -136,16 +136,25 @@ function events_get_events_grouped($sql_post, $offset = 0, $pagination = 1, $met
|
||||
* the same.
|
||||
*
|
||||
* @param int Event id to get similar events.
|
||||
* @param bool Metaconsole mode flag
|
||||
* @param bool History mode flag
|
||||
*
|
||||
* @return array A list of events ids.
|
||||
*/
|
||||
function events_get_similar_ids ($id) {
|
||||
function events_get_similar_ids ($id, $meta = false, $history = false) {
|
||||
$events_table = events_get_events_table($meta, $history);
|
||||
|
||||
$ids = array ();
|
||||
$event = events_get_event ($id, array ('evento', 'id_agentmodule'));
|
||||
if($meta) {
|
||||
$event = events_meta_get_event($id, array ('evento', 'id_agentmodule'), $history);
|
||||
}
|
||||
else {
|
||||
$event = events_get_event ($id, array ('evento', 'id_agentmodule'));
|
||||
}
|
||||
if ($event === false)
|
||||
return $ids;
|
||||
|
||||
$events = db_get_all_rows_filter ('tevento',
|
||||
$events = db_get_all_rows_filter ($events_table,
|
||||
array ('evento' => $event['evento'],
|
||||
'id_agentmodule' => $event['id_agentmodule']),
|
||||
array ('id_evento'));
|
||||
@ -164,18 +173,14 @@ function events_get_similar_ids ($id) {
|
||||
* @param mixed Event ID or array of events
|
||||
* @param bool Whether to delete similar events too.
|
||||
* @param bool Metaconsole mode flag
|
||||
* @param bool History mode flag
|
||||
*
|
||||
* @return bool Whether or not it was successful
|
||||
*/
|
||||
function events_delete_event ($id_event, $similar = true, $meta = false) {
|
||||
function events_delete_event ($id_event, $similar = true, $meta = false, $history = false) {
|
||||
global $config;
|
||||
|
||||
if ($meta) {
|
||||
$table_event = 'tmetaconsole_event';
|
||||
}
|
||||
else {
|
||||
$table_event = 'tevento';
|
||||
}
|
||||
$table_event = events_get_events_table($meta, $history);
|
||||
|
||||
//Cleans up the selection for all unwanted values also casts any single values as an array
|
||||
$id_event = (array) safe_int ($id_event, 1);
|
||||
@ -183,7 +188,7 @@ function events_delete_event ($id_event, $similar = true, $meta = false) {
|
||||
/* We must delete all events like the selected */
|
||||
if ($similar) {
|
||||
foreach ($id_event as $id) {
|
||||
$id_event = array_merge ($id_event, events_get_similar_ids ($id));
|
||||
$id_event = array_merge ($id_event, events_get_similar_ids ($id, $meta, $history));
|
||||
}
|
||||
$id_event = array_unique($id_event);
|
||||
}
|
||||
@ -192,7 +197,7 @@ function events_delete_event ($id_event, $similar = true, $meta = false) {
|
||||
|
||||
foreach ($id_event as $event) {
|
||||
if ($meta) {
|
||||
$event_group = events_meta_get_group ($event);
|
||||
$event_group = events_meta_get_group ($event, $history);
|
||||
}
|
||||
else {
|
||||
$event_group = events_get_group ($event);
|
||||
@ -234,18 +239,14 @@ function events_delete_event ($id_event, $similar = true, $meta = false) {
|
||||
* @param bool Whether to validate similar events or not.
|
||||
* @param int New status for the event 0=new;1=validated;2=inprocess
|
||||
* @param bool Metaconsole mode flag
|
||||
* @param bool History mode flag
|
||||
*
|
||||
* @return bool Whether or not it was successful
|
||||
*/
|
||||
function events_validate_event ($id_event, $similars = true, $new_status = 1, $meta = false) {
|
||||
function events_validate_event ($id_event, $similars = true, $new_status = 1, $meta = false, $history = false) {
|
||||
global $config;
|
||||
|
||||
if ($meta) {
|
||||
$table_event = 'tmetaconsole_event';
|
||||
}
|
||||
else {
|
||||
$table_event = 'tevento';
|
||||
}
|
||||
$table_event = events_get_events_table($meta, $history);
|
||||
|
||||
//Cleans up the selection for all unwanted values also casts any single values as an array
|
||||
$id_event = (array) safe_int ($id_event, 1);
|
||||
@ -262,7 +263,7 @@ function events_validate_event ($id_event, $similars = true, $new_status = 1, $m
|
||||
/* We must validate all events like the selected */
|
||||
if ($similars && $new_status == 1) {
|
||||
foreach ($id_event as $id) {
|
||||
$id_event = array_merge ($id_event, events_get_similar_ids ($id));
|
||||
$id_event = array_merge ($id_event, events_get_similar_ids ($id, $meta, $history));
|
||||
}
|
||||
$id_event = array_unique($id_event);
|
||||
}
|
||||
@ -282,7 +283,7 @@ function events_validate_event ($id_event, $similars = true, $new_status = 1, $m
|
||||
break;
|
||||
}
|
||||
|
||||
events_comment($id_event, '', "Change status to $status_string");
|
||||
events_comment($id_event, '', "Change status to $status_string", $meta, $history);
|
||||
|
||||
db_process_sql_begin ();
|
||||
|
||||
@ -290,8 +291,8 @@ function events_validate_event ($id_event, $similars = true, $new_status = 1, $m
|
||||
|
||||
foreach ($id_event as $event) {
|
||||
if ($meta) {
|
||||
$event_group = events_meta_get_group ($event);
|
||||
$event = events_meta_get_event ($event);
|
||||
$event_group = events_meta_get_group ($event, $history);
|
||||
$event = events_meta_get_event ($event, false, $history);
|
||||
$server_id = $event['server_id'];
|
||||
}
|
||||
else {
|
||||
@ -354,21 +355,16 @@ function events_validate_event ($id_event, $similars = true, $new_status = 1, $m
|
||||
* Change the status of one or various events
|
||||
*
|
||||
* @param mixed Event ID or array of events
|
||||
* @param bool Whether to change owner on similar events or not.
|
||||
* @param string id_user of the new owner. If is false, the current owner will be setted
|
||||
* @param bool flag to force the change or not (not force is change only when it hasn't owner)
|
||||
* @param int new status of the event
|
||||
* @param bool metaconsole mode flag
|
||||
* @param bool history mode flag
|
||||
*
|
||||
* @return bool Whether or not it was successful
|
||||
*/
|
||||
function events_change_status ($id_event, $new_status, $meta) {
|
||||
function events_change_status ($id_event, $new_status, $meta = false, $history = false) {
|
||||
global $config;
|
||||
|
||||
if ($meta) {
|
||||
$event_table = 'tmetaconsole_event';
|
||||
}
|
||||
else {
|
||||
$event_table = 'tevento';
|
||||
}
|
||||
$event_table = events_get_events_table($meta, $history);
|
||||
|
||||
//Cleans up the selection for all unwanted values also casts any single values as an array
|
||||
$id_event = (array) safe_int ($id_event, 1);
|
||||
@ -402,8 +398,8 @@ function events_change_status ($id_event, $new_status, $meta) {
|
||||
|
||||
foreach ($id_event as $k => $id) {
|
||||
if($meta) {
|
||||
$event_group = events_meta_get_group ($id);
|
||||
$event = events_meta_get_event ($id);
|
||||
$event_group = events_meta_get_group ($id, $history);
|
||||
$event = events_meta_get_event ($id, false, $history);
|
||||
$server_id = $event['server_id'];
|
||||
}
|
||||
else {
|
||||
@ -438,7 +434,7 @@ function events_change_status ($id_event, $new_status, $meta) {
|
||||
return false;
|
||||
}
|
||||
|
||||
events_comment($id_event, '', "Change status to $status_string");
|
||||
events_comment($id_event, '', "Change status to $status_string", $meta, $history);
|
||||
|
||||
if ($meta && !empty($alerts)) {
|
||||
$server = metaconsole_get_connection_by_id ($server_id);
|
||||
@ -472,25 +468,21 @@ function events_change_status ($id_event, $new_status, $meta) {
|
||||
* @param string id_user of the new owner. If is false, the current owner will be setted
|
||||
* @param bool flag to force the change or not (not force is change only when it hasn't owner)
|
||||
* @param bool metaconsole mode flag
|
||||
* @param bool history mode flag
|
||||
*
|
||||
* @return bool Whether or not it was successful
|
||||
*/
|
||||
function events_change_owner ($id_event, $new_owner = false, $force = false, $meta = false) {
|
||||
function events_change_owner ($id_event, $new_owner = false, $force = false, $meta = false, $history = false) {
|
||||
global $config;
|
||||
|
||||
if ($meta) {
|
||||
$event_table = 'tmetaconsole_event';
|
||||
}
|
||||
else {
|
||||
$event_table = 'tevento';
|
||||
}
|
||||
$event_table = events_get_events_table($meta, $history);
|
||||
|
||||
//Cleans up the selection for all unwanted values also casts any single values as an array
|
||||
$id_event = (array) safe_int ($id_event, 1);
|
||||
|
||||
foreach ($id_event as $k => $id) {
|
||||
if($meta) {
|
||||
$event_group = events_meta_get_group ($id);
|
||||
$event_group = events_meta_get_group ($id, $history);
|
||||
}
|
||||
else {
|
||||
$event_group = events_get_group ($id);
|
||||
@ -505,16 +497,16 @@ function events_change_owner ($id_event, $new_owner = false, $force = false, $me
|
||||
return false;
|
||||
}
|
||||
|
||||
// Only generate comment when is forced (sometimes is changed the owner when comment)
|
||||
if($force) {
|
||||
events_comment($id_event, '', 'Change owner');
|
||||
}
|
||||
|
||||
// If no new_owner is provided, the current user will be the owner
|
||||
if($new_owner === false) {
|
||||
$new_owner = $config['id_user'];
|
||||
}
|
||||
|
||||
// Only generate comment when is forced (sometimes is changed the owner when comment)
|
||||
if($force) {
|
||||
events_comment($id_event, '', "Change owner to $new_owner", $meta, $history);
|
||||
}
|
||||
|
||||
$values = array('owner_user' => $new_owner);
|
||||
|
||||
$where = array('id_evento' => $id_event);
|
||||
@ -534,6 +526,22 @@ function events_change_owner ($id_event, $new_owner = false, $force = false, $me
|
||||
return true;
|
||||
}
|
||||
|
||||
function events_get_events_table($meta, $history) {
|
||||
if ($meta) {
|
||||
if($history) {
|
||||
$event_table = 'tmetaconsole_event_history';
|
||||
}
|
||||
else {
|
||||
$event_table = 'tmetaconsole_event';
|
||||
}
|
||||
}
|
||||
else {
|
||||
$event_table = 'tevento';
|
||||
}
|
||||
|
||||
return $event_table;
|
||||
}
|
||||
|
||||
/**
|
||||
* Comment events in a transresponse
|
||||
*
|
||||
@ -541,25 +549,21 @@ function events_change_owner ($id_event, $new_owner = false, $force = false, $me
|
||||
* @param string comment to be registered
|
||||
* @param string action performed with the comment. Bu default just Added comment
|
||||
* @param bool Flag of metaconsole mode
|
||||
* @param bool Flag of history mode
|
||||
*
|
||||
* @return bool Whether or not it was successful
|
||||
*/
|
||||
function events_comment ($id_event, $comment = '', $action = 'Added comment', $meta = false) {
|
||||
function events_comment ($id_event, $comment = '', $action = 'Added comment', $meta = false, $history = false) {
|
||||
global $config;
|
||||
|
||||
if ($meta) {
|
||||
$event_table = 'tmetaconsole_event';
|
||||
}
|
||||
else {
|
||||
$event_table = 'tevento';
|
||||
}
|
||||
$event_table = events_get_events_table($meta, $history);
|
||||
|
||||
//Cleans up the selection for all unwanted values also casts any single values as an array
|
||||
$id_event = (array) safe_int ($id_event, 1);
|
||||
|
||||
foreach ($id_event as $k => $id) {
|
||||
if ($meta) {
|
||||
$event_group = events_meta_get_group ($id);
|
||||
$event_group = events_meta_get_group ($id, $history);
|
||||
}
|
||||
else {
|
||||
$event_group = events_get_group ($id);
|
||||
@ -1554,16 +1558,20 @@ function events_page_responses ($event) {
|
||||
|
||||
// Replace macros in the target of a response and return it
|
||||
// If server_id > 0, is a metaconsole query
|
||||
function events_get_response_target($event_id, $response_id, $server_id) {
|
||||
function events_get_response_target($event_id, $response_id, $server_id, $history = false) {
|
||||
global $config;
|
||||
$event_response = db_get_row('tevent_response','id',$response_id);
|
||||
|
||||
if($server_id > 0) {
|
||||
$event = db_get_row('tmetaconsole_event','id_evento', $event_id);
|
||||
$meta = true;
|
||||
}
|
||||
else {
|
||||
$event = db_get_row('tevento','id_evento',$event_id);
|
||||
$meta = false;
|
||||
}
|
||||
|
||||
$event_table = events_get_events_table($meta, $history);
|
||||
|
||||
$event = db_get_row($event_table,'id_evento', $event_id);
|
||||
|
||||
$macros = array_keys(events_get_macros());
|
||||
|
||||
@ -1573,14 +1581,14 @@ function events_get_response_target($event_id, $response_id, $server_id) {
|
||||
$subst = '';
|
||||
switch($macro) {
|
||||
case '_agent_address_':
|
||||
if($server_id > 0) {
|
||||
if($meta) {
|
||||
$server = metaconsole_get_connection_by_id ($server_id);
|
||||
metaconsole_connect($server);
|
||||
}
|
||||
|
||||
$subst = agents_get_address($event['id_agente']);
|
||||
|
||||
if($server_id > 0) {
|
||||
if($meta) {
|
||||
metaconsole_restore_db_force();
|
||||
}
|
||||
break;
|
||||
@ -1647,7 +1655,7 @@ function events_page_custom_fields ($event) {
|
||||
function events_page_details ($event, $server = "") {
|
||||
global $img_sev;
|
||||
global $config;
|
||||
|
||||
|
||||
// If server is provided, get the hash parameters
|
||||
if (!empty($server)) {
|
||||
$hashdata = metaconsole_get_server_hashdata($server);
|
||||
@ -1686,7 +1694,7 @@ function events_page_details ($event, $server = "") {
|
||||
else {
|
||||
$agent = array();
|
||||
}
|
||||
|
||||
|
||||
$data = array();
|
||||
$data[0] = __('Agent details');
|
||||
$data[1] = empty($agent) ? '<i>' . __('N/A') . '</i>' : '';
|
||||
|
@ -1865,8 +1865,9 @@ function graphic_incident_source($width = 320, $height = 200) {
|
||||
* @param integer height pie graph height
|
||||
* @param string url
|
||||
* @param bool if the graph required is or not for metaconsole
|
||||
* @param bool if the graph required is or not for history table
|
||||
*/
|
||||
function grafico_eventos_grupo ($width = 300, $height = 200, $url = "", $meta = false) {
|
||||
function grafico_eventos_grupo ($width = 300, $height = 200, $url = "", $meta = false, $history = false) {
|
||||
global $config;
|
||||
global $graphic_type;
|
||||
|
||||
@ -1882,7 +1883,12 @@ function grafico_eventos_grupo ($width = 300, $height = 200, $url = "", $meta =
|
||||
|
||||
// Choose the table where search if metaconsole or not
|
||||
if($meta) {
|
||||
$event_table = 'tmetaconsole_event';
|
||||
if($history) {
|
||||
$event_table = 'tmetaconsole_event_history';
|
||||
}
|
||||
else {
|
||||
$event_table = 'tmetaconsole_event';
|
||||
}
|
||||
$field_extra = ', agent_name';
|
||||
$groupby_extra = ', server_id';
|
||||
}
|
||||
|
@ -12,11 +12,13 @@ function show_event_dialog(event_id, group_rep, dialog_page, result) {
|
||||
var user_comment = $('#hidden-user_comment_'+event_id).val();
|
||||
var event_rep = $('#hidden-event_rep_'+event_id).val();
|
||||
var server_id = $('#hidden-server_id_'+event_id).val();
|
||||
var meta = $('#hidden-meta').val();
|
||||
|
||||
// Metaconsole mode flag
|
||||
var meta = $('#hidden-meta').val();
|
||||
|
||||
// History mode flag
|
||||
var history = $('#hidden-history').val();
|
||||
|
||||
jQuery.post (ajax_file,
|
||||
{"page": "include/ajax/events",
|
||||
"get_extended_event": 1,
|
||||
@ -29,13 +31,14 @@ function show_event_dialog(event_id, group_rep, dialog_page, result) {
|
||||
"user_comment": user_comment,
|
||||
"event_id": event_id,
|
||||
"server_id": server_id,
|
||||
"meta": meta},
|
||||
"meta": meta,
|
||||
"history": history},
|
||||
function (data, status) {
|
||||
$("#event_details_window").hide ()
|
||||
.empty ()
|
||||
.append (data)
|
||||
.dialog ({
|
||||
title: get_event_name(event_id, meta),
|
||||
title: get_event_name(event_id, meta, history),
|
||||
resizable: true,
|
||||
draggable: true,
|
||||
modal: true,
|
||||
@ -221,7 +224,7 @@ function get_response_description(response_id) {
|
||||
}
|
||||
|
||||
// Get an event response description from db
|
||||
function get_event_name(event_id, meta) {
|
||||
function get_event_name(event_id, meta, history) {
|
||||
var ajax_file = $('#hidden-ajax_file').val();
|
||||
|
||||
var name = '';
|
||||
@ -231,6 +234,7 @@ function get_event_name(event_id, meta) {
|
||||
params.push("get_event_name=1");
|
||||
params.push("event_id="+event_id);
|
||||
params.push("meta="+meta);
|
||||
params.push("history="+history);
|
||||
|
||||
jQuery.ajax ({
|
||||
data: params.join ("&"),
|
||||
@ -331,13 +335,15 @@ function event_change_status(event_ids) {
|
||||
var new_status = $('#estado').val();
|
||||
var event_id = $('#hidden-id_event').val();
|
||||
var meta = $('#hidden-meta').val();
|
||||
|
||||
var history = $('#hidden-history').val();
|
||||
|
||||
var params = [];
|
||||
params.push("page=include/ajax/events");
|
||||
params.push("change_status=1");
|
||||
params.push("event_ids="+event_ids);
|
||||
params.push("new_status="+new_status);
|
||||
params.push("meta="+meta);
|
||||
params.push("history="+history);
|
||||
|
||||
$('#button-status_button').attr('disabled','disabled');
|
||||
$('#response_loading').show();
|
||||
@ -369,13 +375,15 @@ function event_change_owner() {
|
||||
var event_id = $('#hidden-id_event').val();
|
||||
var new_owner = $('#id_owner').val();
|
||||
var meta = $('#hidden-meta').val();
|
||||
|
||||
var history = $('#hidden-history').val();
|
||||
|
||||
var params = [];
|
||||
params.push("page=include/ajax/events");
|
||||
params.push("change_owner=1");
|
||||
params.push("event_id="+event_id);
|
||||
params.push("new_owner="+new_owner);
|
||||
params.push("meta="+meta);
|
||||
params.push("history="+history);
|
||||
|
||||
$('#button-owner_button').attr('disabled','disabled');
|
||||
$('#response_loading').show();
|
||||
@ -405,6 +413,7 @@ function event_comment() {
|
||||
var event_id = $('#hidden-id_event').val();
|
||||
var comment = $('#textarea_comment').val();
|
||||
var meta = $('#hidden-meta').val();
|
||||
var history = $('#hidden-history').val();
|
||||
|
||||
if(comment == '') {
|
||||
show_event_dialog(event_id, $('#hidden-group_rep').val(), 'comments', 'comment_error');
|
||||
@ -417,6 +426,7 @@ function event_comment() {
|
||||
params.push("event_id="+event_id);
|
||||
params.push("comment="+comment);
|
||||
params.push("meta="+meta);
|
||||
params.push("history="+history);
|
||||
|
||||
$('#button-comment_button').attr('disabled','disabled');
|
||||
$('#response_loading').show();
|
||||
|
@ -32,11 +32,15 @@ if (! check_acl ($config["id_user"], 0, "ER")) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Set metaconsole mode
|
||||
$meta = false;
|
||||
if(enterprise_installed() && defined("METACONSOLE")) {
|
||||
$meta = true;
|
||||
}
|
||||
|
||||
// Get the history mode
|
||||
$history = (bool) get_parameter('history', 0);
|
||||
|
||||
if(isset($config['event_replication']) && $config['event_replication'] == 1) {
|
||||
db_pandora_audit("ACL Violation",
|
||||
"Trying to access event viewer. View disabled due event replication.");
|
||||
@ -51,6 +55,7 @@ if (is_ajax ()) {
|
||||
$get_events_fired = (bool) get_parameter('get_events_fired');
|
||||
$standby_alert = (bool) get_parameter('standby_alert');
|
||||
$meta = get_parameter('meta', 0);
|
||||
$history = get_parameter('history', 0);
|
||||
|
||||
if ($get_event_tooltip) {
|
||||
$id = (int) get_parameter ('id');
|
||||
@ -108,7 +113,7 @@ if (is_ajax ()) {
|
||||
$id = (array) get_parameter ("id");
|
||||
$similars = (bool) get_parameter ('similars');
|
||||
|
||||
$return = events_delete_event ($id, $similars, $meta);
|
||||
$return = events_delete_event ($id, $similars, $meta, $history);
|
||||
if ($return)
|
||||
echo 'ok';
|
||||
else
|
||||
@ -171,7 +176,7 @@ $status = (int) get_parameter ("status", 3); // -1 all, 0 only new, 1 only valid
|
||||
$id_agent = (int) get_parameter ("id_agent", 0);
|
||||
$id_event = (int) get_parameter ("id_event", -1);
|
||||
$pagination = (int) get_parameter ("pagination", $config["block_size"]);
|
||||
$event_view_hr = (int) get_parameter ("event_view_hr", $config["event_view_hr"]);
|
||||
$event_view_hr = (int) get_parameter ("event_view_hr", $history ? 0 : $config["event_view_hr"]);
|
||||
$id_user_ack = get_parameter ("id_user_ack", 0);
|
||||
$group_rep = (int) get_parameter ("group_rep", 1);
|
||||
$delete = (bool) get_parameter ("delete");
|
||||
@ -211,6 +216,13 @@ if ($config["pure"] == 0 || defined ('METACONSOLE')) {
|
||||
$list['active'] = false;
|
||||
$list['text'] = '<a href="index.php?sec=eventos&sec2=operation/events/events&pure='.$config['pure'].'">' .
|
||||
html_print_image("images/god6.png", true, array("title" => __('Event list'))) . '</a>';
|
||||
|
||||
// History event list
|
||||
$history_list['active'] = false;
|
||||
$history_list['text'] = '<a href="index.php?sec=eventos&sec2=operation/events/events&pure='.$config['pure'].'&section=history&history=1">' .
|
||||
html_print_image("images/books.png", true, array("title" => __('History event list'))) . '</a>';
|
||||
|
||||
// RSS
|
||||
$rss['active'] = false;
|
||||
$rss['text'] = '<a href="operation/events/events_rss.php?user=' . $config['id_user'] . '&hashup=' . $hashup .
|
||||
'&text_agent=' . $text_agent . '&ev_group='.$ev_group.'&event_type='.$event_type.'&search='.io_safe_input($search).'&severity='.$severity.'&status='.$status.'&event_view_hr='.$event_view_hr.'&id_agent='.$id_agent.'">' .
|
||||
@ -220,6 +232,8 @@ if ($config["pure"] == 0 || defined ('METACONSOLE')) {
|
||||
$marquee['active'] = false;
|
||||
$marquee['text'] = '<a href="operation/events/events_marquee.php">' .
|
||||
html_print_image("images/heart.png", true, array ("title" => __('Marquee display'))) .'</a>';
|
||||
|
||||
// CSV
|
||||
$csv['active'] = false;
|
||||
$csv['text'] = '<a href="operation/events/export_csv.php?ev_group=' . $ev_group .
|
||||
'&text_agent=' . $text_agent . '&event_type='.$event_type.'&search='.io_safe_input($search).'&severity='.$severity.'&status='.$status.'&event_view_hr='.$event_view_hr.'&id_agent='.$id_agent.'">' .
|
||||
@ -240,6 +254,7 @@ if ($config["pure"] == 0 || defined ('METACONSOLE')) {
|
||||
'separator' => '',
|
||||
'fullscreen' => $fullscreen,
|
||||
'list' => $list,
|
||||
'history' => $history_list,
|
||||
'rss' => $rss,
|
||||
'marquee' => $marquee,
|
||||
'csv' => $csv,
|
||||
@ -249,22 +264,30 @@ if ($config["pure"] == 0 || defined ('METACONSOLE')) {
|
||||
else {
|
||||
$onheader = array('fullscreen' => $fullscreen,
|
||||
'list' => $list,
|
||||
'history' => $history_list,
|
||||
'rss' => $rss,
|
||||
'marquee' => $marquee,
|
||||
'csv' => $csv,
|
||||
'sound_event' => $sound_event) ;
|
||||
}
|
||||
|
||||
|
||||
switch ($section) {
|
||||
case 'sound_event':
|
||||
$onheader['sound_event']['active'] = true;
|
||||
$section_string = __('Sound events');
|
||||
break;
|
||||
case 'history':
|
||||
$onheader['history']['active'] = true;
|
||||
$section_string = __('History');
|
||||
break;
|
||||
default:
|
||||
$onheader['list']['active'] = true;
|
||||
$section_string = __('List');
|
||||
break;
|
||||
}
|
||||
|
||||
if (! defined ('METACONSOLE')) {
|
||||
unset($onheader['history']);
|
||||
ui_print_page_header (__("Events"), "images/lightning_go.png",
|
||||
false, "eventview", false, $onheader);
|
||||
}
|
||||
@ -274,7 +297,7 @@ if ($config["pure"] == 0 || defined ('METACONSOLE')) {
|
||||
unset($onheader['csv']);
|
||||
unset($onheader['sound_event']);
|
||||
unset($onheader['fullscreen']);
|
||||
ui_meta_print_header(__("Events"), $section, $onheader);
|
||||
ui_meta_print_header(__("Events"), $section_string, $onheader);
|
||||
}
|
||||
|
||||
?>
|
||||
@ -365,6 +388,7 @@ if ($delete) {
|
||||
else {
|
||||
switch ($section) {
|
||||
case 'list':
|
||||
case 'history':
|
||||
require_once($config['homedir'].'/operation/events/events_list.php');
|
||||
break;
|
||||
}
|
||||
@ -613,6 +637,7 @@ $(document).ready( function() {
|
||||
return;
|
||||
}
|
||||
meta = $('#hidden-meta').val();
|
||||
history = $('#hidden-history').val();
|
||||
|
||||
$tr = $(this).parents ("tr");
|
||||
id = this.id.split ("-").pop ();
|
||||
@ -624,7 +649,8 @@ $(document).ready( function() {
|
||||
"delete_event" : 1,
|
||||
"id" : id,
|
||||
"similars" : <?php echo ($group_rep ? 1 : 0) ?>,
|
||||
"meta" : meta
|
||||
"meta" : meta,
|
||||
"history" : history
|
||||
},
|
||||
function (data, status) {
|
||||
if (data == "ok") {
|
||||
@ -675,6 +701,7 @@ $(document).ready( function() {
|
||||
var similar_ids;
|
||||
similar_ids = $('#hidden-similar_ids_'+id).val();
|
||||
meta = $('#hidden-meta').val();
|
||||
history = $('#hidden-history').val();
|
||||
|
||||
$("#status_img_"+id).attr ("src", "images/spinner.gif");
|
||||
|
||||
@ -683,7 +710,8 @@ $(document).ready( function() {
|
||||
"change_status" : 1,
|
||||
"event_ids" : similar_ids,
|
||||
"new_status" : new_status,
|
||||
"meta" : meta
|
||||
"meta" : meta,
|
||||
"history" : history
|
||||
},
|
||||
function (data, status) {
|
||||
if (data == "status_ok") {
|
||||
|
@ -318,7 +318,9 @@ $url = "index.php?sec=eventos&sec2=operation/events/events&search=" .
|
||||
"&toogle_filter=no" .
|
||||
"&filter_id=" . $filter_id .
|
||||
"&id_name=" . $id_name .
|
||||
"&id_group=" . $id_group;
|
||||
"&id_group=" . $id_group .
|
||||
"&history=" . (int)$history .
|
||||
"&section=" . $section;
|
||||
|
||||
echo "<br>";
|
||||
//Link to toggle filter
|
||||
@ -333,7 +335,7 @@ else{
|
||||
echo '<div id="event_control" style="display:none">';
|
||||
|
||||
// Table for filter controls
|
||||
echo '<form id="form_filter" method="post" action="index.php?sec=eventos&sec2=operation/events/events&refr='.$config["refr"].'&pure='.$config["pure"].'&section=list">';
|
||||
echo '<form id="form_filter" method="post" action="index.php?sec=eventos&sec2=operation/events/events&refr='.$config["refr"].'&pure='.$config["pure"].'&section=' . $section . '&history='.(int)$history.'">';
|
||||
echo '<table style="float:left;" width="550" cellpadding="4" cellspacing="4" class="databox"><tr id="row_name" style="visibility: hidden">';
|
||||
|
||||
// Filter name
|
||||
@ -578,14 +580,19 @@ html_print_submit_button (__('Update'), 'update', false, 'class="sub upd"');
|
||||
|
||||
echo "</td></tr></table></form>"; //This is the filter div
|
||||
echo '<div style="width:220px; float:left;">';
|
||||
echo grafico_eventos_grupo(350, 248, rawurlencode ($sql_post), $meta);
|
||||
echo grafico_eventos_grupo(350, 248, rawurlencode ($sql_post), $meta, $history);
|
||||
echo '</div>';
|
||||
echo '<div id="steps_clean"> </div>';
|
||||
echo '</div>';
|
||||
|
||||
// Choose the table where search if metaconsole or not
|
||||
if($meta) {
|
||||
$event_table = 'tmetaconsole_event';
|
||||
if($history) {
|
||||
$event_table = 'tmetaconsole_event_history';
|
||||
}
|
||||
else {
|
||||
$event_table = 'tmetaconsole_event';
|
||||
}
|
||||
|
||||
// Show only the events of enabled nodes
|
||||
$enabled_nodes = db_get_all_rows_sql('SELECT id FROM tmetaconsole_setup WHERE disabled = 0');
|
||||
@ -635,7 +642,7 @@ if ($group_rep == 0) {
|
||||
$result = db_get_all_rows_sql ($sql);
|
||||
}
|
||||
else {
|
||||
$result = events_get_events_grouped($sql_post, $offset, $pagination, $meta);
|
||||
$result = events_get_events_grouped($sql_post, $offset, $pagination, $meta, $history);
|
||||
}
|
||||
|
||||
// Delete rnum field generated by oracle_recode_query() function
|
||||
@ -1141,6 +1148,7 @@ unset ($table);
|
||||
// Values to be used from javascript library
|
||||
html_print_input_hidden('ajax_file', ui_get_full_url("ajax.php", false, false, false));
|
||||
html_print_input_hidden('meta', (int)$meta);
|
||||
html_print_input_hidden('history', (int)$history);
|
||||
|
||||
ui_require_jquery_file('json');
|
||||
?>
|
||||
|
Loading…
x
Reference in New Issue
Block a user