2012-12-18 Sergio Martin <sergio.martin@artica.es>
* include/ajax/events.php include/functions_graph.php include/functions_events.php include/javascript/pandora_events.js operation/events/events_list.php operation/events/events.php godmode/events/custom_events.php godmode/events/events.php: Add compatibility with metaconsole in the event viewer git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7299 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
534074b9b6
commit
57ab72b1a7
|
@ -1,3 +1,15 @@
|
|||
2012-12-18 Sergio Martin <sergio.martin@artica.es>
|
||||
|
||||
* include/ajax/events.php
|
||||
include/functions_graph.php
|
||||
include/functions_events.php
|
||||
include/javascript/pandora_events.js
|
||||
operation/events/events_list.php
|
||||
operation/events/events.php
|
||||
godmode/events/custom_events.php
|
||||
godmode/events/events.php: Add compatibility
|
||||
with metaconsole in the event viewer
|
||||
|
||||
2012-12-18 Hirofumi Kosaka <kosaka@rworks.jp>
|
||||
|
||||
* include/functions_events.php: Fixed a typo (have a small
|
||||
|
|
|
@ -112,6 +112,9 @@ if ($fields_selected[0]!='') {
|
|||
case 'ack_utimestamp':
|
||||
$result = __('ACK Timestamp');
|
||||
break;
|
||||
case 'server_name':
|
||||
$result = __('Server');
|
||||
break;
|
||||
}
|
||||
$result_selected[$field_selected] = $result;
|
||||
}
|
||||
|
@ -155,6 +158,7 @@ $fields_available['source'] = __('Source');
|
|||
$fields_available['id_extra'] = __('Extra id');
|
||||
$fields_available['owner_user'] = __('Owner');
|
||||
$fields_available['ack_utimestamp'] = __('ACK Timestamp');
|
||||
$fields_available['server_name'] = __('Server name');
|
||||
|
||||
//remove fields already selected
|
||||
foreach ($fields_available as $key=>$available) {
|
||||
|
|
|
@ -33,7 +33,7 @@ $buttons = array(
|
|||
'view' => array('active' => false,
|
||||
'text' => '<a href="index.php?sec=eventos&sec2=operation/events/events">' .
|
||||
html_print_image("images/zoom.png", true, array("title" => __('View events'))) . '</a>'),
|
||||
'separator' => array(),
|
||||
'separator' => '',
|
||||
'filter' => array('active' => false,
|
||||
'text' => '<a href="index.php?sec=geventos&sec2=godmode/events/events&section=filter">' .
|
||||
html_print_image("images/lightning_go.png", true, array ("title" => __('Create filter'))) . '</a>'),
|
||||
|
@ -67,18 +67,24 @@ switch ($section) {
|
|||
break;
|
||||
}
|
||||
|
||||
ui_print_page_header (__("Manage events") . $subpage, "images/lightning_go.png", false, "", true, $buttons);
|
||||
if (! defined ('METACONSOLE')) {
|
||||
ui_print_page_header (__("Manage events") . $subpage, "images/lightning_go.png", false, "", true, $buttons);
|
||||
}
|
||||
else {
|
||||
ui_meta_print_header(__("Manage events") . $subpage, "", $buttons);
|
||||
}
|
||||
|
||||
include_once($config["homedir"] . '/include/functions_events.php');
|
||||
|
||||
switch($section) {
|
||||
case 'filter':
|
||||
require_once('godmode/events/event_filter.php');
|
||||
require_once($config["homedir"] . '/godmode/events/event_filter.php');
|
||||
break;
|
||||
case 'fields':
|
||||
require_once('godmode/events/custom_events.php');
|
||||
require_once($config["homedir"] . '/godmode/events/custom_events.php');
|
||||
break;
|
||||
case 'responses':
|
||||
require_once('godmode/events/event_responses.php');
|
||||
require_once($config["homedir"] . '/godmode/events/event_responses.php');
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -19,6 +19,8 @@ require_once ('include/functions_ui.php');
|
|||
require_once ('include/functions_db.php');
|
||||
require_once ('include/functions_io.php');
|
||||
require_once ('include/functions.php');
|
||||
enterprise_include_once ('meta/include/functions_events_meta.php');
|
||||
enterprise_include_once ('include/functions_metaconsole.php');
|
||||
|
||||
$get_events_details = (bool) get_parameter ('get_events_details');
|
||||
$get_extended_event = (bool) get_parameter ('get_extended_event');
|
||||
|
@ -32,11 +34,17 @@ $get_response_target = (bool) get_parameter ('get_response_target');
|
|||
$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);
|
||||
|
||||
if($get_event_name) {
|
||||
$event_id = get_parameter ('event_id');
|
||||
|
||||
$name = db_get_value('evento','tevento','id_evento',$event_id);
|
||||
if($meta) {
|
||||
$name = events_meta_get_event_name($event_id);
|
||||
}
|
||||
else {
|
||||
$name = db_get_value('evento','tevento','id_evento',$event_id);
|
||||
}
|
||||
|
||||
if($name === false) {
|
||||
return;
|
||||
|
@ -152,7 +160,7 @@ if($add_comment) {
|
|||
$comment = get_parameter ('comment');
|
||||
$event_id = get_parameter ('event_id');
|
||||
|
||||
$return = events_comment ($event_id, $comment);
|
||||
$return = events_comment ($event_id, $comment, 'Added comment', $meta);
|
||||
|
||||
if ($return)
|
||||
echo 'comment_ok';
|
||||
|
@ -166,7 +174,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);
|
||||
$return = events_change_status (explode(',',$event_ids), $new_status, $meta);
|
||||
|
||||
if ($return)
|
||||
echo 'status_ok';
|
||||
|
@ -200,11 +208,16 @@ if($get_extended_event) {
|
|||
|
||||
$event_id = get_parameter('event_id',false);
|
||||
|
||||
$event = events_get_event($event_id);
|
||||
|
||||
if($meta) {
|
||||
$event = events_meta_get_event($event_id);
|
||||
}
|
||||
else {
|
||||
$event = events_get_event($event_id);
|
||||
}
|
||||
|
||||
// If the event is not found, we abort
|
||||
if(empty($event)) {
|
||||
echo 'not found';
|
||||
ui_print_error_message('Event not found');
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -214,6 +227,7 @@ if($get_extended_event) {
|
|||
$event_rep = get_parameter('event_rep',1);
|
||||
$timestamp_first = get_parameter('timestamp_first', $event['utimestamp']);
|
||||
$timestamp_last = get_parameter('timestamp_last', $event['utimestamp']);
|
||||
$server_id = get_parameter('server_id', 0);
|
||||
|
||||
$event['similar_ids'] = $similar_ids;
|
||||
$event['timestamp_first'] = $timestamp_first;
|
||||
|
@ -289,10 +303,21 @@ if($get_extended_event) {
|
|||
|
||||
$responses = events_page_responses($event);
|
||||
|
||||
$details = events_page_details($event);
|
||||
$console_url = '';
|
||||
// If metaconsole switch to node to get details and custom fields
|
||||
if($meta) {
|
||||
$server = metaconsole_get_connection_by_id ($server_id);
|
||||
metaconsole_connect($server);
|
||||
}
|
||||
|
||||
$details = events_page_details($event, $server);
|
||||
|
||||
$custom_fields = events_page_custom_fields($event);
|
||||
|
||||
if($meta) {
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
|
||||
$general = events_page_general($event);
|
||||
|
||||
$comments = events_page_comments($event);
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
// GNU General Public License for more details.
|
||||
|
||||
include_once($config['homedir'] . "/include/functions_ui.php");
|
||||
enterprise_include_once ('meta/include/functions_events_meta.php');
|
||||
|
||||
/**
|
||||
* @package Include
|
||||
|
@ -64,9 +65,18 @@ function events_get_event ($id, $fields = false) {
|
|||
return $event;
|
||||
}
|
||||
|
||||
function events_get_events_grouped($sql_post, $offset = 0, $pagination = 1) {
|
||||
function events_get_events_grouped($sql_post, $offset = 0, $pagination = 1, $meta = false) {
|
||||
global $config;
|
||||
|
||||
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');
|
||||
|
@ -75,9 +85,9 @@ function events_get_events_grouped($sql_post, $offset = 0, $pagination = 1) {
|
|||
GROUP_CONCAT(DISTINCT id_evento SEPARATOR ',') AS similar_ids,
|
||||
COUNT(*) AS event_rep, MAX(utimestamp) AS timestamp_rep,
|
||||
MIN(utimestamp) AS timestamp_rep_min
|
||||
FROM tevento
|
||||
FROM $table
|
||||
WHERE 1=1 ".$sql_post."
|
||||
GROUP BY estado, evento, id_agentmodule
|
||||
GROUP BY estado, evento, id_agentmodule".$groupby_extra."
|
||||
ORDER BY timestamp_rep DESC LIMIT ".$offset.",".$pagination;
|
||||
break;
|
||||
case "postgresql":
|
||||
|
@ -85,9 +95,9 @@ function events_get_events_grouped($sql_post, $offset = 0, $pagination = 1) {
|
|||
array_to_string(array_agg(DISTINCT id_evento), ',') AS similar_ids,
|
||||
COUNT(*) AS event_rep, MAX(utimestamp) AS timestamp_rep,
|
||||
MIN(utimestamp) AS timestamp_rep_min
|
||||
FROM tevento
|
||||
FROM $table
|
||||
WHERE 1=1 ".$sql_post."
|
||||
GROUP BY estado, evento, id_agentmodule, id_evento, id_agente, id_usuario, id_grupo, estado, timestamp, utimestamp, event_type, id_alert_am, criticity, user_comment, tags, source, id_extra
|
||||
GROUP BY estado, evento, id_agentmodule, id_evento, id_agente, id_usuario, id_grupo, estado, timestamp, utimestamp, event_type, id_alert_am, criticity, user_comment, tags, source, id_extra".$groupby_extra."
|
||||
ORDER BY timestamp_rep DESC LIMIT ".$pagination." OFFSET ".$offset;
|
||||
break;
|
||||
case "oracle":
|
||||
|
@ -102,9 +112,9 @@ function events_get_events_grouped($sql_post, $offset = 0, $pagination = 1) {
|
|||
LISTAGG(user_comment, '') AS user_comment, MAX(utimestamp) AS timestamp_rep,
|
||||
LISTAGG(id_evento, '') AS similar_ids,
|
||||
MIN(utimestamp) AS timestamp_rep_min
|
||||
FROM tevento
|
||||
FROM $table
|
||||
WHERE 1=1 ".$sql_post."
|
||||
GROUP BY estado, to_char(evento), id_agentmodule) b
|
||||
GROUP BY estado, to_char(evento), id_agentmodule".$groupby_extra.") b
|
||||
WHERE a.id_evento=b.id_evento AND
|
||||
to_char(a.evento)=to_char(b.evento)
|
||||
AND a.id_agentmodule=b.id_agentmodule";
|
||||
|
@ -152,12 +162,20 @@ 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
|
||||
*
|
||||
* @return bool Whether or not it was successful
|
||||
*/
|
||||
function events_delete_event ($id_event, $similar = true) {
|
||||
function events_delete_event ($id_event, $similar = true, $meta = false) {
|
||||
global $config;
|
||||
|
||||
if($meta) {
|
||||
$table_event = 'tmetaconsole_event';
|
||||
}
|
||||
else {
|
||||
$table_event = 'tevento';
|
||||
}
|
||||
|
||||
//Cleans up the selection for all unwanted values also casts any single values as an array
|
||||
$id_event = (array) safe_int ($id_event, 1);
|
||||
|
||||
|
@ -171,25 +189,36 @@ function events_delete_event ($id_event, $similar = true) {
|
|||
|
||||
$errors = 0;
|
||||
|
||||
foreach ($id_event as $event) {
|
||||
$ret = db_process_sql_delete('tevento', array('id_evento' => $event));
|
||||
foreach ($id_event as $event) {
|
||||
if($meta) {
|
||||
$event_group = events_get_group ($event);
|
||||
}
|
||||
else {
|
||||
$event_group = events_meta_get_group ($event);
|
||||
}
|
||||
|
||||
if (check_acl ($config["id_user"], events_get_group ($event), "IM") == 0) {
|
||||
if (check_acl ($config["id_user"], $event_group, "IM") == 0) {
|
||||
//Check ACL
|
||||
db_pandora_audit("ACL Violation", "Attempted deleting event #".$event);
|
||||
$errors++;
|
||||
}
|
||||
elseif ($ret !== false) {
|
||||
db_pandora_audit("Event deleted", "Deleted event #".$event);
|
||||
//ACL didn't fail nor did return
|
||||
continue;
|
||||
else {
|
||||
$ret = db_process_sql_delete($table_event, array('id_evento' => $event));
|
||||
|
||||
if(!$ret) {
|
||||
$errors++;
|
||||
}
|
||||
else {
|
||||
db_pandora_audit("Event deleted", "Deleted event #".$event);
|
||||
//ACL didn't fail nor did return
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
$errors++;
|
||||
break;
|
||||
}
|
||||
|
||||
if ($errors > 1) {
|
||||
if ($errors > 0) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
|
@ -201,12 +230,21 @@ function events_delete_event ($id_event, $similar = true) {
|
|||
*
|
||||
* @param mixed Event ID or array of events
|
||||
* @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
|
||||
*
|
||||
* @return bool Whether or not it was successful
|
||||
*/
|
||||
function events_validate_event ($id_event, $similars = true, $new_status = 1) {
|
||||
function events_validate_event ($id_event, $similars = true, $new_status = 1, $meta = false) {
|
||||
global $config;
|
||||
|
||||
if($meta) {
|
||||
$table_event = 'tmetaconsole_event';
|
||||
}
|
||||
else {
|
||||
$table_event = 'tevento';
|
||||
}
|
||||
|
||||
//Cleans up the selection for all unwanted values also casts any single values as an array
|
||||
$id_event = (array) safe_int ($id_event, 1);
|
||||
|
||||
|
@ -246,8 +284,24 @@ function events_validate_event ($id_event, $similars = true, $new_status = 1) {
|
|||
|
||||
db_process_sql_begin ();
|
||||
|
||||
$alerts = array();
|
||||
|
||||
foreach ($id_event as $event) {
|
||||
if (check_acl ($config["id_user"], events_get_group ($event), "IW") == 0) {
|
||||
if($meta) {
|
||||
$event_group = events_meta_get_group ($event);
|
||||
$event = events_meta_get_event ($event);
|
||||
$server_id = $event['server_id'];
|
||||
}
|
||||
else {
|
||||
$event_group = events_get_group ($event);
|
||||
$event = events_get_event ($event);
|
||||
}
|
||||
|
||||
if($event['id_alert_am'] > 0 && !in_array($event['id_alert_am'], $alerts)) {
|
||||
$alerts[] = $event['id_alert_am'];
|
||||
}
|
||||
|
||||
if (check_acl ($config["id_user"], $event_group, "IW") == 0) {
|
||||
db_pandora_audit("ACL Violation", "Attempted updating event #".$event);
|
||||
|
||||
return false;
|
||||
|
@ -258,7 +312,7 @@ function events_validate_event ($id_event, $similars = true, $new_status = 1) {
|
|||
'id_usuario' => $ack_user,
|
||||
'ack_utimestamp' => $ack_utimestamp);
|
||||
|
||||
$ret = db_process_sql_update('tevento', $values,
|
||||
$ret = db_process_sql_update($table_event, $values,
|
||||
array('id_evento' => $event), 'AND', false);
|
||||
|
||||
if (($ret === false) || ($ret === 0)) {
|
||||
|
@ -269,6 +323,28 @@ function events_validate_event ($id_event, $similars = true, $new_status = 1) {
|
|||
|
||||
db_process_sql_commit ();
|
||||
|
||||
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) {
|
||||
case EVENT_NEW:
|
||||
case EVENT_VALIDATE:
|
||||
alerts_agent_module_standby ($alert, 0);
|
||||
break;
|
||||
case EVENT_PROCESS:
|
||||
alerts_agent_module_standby ($alert, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if($meta && !empty($alerts)) {
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -282,9 +358,16 @@ function events_validate_event ($id_event, $similars = true, $new_status = 1) {
|
|||
*
|
||||
* @return bool Whether or not it was successful
|
||||
*/
|
||||
function events_change_status ($id_event, $new_status) {
|
||||
function events_change_status ($id_event, $new_status, $meta) {
|
||||
global $config;
|
||||
|
||||
if($meta) {
|
||||
$event_table = 'tmetaconsole_event';
|
||||
}
|
||||
else {
|
||||
$event_table = 'tevento';
|
||||
}
|
||||
|
||||
//Cleans up the selection for all unwanted values also casts any single values as an array
|
||||
$id_event = (array) safe_int ($id_event, 1);
|
||||
|
||||
|
@ -313,8 +396,24 @@ function events_change_status ($id_event, $new_status) {
|
|||
break;
|
||||
}
|
||||
|
||||
$alerts = array();
|
||||
|
||||
foreach ($id_event as $k => $id) {
|
||||
if (check_acl ($config["id_user"], events_get_group ($id), "IW") == 0) {
|
||||
if($meta) {
|
||||
$event_group = events_meta_get_group ($id);
|
||||
$event = events_meta_get_event ($id);
|
||||
$server_id = $event['server_id'];
|
||||
}
|
||||
else {
|
||||
$event_group = events_get_group ($id);
|
||||
$event = events_get_event ($id);
|
||||
}
|
||||
|
||||
if($event['id_alert_am'] > 0 && !in_array($event['id_alert_am'], $alerts)) {
|
||||
$alerts[] = $event['id_alert_am'];
|
||||
}
|
||||
|
||||
if (check_acl ($config["id_user"], $event_group, "IW") == 0) {
|
||||
db_pandora_audit("ACL Violation", "Attempted updating event #".$id);
|
||||
|
||||
unset($id_event[$k]);
|
||||
|
@ -330,7 +429,7 @@ function events_change_status ($id_event, $new_status) {
|
|||
'id_usuario' => $ack_user,
|
||||
'ack_utimestamp' => $ack_utimestamp);
|
||||
|
||||
$ret = db_process_sql_update('tevento', $values,
|
||||
$ret = db_process_sql_update($event_table, $values,
|
||||
array('id_evento' => $id_event));
|
||||
|
||||
if (($ret === false) || ($ret === 0)) {
|
||||
|
@ -339,6 +438,28 @@ function events_change_status ($id_event, $new_status) {
|
|||
|
||||
events_comment($id_event, '', "Change status to $status_string");
|
||||
|
||||
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) {
|
||||
case EVENT_NEW:
|
||||
case EVENT_VALIDATE:
|
||||
alerts_agent_module_standby ($alert, 0);
|
||||
break;
|
||||
case EVENT_PROCESS:
|
||||
alerts_agent_module_standby ($alert, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if($meta && !empty($alerts)) {
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -348,17 +469,31 @@ function events_change_status ($id_event, $new_status) {
|
|||
* @param mixed Event ID or array of events
|
||||
* @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
|
||||
*
|
||||
* @return bool Whether or not it was successful
|
||||
*/
|
||||
function events_change_owner ($id_event, $new_owner = false, $force = false) {
|
||||
function events_change_owner ($id_event, $new_owner = false, $force = false, $meta = false) {
|
||||
global $config;
|
||||
|
||||
if($meta) {
|
||||
$event_table = 'tmetaconsole_event';
|
||||
}
|
||||
else {
|
||||
$event_table = 'tevento';
|
||||
}
|
||||
|
||||
//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 (check_acl ($config["id_user"], events_get_group ($id), "IW") == 0) {
|
||||
if($meta) {
|
||||
$event_group = events_meta_get_group ($id);
|
||||
}
|
||||
else {
|
||||
$event_group = events_get_group ($id);
|
||||
}
|
||||
if (check_acl ($config["id_user"], $event_group, "IW") == 0) {
|
||||
db_pandora_audit("ACL Violation", "Attempted updating event #".$id);
|
||||
unset($id_event[$k]);
|
||||
}
|
||||
|
@ -387,7 +522,7 @@ function events_change_owner ($id_event, $new_owner = false, $force = false) {
|
|||
$where['owner_user'] = '<>';
|
||||
}
|
||||
|
||||
$ret = db_process_sql_update('tevento', $values,
|
||||
$ret = db_process_sql_update($event_table, $values,
|
||||
$where, 'AND', false);
|
||||
|
||||
if (($ret === false) || ($ret === 0)) {
|
||||
|
@ -403,17 +538,31 @@ function events_change_owner ($id_event, $new_owner = false, $force = false) {
|
|||
* @param mixed Event ID or array of events
|
||||
* @param string comment to be registered
|
||||
* @param string action performed with the comment. Bu default just Added comment
|
||||
* @param bool Flag of metaconsole mode
|
||||
*
|
||||
* @return bool Whether or not it was successful
|
||||
*/
|
||||
function events_comment ($id_event, $comment = '', $action = 'Added comment') {
|
||||
function events_comment ($id_event, $comment = '', $action = 'Added comment', $meta = false) {
|
||||
global $config;
|
||||
|
||||
if($meta) {
|
||||
$event_table = 'tmetaconsole_event';
|
||||
}
|
||||
else {
|
||||
$event_table = 'tevento';
|
||||
}
|
||||
|
||||
//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 (check_acl ($config["id_user"], events_get_group ($id), "IW") == 0) {
|
||||
if($meta) {
|
||||
$event_group = events_meta_get_group ($id);
|
||||
}
|
||||
else {
|
||||
$event_group = events_get_group ($id);
|
||||
}
|
||||
if (check_acl ($config["id_user"], $event_group, "IW") == 0) {
|
||||
db_pandora_audit("ACL Violation", "Attempted updating event #".$id);
|
||||
|
||||
unset($id_event[$k]);
|
||||
|
@ -443,7 +592,7 @@ function events_comment ($id_event, $comment = '', $action = 'Added comment') {
|
|||
switch ($config['dbtype']) {
|
||||
// Oldstyle SQL to avoid innecesary PHP foreach
|
||||
case 'mysql':
|
||||
$sql_validation = "UPDATE tevento
|
||||
$sql_validation = "UPDATE $event_table
|
||||
SET user_comment = concat('" . $comment . "', user_comment)
|
||||
WHERE id_evento in (" . implode(',', $id_event) . ")";
|
||||
|
||||
|
@ -451,7 +600,7 @@ function events_comment ($id_event, $comment = '', $action = 'Added comment') {
|
|||
break;
|
||||
case 'postgresql':
|
||||
case 'oracle':
|
||||
$sql_validation = "UPDATE tevento
|
||||
$sql_validation = "UPDATE $event_table
|
||||
SET user_comment='" . $comment . "' || user_comment)
|
||||
WHERE id_evento in (" . implode(',', $id_event) . ")";
|
||||
|
||||
|
@ -1256,8 +1405,10 @@ function events_page_responses ($event) {
|
|||
// Delete
|
||||
$data = array();
|
||||
$data[0] = __('Delete event');
|
||||
$data[1] = '<form method="post" response="index.php?sec=eventos&sec2=operation/events/events§ion=list&delete=1&eventid='.$event['id_evento'].'">';
|
||||
$data[1] = '<form method="post">';
|
||||
$data[1] .= html_print_button(__('Delete event'),'delete_button',false,'if(!confirm(\''.__('Are you sure?').'\')) { return false; } this.form.submit();','class="sub cancel"',true);
|
||||
$data[1] .= html_print_input_hidden('delete', 1, true);
|
||||
$data[1] .= html_print_input_hidden('validate_ids', $event['id_evento'], true);
|
||||
$data[1] .= '</form>';
|
||||
|
||||
$table_responses->data[] = $data;
|
||||
|
@ -1383,8 +1534,9 @@ function events_page_custom_fields ($event) {
|
|||
return $custom_fields;
|
||||
}
|
||||
|
||||
function events_page_details ($event) {
|
||||
function events_page_details ($event, $server = "") {
|
||||
global $img_sev;
|
||||
global $config;
|
||||
|
||||
/////////
|
||||
// Details
|
||||
|
@ -1489,7 +1641,19 @@ function events_page_details ($event) {
|
|||
|
||||
$data = array();
|
||||
$data[0] = '<div style="font-weight:normal; margin-left: 20px;">'.__('Graph').'</div>';
|
||||
$data[1] = '<a href="javascript:winopeng(\'operation/agentes/stat_win.php?type=sparse&period=86400&id='.$event["id_agentmodule"].'&label=L2Rldi9zZGE2&refresh=600\',\'day_5f80228c\')">';
|
||||
$graph_type = return_graphtype ($module["module_type"]);
|
||||
|
||||
$win_handle=dechex(crc32($module["id_agente_modulo"].$module["module_name"]));
|
||||
|
||||
if (!empty($server)) {
|
||||
$hashdata = metaconsole_get_server_hashdata($server);
|
||||
$link ="winopeng('" . $server['server_url'] . "/operation/agentes/stat_win.php?type=".$graph_type."&period=86400&loginhash=auto&loginhash_data=" . $hashdata . "&loginhash_user=" . $config["id_user"] . "&id=".$module["id_agente_modulo"]."&label=".base64_encode($module["module_name"])."&refresh=600','day_".$win_handle."')";
|
||||
}
|
||||
else {
|
||||
$link ="winopeng('operation/agentes/stat_win.php?type=".$graph_type."&period=86400&id=" . $module["id_agentmodule"] . "&label=" . base64_encode($module["module_name"]) . "&refresh=600','day_".$win_handle."')";
|
||||
}
|
||||
|
||||
$data[1] = '<a href="javascript:'.$link.'">';
|
||||
$data[1] .= html_print_image('images/chart_curve.png',true);
|
||||
$data[1] .= '</a>';
|
||||
$table_details->data[] = $data;
|
||||
|
|
|
@ -1850,8 +1850,9 @@ function graphic_incident_source($width = 320, $height = 200) {
|
|||
* @param integer width pie graph width
|
||||
* @param integer height pie graph height
|
||||
* @param string url
|
||||
* @param bool if the graph required is or not for metaconsole
|
||||
*/
|
||||
function grafico_eventos_grupo ($width = 300, $height = 200, $url = "") {
|
||||
function grafico_eventos_grupo ($width = 300, $height = 200, $url = "", $meta = false) {
|
||||
global $config;
|
||||
global $graphic_type;
|
||||
|
||||
|
@ -1864,25 +1865,37 @@ function grafico_eventos_grupo ($width = 300, $height = 200, $url = "") {
|
|||
//remove bad strings from the query so queries like ; DELETE FROM don't pass
|
||||
$url = str_ireplace ($badstrings, "", $url);
|
||||
|
||||
// Choose the table where search if metaconsole or not
|
||||
if($meta) {
|
||||
$event_table = 'tmetaconsole_event';
|
||||
$field_extra = ', agent_name';
|
||||
$groupby_extra = ', server_id';
|
||||
}
|
||||
else {
|
||||
$event_table = 'tevento';
|
||||
$field_extra = '';
|
||||
$groupby_extra = '';
|
||||
}
|
||||
|
||||
//This will give the distinct id_agente, give the id_grupo that goes
|
||||
//with it and then the number of times it occured. GROUP BY statement
|
||||
//is required if both DISTINCT() and COUNT() are in the statement
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
$sql = sprintf ('SELECT DISTINCT(id_agente) AS id_agente,
|
||||
id_grupo, COUNT(id_agente) AS count
|
||||
FROM tevento
|
||||
id_grupo, COUNT(id_agente) AS count'.$field_extra.'
|
||||
FROM '.$event_table.'
|
||||
WHERE 1=1 %s
|
||||
GROUP BY id_agente
|
||||
GROUP BY id_agente'.$groupby_extra.'
|
||||
ORDER BY count DESC', $url);
|
||||
break;
|
||||
case "postgresql":
|
||||
case "oracle":
|
||||
$sql = sprintf ('SELECT DISTINCT(id_agente) AS id_agente,
|
||||
id_grupo, COUNT(id_agente) AS count
|
||||
FROM tevento
|
||||
id_grupo, COUNT(id_agente) AS count'.$field_extra.'
|
||||
FROM '.$event_table.'
|
||||
WHERE 1=1 %s
|
||||
GROUP BY id_agente, id_grupo
|
||||
GROUP BY id_agente, id_grupo'.$groupby_extra.'
|
||||
ORDER BY count DESC', $url);
|
||||
break;
|
||||
}
|
||||
|
@ -1892,30 +1905,49 @@ function grafico_eventos_grupo ($width = 300, $height = 200, $url = "") {
|
|||
$result = array();
|
||||
}
|
||||
|
||||
$system_events = 0;
|
||||
$other_events = 0;
|
||||
|
||||
foreach ($result as $row) {
|
||||
if (!check_acl ($config["id_user"], $row["id_grupo"], "AR") == 1)
|
||||
continue;
|
||||
|
||||
if ($loop >= NUM_PIECES_PIE) {
|
||||
if (!isset ($data[__('Other')]))
|
||||
$data[__('Other')] = 0;
|
||||
$data[__('Other')] += $row["count"];
|
||||
if ($loop >= NUM_PIECES_PIE) {
|
||||
$other_events += $row["count"];
|
||||
}
|
||||
else {
|
||||
if ($row["id_agente"] == 0) {
|
||||
$name = __('SYSTEM')." (".$row["count"].")";
|
||||
$system_events += $row["count"];
|
||||
}
|
||||
else {
|
||||
$name = mb_substr (agents_get_name ($row["id_agente"], "lower"), 0, 14)." (".$row["count"].")";
|
||||
if($meta) {
|
||||
$name = mb_substr (io_safe_output($row['agent_name']), 0, 14)." (".$row["count"].")";
|
||||
}
|
||||
else {
|
||||
$name = mb_substr (agents_get_name ($row["id_agente"], "lower"), 0, 14)." (".$row["count"].")";
|
||||
}
|
||||
$data[$name] = $row["count"];
|
||||
}
|
||||
$data[$name] = $row["count"];
|
||||
}
|
||||
$loop++;
|
||||
}
|
||||
|
||||
if($system_events > 0) {
|
||||
$name = __('SYSTEM')." (".$system_events.")";
|
||||
$data[$name] = $system_events;
|
||||
}
|
||||
|
||||
if($other_events > 0) {
|
||||
$name = __('Other')." (".$other_events.")";
|
||||
$data[$name] = $other_events;
|
||||
}
|
||||
|
||||
// Sort the data
|
||||
arsort($data);
|
||||
|
||||
$water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png",
|
||||
'url' => ui_get_full_url("/images/logo_vertical_water.png"));
|
||||
|
||||
'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false, false));
|
||||
|
||||
return pie3d_graph($config['flash_charts'], $data, $width, $height,
|
||||
__('Other'), '', $water_mark,
|
||||
$config['fontpath'], $config['font_size']);
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
// Show the modal window of an event
|
||||
function show_event_dialog(event_id, group_rep, dialog_page, result) {
|
||||
var ajax_file = $('#hidden-ajax_file').val();
|
||||
|
||||
if(dialog_page == undefined) {
|
||||
dialog_page = 'general';
|
||||
}
|
||||
|
@ -9,13 +11,13 @@ function show_event_dialog(event_id, group_rep, dialog_page, result) {
|
|||
var timestamp_last = $('#hidden-timestamp_last_'+event_id).val();
|
||||
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();
|
||||
|
||||
// Check if the event
|
||||
if(similar_ids == undefined) {
|
||||
similar_ids = -1;
|
||||
}
|
||||
|
||||
jQuery.post ("ajax.php",
|
||||
// Metaconsole mode flag
|
||||
var meta = $('#hidden-meta').val();
|
||||
|
||||
jQuery.post (ajax_file,
|
||||
{"page": "include/ajax/events",
|
||||
"get_extended_event": 1,
|
||||
"group_rep": group_rep,
|
||||
|
@ -25,13 +27,15 @@ function show_event_dialog(event_id, group_rep, dialog_page, result) {
|
|||
"timestamp_first": timestamp_first,
|
||||
"timestamp_last": timestamp_last,
|
||||
"user_comment": user_comment,
|
||||
"event_id": event_id},
|
||||
"event_id": event_id,
|
||||
"server_id": server_id,
|
||||
"meta": meta},
|
||||
function (data, status) {
|
||||
$("#event_details_window").hide ()
|
||||
.empty ()
|
||||
.append (data)
|
||||
.dialog ({
|
||||
title: get_event_name(event_id),
|
||||
title: get_event_name(event_id, meta),
|
||||
resizable: true,
|
||||
draggable: true,
|
||||
modal: true,
|
||||
|
@ -101,6 +105,8 @@ function execute_response(event_id) {
|
|||
|
||||
//Show the modal window of an event response
|
||||
function show_response_dialog(event_id, response_id, response) {
|
||||
var ajax_file = $('#hidden-ajax_file').val();
|
||||
|
||||
var params = [];
|
||||
params.push("page=include/ajax/events");
|
||||
params.push("dialogue_event_response=1");
|
||||
|
@ -111,7 +117,7 @@ function show_response_dialog(event_id, response_id, response) {
|
|||
jQuery.ajax ({
|
||||
data: params.join ("&"),
|
||||
type: 'POST',
|
||||
url: action="ajax.php",
|
||||
url: action=ajax_file,
|
||||
async: false,
|
||||
timeout: 10000,
|
||||
dataType: 'html',
|
||||
|
@ -138,6 +144,8 @@ function show_response_dialog(event_id, response_id, response) {
|
|||
|
||||
// Get an event response from db
|
||||
function get_response(response_id) {
|
||||
var ajax_file = $('#hidden-ajax_file').val();
|
||||
|
||||
var response = '';
|
||||
|
||||
var params = [];
|
||||
|
@ -148,7 +156,7 @@ function get_response(response_id) {
|
|||
jQuery.ajax ({
|
||||
data: params.join ("&"),
|
||||
type: 'POST',
|
||||
url: action="ajax.php",
|
||||
url: action=ajax_file,
|
||||
async: false,
|
||||
timeout: 10000,
|
||||
dataType: 'json',
|
||||
|
@ -162,6 +170,8 @@ function get_response(response_id) {
|
|||
|
||||
// Get an event response params from db
|
||||
function get_response_params(response_id) {
|
||||
var ajax_file = $('#hidden-ajax_file').val();
|
||||
|
||||
var response_params;
|
||||
|
||||
var params = [];
|
||||
|
@ -172,7 +182,7 @@ function get_response_params(response_id) {
|
|||
jQuery.ajax ({
|
||||
data: params.join ("&"),
|
||||
type: 'POST',
|
||||
url: action="ajax.php",
|
||||
url: action=ajax_file,
|
||||
async: false,
|
||||
timeout: 10000,
|
||||
dataType: 'json',
|
||||
|
@ -186,6 +196,8 @@ function get_response_params(response_id) {
|
|||
|
||||
// Get an event response description from db
|
||||
function get_response_description(response_id) {
|
||||
var ajax_file = $('#hidden-ajax_file').val();
|
||||
|
||||
var response_description = '';
|
||||
|
||||
var params = [];
|
||||
|
@ -196,7 +208,7 @@ function get_response_description(response_id) {
|
|||
jQuery.ajax ({
|
||||
data: params.join ("&"),
|
||||
type: 'POST',
|
||||
url: action="ajax.php",
|
||||
url: action=ajax_file,
|
||||
async: false,
|
||||
timeout: 10000,
|
||||
dataType: 'html',
|
||||
|
@ -209,18 +221,21 @@ function get_response_description(response_id) {
|
|||
}
|
||||
|
||||
// Get an event response description from db
|
||||
function get_event_name(event_id) {
|
||||
function get_event_name(event_id, meta) {
|
||||
var ajax_file = $('#hidden-ajax_file').val();
|
||||
|
||||
var name = '';
|
||||
|
||||
var params = [];
|
||||
params.push("page=include/ajax/events");
|
||||
params.push("get_event_name=1");
|
||||
params.push("event_id="+event_id);
|
||||
params.push("meta="+meta);
|
||||
|
||||
jQuery.ajax ({
|
||||
data: params.join ("&"),
|
||||
type: 'POST',
|
||||
url: action="ajax.php",
|
||||
url: action=ajax_file,
|
||||
async: false,
|
||||
timeout: 10000,
|
||||
dataType: 'html',
|
||||
|
@ -238,6 +253,8 @@ function add_row_param(id_table, param) {
|
|||
|
||||
// Get an event response from db
|
||||
function get_response_target(event_id, response_id) {
|
||||
var ajax_file = $('#hidden-ajax_file').val();
|
||||
|
||||
var target = '';
|
||||
|
||||
// Replace the main macros
|
||||
|
@ -250,7 +267,7 @@ function get_response_target(event_id, response_id) {
|
|||
jQuery.ajax ({
|
||||
data: params.join ("&"),
|
||||
type: 'POST',
|
||||
url: action="ajax.php",
|
||||
url: action=ajax_file,
|
||||
async: false,
|
||||
timeout: 10000,
|
||||
dataType: 'html',
|
||||
|
@ -273,6 +290,8 @@ function get_response_target(event_id, response_id) {
|
|||
|
||||
// Perform a response and put the output into a div
|
||||
function perform_response(target) {
|
||||
var ajax_file = $('#hidden-ajax_file').val();
|
||||
|
||||
$('#re_exec_command').hide();
|
||||
$('#response_loading_command').show();
|
||||
$('#response_out').html('');
|
||||
|
@ -289,7 +308,7 @@ function perform_response(target) {
|
|||
jQuery.ajax ({
|
||||
data: params.join ("&"),
|
||||
type: 'POST',
|
||||
url: action="ajax.php",
|
||||
url: action=ajax_file,
|
||||
async: true,
|
||||
timeout: 10000,
|
||||
dataType: 'html',
|
||||
|
@ -306,14 +325,18 @@ function perform_response(target) {
|
|||
|
||||
// Change the status of an event to new, in process or validated
|
||||
function event_change_status(event_ids) {
|
||||
var ajax_file = $('#hidden-ajax_file').val();
|
||||
|
||||
var new_status = $('#estado').val();
|
||||
var event_id = $('#hidden-id_event').val();
|
||||
|
||||
var meta = $('#hidden-meta').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);
|
||||
|
||||
$('#button-status_button').attr('disabled','disabled');
|
||||
$('#response_loading').show();
|
||||
|
@ -321,7 +344,7 @@ function event_change_status(event_ids) {
|
|||
jQuery.ajax ({
|
||||
data: params.join ("&"),
|
||||
type: 'POST',
|
||||
url: action="ajax.php",
|
||||
url: action=ajax_file,
|
||||
async: true,
|
||||
timeout: 10000,
|
||||
dataType: 'html',
|
||||
|
@ -340,14 +363,18 @@ function event_change_status(event_ids) {
|
|||
|
||||
// Change te owner of an event to one user of empty
|
||||
function event_change_owner() {
|
||||
var ajax_file = $('#hidden-ajax_file').val();
|
||||
|
||||
var event_id = $('#hidden-id_event').val();
|
||||
var new_owner = $('#id_owner').val();
|
||||
|
||||
var meta = $('#hidden-meta').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);
|
||||
|
||||
$('#button-owner_button').attr('disabled','disabled');
|
||||
$('#response_loading').show();
|
||||
|
@ -355,7 +382,7 @@ function event_change_owner() {
|
|||
jQuery.ajax ({
|
||||
data: params.join ("&"),
|
||||
type: 'POST',
|
||||
url: action="ajax.php",
|
||||
url: action=ajax_file,
|
||||
async: true,
|
||||
timeout: 10000,
|
||||
dataType: 'html',
|
||||
|
@ -372,9 +399,12 @@ function event_change_owner() {
|
|||
|
||||
// Save a comment into an event
|
||||
function event_comment() {
|
||||
var ajax_file = $('#hidden-ajax_file').val();
|
||||
|
||||
var event_id = $('#hidden-id_event').val();
|
||||
var comment = $('#textarea_comment').val();
|
||||
|
||||
var meta = $('#hidden-meta').val();
|
||||
|
||||
if(comment == '') {
|
||||
show_event_dialog(event_id, $('#hidden-group_rep').val(), 'comments', 'comment_error');
|
||||
return false;
|
||||
|
@ -385,6 +415,7 @@ function event_comment() {
|
|||
params.push("add_comment=1");
|
||||
params.push("event_id="+event_id);
|
||||
params.push("comment="+comment);
|
||||
params.push("meta="+meta);
|
||||
|
||||
$('#button-comment_button').attr('disabled','disabled');
|
||||
$('#response_loading').show();
|
||||
|
@ -392,7 +423,7 @@ function event_comment() {
|
|||
jQuery.ajax ({
|
||||
data: params.join ("&"),
|
||||
type: 'POST',
|
||||
url: action="ajax.php",
|
||||
url: action=ajax_file,
|
||||
async: true,
|
||||
timeout: 10000,
|
||||
dataType: 'html',
|
||||
|
|
|
@ -32,6 +32,11 @@ if (! check_acl ($config["id_user"], 0, "IR")) {
|
|||
return;
|
||||
}
|
||||
|
||||
$meta = false;
|
||||
if(enterprise_installed() && defined("METACONSOLE")) {
|
||||
$meta = true;
|
||||
}
|
||||
|
||||
if(isset($config['event_replication']) && $config['event_replication'] == 1) {
|
||||
db_pandora_audit("ACL Violation",
|
||||
"Trying to access event viewer. View disabled due event replication.");
|
||||
|
@ -45,6 +50,7 @@ if (is_ajax ()) {
|
|||
$delete_event = (bool) get_parameter ('delete_event');
|
||||
$get_events_fired = (bool) get_parameter('get_events_fired');
|
||||
$standby_alert = (bool) get_parameter('standby_alert');
|
||||
$meta = get_parameter('meta', 0);
|
||||
|
||||
if ($get_event_tooltip) {
|
||||
$id = (int) get_parameter ('id');
|
||||
|
@ -78,16 +84,6 @@ if (is_ajax ()) {
|
|||
return;
|
||||
}
|
||||
|
||||
if ($standby_alert) {
|
||||
$id = (int) get_parameter ('id');
|
||||
$event = events_get_event ($id);
|
||||
if ($event === false)
|
||||
return;
|
||||
|
||||
alerts_agent_module_standby ($event['id_alert_am'], 1);
|
||||
return;
|
||||
}
|
||||
|
||||
if ($validate_event) {
|
||||
$id = (int) get_parameter ("id");
|
||||
$similars = (bool) get_parameter ('similars');
|
||||
|
@ -100,8 +96,7 @@ if (is_ajax ()) {
|
|||
alerts_agent_module_standby ($event['id_alert_am'], 0);
|
||||
}
|
||||
|
||||
$return = events_validate_event ($id, $similars, $comment,
|
||||
$new_status);
|
||||
$return = events_change_status ($id, $new_status, $meta);
|
||||
if ($return)
|
||||
echo 'ok';
|
||||
else
|
||||
|
@ -113,7 +108,7 @@ if (is_ajax ()) {
|
|||
$id = (array) get_parameter ("id");
|
||||
$similars = (bool) get_parameter ('similars');
|
||||
|
||||
$return = events_delete_event ($id, $similars);
|
||||
$return = events_delete_event ($id, $similars, $meta);
|
||||
if ($return)
|
||||
echo 'ok';
|
||||
else
|
||||
|
@ -267,9 +262,19 @@ if ($config["pure"] == 0) {
|
|||
$onheader['list']['active'] = true;
|
||||
break;
|
||||
}
|
||||
|
||||
ui_print_page_header (__("Events"), "images/lightning_go.png",
|
||||
false, "eventview", false, $onheader);
|
||||
|
||||
if (! defined ('METACONSOLE')) {
|
||||
ui_print_page_header (__("Events"), "images/lightning_go.png",
|
||||
false, "eventview", false, $onheader);
|
||||
}
|
||||
else {
|
||||
unset($onheader['rss']);
|
||||
unset($onheader['marquee']);
|
||||
unset($onheader['csv']);
|
||||
unset($onheader['sound_event']);
|
||||
unset($onheader['fullscreen']);
|
||||
ui_meta_print_header(__("Events"), $section, $onheader);
|
||||
}
|
||||
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
|
@ -329,8 +334,8 @@ if ($validate) {
|
|||
}
|
||||
|
||||
if (isset($ids[0]) && $ids[0] != -1) {
|
||||
$return = events_validate_event ($ids, ($group_rep == 1),
|
||||
$comment, $new_status);
|
||||
$return = events_change_status ($ids, $new_status, $meta);
|
||||
|
||||
if ($new_status == 1) {
|
||||
ui_print_result_message ($return,
|
||||
__('Successfully validated'),
|
||||
|
@ -342,15 +347,6 @@ if ($validate) {
|
|||
__('Could not be set in process'));
|
||||
}
|
||||
}
|
||||
|
||||
if ($standby_alert) {
|
||||
foreach ($ids as $id) {
|
||||
$event = events_get_event ($id);
|
||||
if ($event !== false) {
|
||||
alerts_agent_module_standby ($event['id_alert_am'], 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Process deletion (pass array or single value)
|
||||
|
@ -358,12 +354,12 @@ if ($delete) {
|
|||
$ids = (array) get_parameter ("validate_ids", -1);
|
||||
|
||||
if ($ids[0] != -1) {
|
||||
$return = events_delete_event ($ids, ($group_rep == 1));
|
||||
$return = events_delete_event ($ids, ($group_rep == 1), $meta);
|
||||
ui_print_result_message ($return,
|
||||
__('Successfully deleted'),
|
||||
__('Could not be deleted'));
|
||||
}
|
||||
require_once('operation/events/events_list.php');
|
||||
require_once($config['homedir'].'/operation/events/events_list.php');
|
||||
}
|
||||
else {
|
||||
switch ($section) {
|
||||
|
@ -392,12 +388,6 @@ $(document).ready( function() {
|
|||
|
||||
$('#select_validate').change (function() {
|
||||
$option = $('#select_validate').val();
|
||||
if ($option == 2) {
|
||||
$(".standby_alert_checkbox").css('display', '');
|
||||
}
|
||||
else {
|
||||
$(".standby_alert_checkbox").css('display', 'none');
|
||||
}
|
||||
});
|
||||
|
||||
$("#tgl_event_control").click (function () {
|
||||
|
@ -419,31 +409,13 @@ $(document).ready( function() {
|
|||
|
||||
var comment = $('#textarea_comment_'+id).val();
|
||||
var select_validate = $('#select_validate_'+id).val(); // 1 validate, 2 in process, 3 add comment
|
||||
var checkbox_standby_alert = $('#checkbox-standby-alert-'+id).attr('checked');
|
||||
var similars = $('#group_rep').val();
|
||||
|
||||
if (!select_validate) {
|
||||
select_validate = 1;
|
||||
}
|
||||
|
||||
if (checkbox_standby_alert) {
|
||||
jQuery.post ("ajax.php",
|
||||
{"page" : "operation/events/events",
|
||||
"standby_alert" : 1,
|
||||
"id" : id
|
||||
},
|
||||
function (data, status) {
|
||||
if (data != "ok") {
|
||||
$("#result")
|
||||
.showMessage ("<?php echo __('Could not set standby alert')?>")
|
||||
.addClass ("error");
|
||||
}
|
||||
},
|
||||
"html"
|
||||
);
|
||||
}
|
||||
|
||||
jQuery.post ("ajax.php",
|
||||
jQuery.post ("<?php echo ui_get_full_url("ajax.php", false, false, false); ?>",
|
||||
{"page" : "operation/events/events",
|
||||
"validate_event" : 1,
|
||||
"id" : id,
|
||||
|
@ -462,7 +434,7 @@ $(document).ready( function() {
|
|||
$("#status_row_"+id).html(<?php echo "'" . __('Event validated') . "'"; ?>);
|
||||
|
||||
// Get event comment
|
||||
jQuery.post ("ajax.php",
|
||||
jQuery.post ("<?php echo ui_get_full_url("ajax.php", false, false, false); ?>",
|
||||
{"page" : "operation/events/events",
|
||||
"get_comment" : 1,
|
||||
"id" : id
|
||||
|
@ -472,7 +444,7 @@ $(document).ready( function() {
|
|||
});
|
||||
|
||||
// Get event comment in header
|
||||
jQuery.post ("ajax.php",
|
||||
jQuery.post ("<?php echo ui_get_full_url("ajax.php", false, false, false); ?>",
|
||||
{"page" : "operation/events/events",
|
||||
"get_comment_header" : 1,
|
||||
"id" : id
|
||||
|
@ -520,7 +492,7 @@ $(document).ready( function() {
|
|||
$("#status_row_"+id).html(<?php echo "'" . __('Event in process') . "'"; ?>);
|
||||
|
||||
// Get event comment
|
||||
jQuery.post ("ajax.php",
|
||||
jQuery.post ("<?php echo ui_get_full_url("ajax.php", false, false, false); ?>",
|
||||
{"page" : "operation/events/events",
|
||||
"get_comment" : 1,
|
||||
"id" : id
|
||||
|
@ -530,7 +502,7 @@ $(document).ready( function() {
|
|||
});
|
||||
|
||||
// Get event comment in header
|
||||
jQuery.post ("ajax.php",
|
||||
jQuery.post ("<?php echo ui_get_full_url("ajax.php", false, false, false); ?>",
|
||||
{"page" : "operation/events/events",
|
||||
"get_comment_header" : 1,
|
||||
"id" : id
|
||||
|
@ -581,7 +553,7 @@ $(document).ready( function() {
|
|||
} // Add comment
|
||||
else if (select_validate == 3) {
|
||||
// Get event comment
|
||||
jQuery.post ("ajax.php",
|
||||
jQuery.post ("<?php echo ui_get_full_url("ajax.php", false, false, false); ?>",
|
||||
{"page" : "operation/events/events",
|
||||
"get_comment" : 1,
|
||||
"id" : id
|
||||
|
@ -591,7 +563,7 @@ $(document).ready( function() {
|
|||
});
|
||||
|
||||
// Get event comment in header
|
||||
jQuery.post ("ajax.php",
|
||||
jQuery.post ("<?php echo ui_get_full_url("ajax.php", false, false, false); ?>",
|
||||
{"page" : "operation/events/events",
|
||||
"get_comment_header" : 1,
|
||||
"id" : id
|
||||
|
@ -618,13 +590,16 @@ $(document).ready( function() {
|
|||
if (!confirmation) {
|
||||
return;
|
||||
}
|
||||
meta = $('#hidden-meta').val();
|
||||
|
||||
$tr = $(this).parents ("tr");
|
||||
id = this.id.split ("-").pop ();
|
||||
jQuery.post ("ajax.php",
|
||||
jQuery.post ("<?php echo ui_get_full_url("ajax.php", false, false, false); ?>",
|
||||
{"page" : "operation/events/events",
|
||||
"delete_event" : 1,
|
||||
"id" : id,
|
||||
"similars" : <?php echo ($group_rep ? 1 : 0) ?>
|
||||
"similars" : <?php echo ($group_rep ? 1 : 0) ?>,
|
||||
"meta" : meta
|
||||
},
|
||||
function (data, status) {
|
||||
if (data == "ok") {
|
||||
|
@ -654,19 +629,12 @@ $(document).ready( function() {
|
|||
|
||||
$('#select_validate_' + id_event).change (function() {
|
||||
$option = $('#select_validate_' + id_event).val();
|
||||
if ($option == 2) {
|
||||
$("#standby_alert_checkbox_" + id_event).css('display', '');
|
||||
}
|
||||
else {
|
||||
$("#standby_alert_checkbox_" + id_event).css('display', 'none');
|
||||
}
|
||||
});
|
||||
|
||||
if (display != 'none') {
|
||||
$('.event_form_' + id_event).css('display', 'none');
|
||||
// Hide All showed rows
|
||||
$('.event_form').css('display', 'none');
|
||||
$(".standby_alert_checkbox").css('display', 'none');
|
||||
$(".select_validate").find('option:first').attr('selected', 'selected').parent('select');
|
||||
}
|
||||
else {
|
||||
|
@ -681,14 +649,16 @@ $(document).ready( function() {
|
|||
|
||||
var similar_ids;
|
||||
similar_ids = $('#hidden-similar_ids_'+id).val();
|
||||
meta = $('#hidden-meta').val();
|
||||
|
||||
$("#status_img_"+id).attr ("src", "images/spinner.gif");
|
||||
|
||||
jQuery.post ("ajax.php",
|
||||
jQuery.post ("<?php echo ui_get_full_url("ajax.php", false, false, false); ?>",
|
||||
{"page" : "include/ajax/events",
|
||||
"change_status" : 1,
|
||||
"event_ids" : similar_ids,
|
||||
"new_status" : new_status
|
||||
"new_status" : new_status,
|
||||
"meta" : meta
|
||||
},
|
||||
function (data, status) {
|
||||
if (data == "status_ok") {
|
||||
|
|
|
@ -36,6 +36,11 @@ if (! check_acl ($config["id_user"], 0, "IR")) {
|
|||
return;
|
||||
}
|
||||
|
||||
$meta = false;
|
||||
if(enterprise_installed() && defined("METACONSOLE")) {
|
||||
$meta = true;
|
||||
}
|
||||
|
||||
if (is_ajax()) {
|
||||
$get_filter_values = get_parameter('get_filter_values', 0);
|
||||
$save_event_filter = get_parameter('save_event_filter', 0);
|
||||
|
@ -527,22 +532,30 @@ 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));
|
||||
echo grafico_eventos_grupo(350, 248, rawurlencode ($sql_post), $meta);
|
||||
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';
|
||||
}
|
||||
else {
|
||||
$event_table = 'tevento';
|
||||
}
|
||||
|
||||
if ($group_rep == 0) {
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
$sql = "SELECT *
|
||||
FROM tevento
|
||||
FROM $event_table
|
||||
WHERE 1=1 ".$sql_post."
|
||||
ORDER BY utimestamp DESC LIMIT ".$offset.",".$pagination;
|
||||
break;
|
||||
case "postgresql":
|
||||
$sql = "SELECT *
|
||||
FROM tevento
|
||||
FROM $event_table
|
||||
WHERE 1=1 ".$sql_post."
|
||||
ORDER BY utimestamp DESC LIMIT ".$pagination." OFFSET ".$offset;
|
||||
break;
|
||||
|
@ -551,7 +564,7 @@ if ($group_rep == 0) {
|
|||
$set['limit'] = $pagination;
|
||||
$set['offset'] = $offset;
|
||||
$sql = "SELECT *
|
||||
FROM tevento
|
||||
FROM $event_table
|
||||
WHERE 1=1 ".$sql_post."
|
||||
ORDER BY utimestamp DESC";
|
||||
$sql = oracle_recode_query ($sql, $set);
|
||||
|
@ -562,7 +575,7 @@ if ($group_rep == 0) {
|
|||
$result = db_get_all_rows_sql ($sql);
|
||||
}
|
||||
else {
|
||||
$result = events_get_events_grouped($sql_post, $offset, $pagination);
|
||||
$result = events_get_events_grouped($sql_post, $offset, $pagination, $meta);
|
||||
}
|
||||
|
||||
// Delete rnum field generated by oracle_recode_query() function
|
||||
|
@ -574,13 +587,13 @@ if (($config['dbtype'] == 'oracle') && ($result !== false)) {
|
|||
|
||||
if ($group_rep == 0) {
|
||||
$sql = "SELECT COUNT(id_evento)
|
||||
FROM tevento
|
||||
FROM $event_table
|
||||
WHERE 1=1 " . $sql_post;
|
||||
}
|
||||
else {
|
||||
$sql = "SELECT COUNT(1)
|
||||
FROM (SELECT 1
|
||||
FROM tevento
|
||||
FROM $event_table
|
||||
WHERE 1=1 " . $sql_post . "
|
||||
GROUP BY evento, id_agentmodule) AS t";
|
||||
}
|
||||
|
@ -606,6 +619,11 @@ $i = 0;
|
|||
$table->head[$i] = __('ID');
|
||||
$table->align[$i] = 'center';
|
||||
$i++;
|
||||
if (in_array('server_name', $show_fields)) {
|
||||
$table->head[$i] = __('Server');
|
||||
$table->align[$i] = 'center';
|
||||
$i++;
|
||||
}
|
||||
if (in_array('estado', $show_fields)) {
|
||||
$table->head[$i] = __('Status');
|
||||
$table->align[$i] = 'center';
|
||||
|
@ -751,6 +769,20 @@ foreach ($result as $event) {
|
|||
$data[$i] .= html_print_input_hidden('similar_ids_' . $event["id_evento"], $similar_ids, true);
|
||||
$data[$i] .= html_print_input_hidden('timestamp_first_' . $event["id_evento"], $timestamp_first, true);
|
||||
$data[$i] .= html_print_input_hidden('timestamp_last_' . $event["id_evento"], $timestamp_last, true);
|
||||
|
||||
// Store server id if is metaconsole. 0 otherwise
|
||||
if($meta) {
|
||||
$server_id = $event['server_id'];
|
||||
|
||||
// If meta activated, propagate the id of the event on node (source id)
|
||||
$data[$i] .= html_print_input_hidden('source_id_' . $event["id_evento"], $event['id_source_event'], true);
|
||||
}
|
||||
else {
|
||||
$server_id = 0;
|
||||
}
|
||||
|
||||
$data[$i] .= html_print_input_hidden('server_id_' . $event["id_evento"], $server_id, true);
|
||||
|
||||
if (empty($event['event_rep'])) {
|
||||
$event['event_rep'] = 0;
|
||||
}
|
||||
|
@ -760,6 +792,15 @@ foreach ($result as $event) {
|
|||
|
||||
$i++;
|
||||
|
||||
if (in_array('server_name',$show_fields)) {
|
||||
if($meta) {
|
||||
$data[$i] = db_get_value('server_name','tmetaconsole_setup','id',$event["server_id"]);
|
||||
}
|
||||
else {
|
||||
$data[$i] = db_get_value('name','tserver','id_server',$event["server_id"]);
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
if (in_array('estado',$show_fields)) {
|
||||
$data[$i] = html_print_image ($img_st, true,
|
||||
array ("class" => "image_status",
|
||||
|
@ -813,7 +854,12 @@ foreach ($result as $event) {
|
|||
|
||||
if ($event["id_agente"] > 0) {
|
||||
// Agent name
|
||||
$data[$i] .= ui_print_agent_name ($event["id_agente"], true);
|
||||
if($meta) {
|
||||
$data[$i] .= $event["agent_name"];
|
||||
}
|
||||
else {
|
||||
$data[$i] .= ui_print_agent_name ($event["id_agente"], true);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$data[$i] .= '';
|
||||
|
@ -848,12 +894,17 @@ foreach ($result as $event) {
|
|||
}
|
||||
|
||||
if (in_array('id_grupo',$show_fields)) {
|
||||
$id_group = $event["id_grupo"];
|
||||
$group_name = db_get_value('nombre', 'tgrupo', 'id_grupo', $id_group);
|
||||
if ($id_group == 0) {
|
||||
$group_name = __('All');
|
||||
if($meta) {
|
||||
$data[$i] = $event['group_name'];
|
||||
}
|
||||
else {
|
||||
$id_group = $event["id_grupo"];
|
||||
$group_name = db_get_value('nombre', 'tgrupo', 'id_grupo', $id_group);
|
||||
if ($id_group == 0) {
|
||||
$group_name = __('All');
|
||||
}
|
||||
$data[$i] = $group_name;
|
||||
}
|
||||
$data[$i] = $group_name;
|
||||
$i++;
|
||||
}
|
||||
|
||||
|
@ -863,24 +914,34 @@ foreach ($result as $event) {
|
|||
}
|
||||
|
||||
if (in_array('id_agentmodule',$show_fields)) {
|
||||
$data[$i] = '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$event["id_agente"].'&tab=data">'
|
||||
. db_get_value('nombre', 'tagente_modulo', 'id_agente_modulo', $event["id_agentmodule"]).'</a>';
|
||||
if($meta) {
|
||||
$data[$i] = $event["module_name"];
|
||||
}
|
||||
else {
|
||||
$data[$i] = '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$event["id_agente"].'&tab=data">'
|
||||
. db_get_value('nombre', 'tagente_modulo', 'id_agente_modulo', $event["id_agentmodule"]).'</a>';
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
|
||||
if (in_array('id_alert_am',$show_fields)) {
|
||||
if ($event["id_alert_am"] != 0) {
|
||||
$sql = 'SELECT name
|
||||
FROM talert_templates
|
||||
WHERE id IN (SELECT id_alert_template
|
||||
FROM talert_template_modules
|
||||
WHERE id = ' . $event["id_alert_am"] . ');';
|
||||
|
||||
$templateName = db_get_sql($sql);
|
||||
$data[$i] = '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$event["id_agente"].'&tab=alert">'.$templateName.'</a>';
|
||||
if($meta) {
|
||||
$data[$i] = $event["alert_template_name"];
|
||||
}
|
||||
else {
|
||||
$data[$i] = '';
|
||||
if ($event["id_alert_am"] != 0) {
|
||||
$sql = 'SELECT name
|
||||
FROM talert_templates
|
||||
WHERE id IN (SELECT id_alert_template
|
||||
FROM talert_template_modules
|
||||
WHERE id = ' . $event["id_alert_am"] . ');';
|
||||
|
||||
$templateName = db_get_sql($sql);
|
||||
$data[$i] = '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$event["id_agente"].'&tab=alert">'.$templateName.'</a>';
|
||||
}
|
||||
else {
|
||||
$data[$i] = '';
|
||||
}
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
|
@ -984,6 +1045,7 @@ foreach ($result as $event) {
|
|||
|
||||
echo '<div id="events_list">';
|
||||
if (!empty ($table->data)) {
|
||||
echo '<div style="clear:both"></div>';
|
||||
ui_pagination ($total_events, $url."&pure=".$config["pure"], $offset, $pagination);
|
||||
|
||||
echo '<form method="post" id="form_events" action="'.$url.'">';
|
||||
|
@ -1024,6 +1086,10 @@ echo '</div>';
|
|||
|
||||
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);
|
||||
|
||||
ui_require_jquery_file('json');
|
||||
?>
|
||||
<script language="javascript" type="text/javascript">
|
||||
|
@ -1073,7 +1139,7 @@ $(document).ready( function() {
|
|||
else {
|
||||
$('#row_name').css('visibility', '');
|
||||
$("#submit-update_filter").css('visibility', '');
|
||||
jQuery.post ("ajax.php",
|
||||
jQuery.post ("<?php echo ui_get_full_url("ajax.php", false, false, false); ?>",
|
||||
{"page" : "operation/events/events_list",
|
||||
"get_filter_values" : 1,
|
||||
"id" : $('#filter_id').val()
|
||||
|
@ -1142,7 +1208,7 @@ $(document).ready( function() {
|
|||
|
||||
var id_filter_save;
|
||||
|
||||
jQuery.post ("ajax.php",
|
||||
jQuery.post ("<?php echo ui_get_full_url("ajax.php", false, false, false); ?>",
|
||||
{"page" : "operation/events/events_list",
|
||||
"save_event_filter" : 1,
|
||||
"id_name" : $("#text-id_name").val(),
|
||||
|
@ -1176,7 +1242,7 @@ $(document).ready( function() {
|
|||
// Add 'none' option the first
|
||||
$('#filter_id').append ($('<option></option>').html ( <?php echo "'" . __('none') . "'" ?> ).attr ("value", 0));
|
||||
// Reload filters select
|
||||
jQuery.post ("ajax.php",
|
||||
jQuery.post ("<?php echo ui_get_full_url("ajax.php", false, false, false); ?>",
|
||||
{
|
||||
"page" : "operation/events/events_list",
|
||||
"get_event_filters" : 1
|
||||
|
@ -1213,7 +1279,7 @@ $(document).ready( function() {
|
|||
|
||||
var id_filter_update = $("#filter_id").val();
|
||||
|
||||
jQuery.post ("ajax.php",
|
||||
jQuery.post ("<?php echo ui_get_full_url("ajax.php", false, false, false); ?>",
|
||||
{"page" : "operation/events/events_list",
|
||||
"update_event_filter" : 1,
|
||||
"id" : $("#filter_id").val(),
|
||||
|
@ -1247,7 +1313,7 @@ $(document).ready( function() {
|
|||
// Add 'none' option the first
|
||||
$('#filter_id').append ($('<option></option>').html ( <?php echo "'" . __('none') . "'" ?> ).attr ("value", 0));
|
||||
// Reload filters select
|
||||
jQuery.post ("ajax.php",
|
||||
jQuery.post ("<?php echo ui_get_full_url("ajax.php", false, false, false); ?>",
|
||||
{"page" : "operation/events/events_list",
|
||||
"get_event_filters" : 1
|
||||
},
|
||||
|
@ -1279,7 +1345,7 @@ $(document).ready( function() {
|
|||
jQuery.ajax ({
|
||||
data: params.join ("&"),
|
||||
type: 'POST',
|
||||
url: action="ajax.php",
|
||||
url: action="<?php echo ui_get_full_url("ajax.php", false, false, false); ?>",
|
||||
async: false,
|
||||
timeout: 10000,
|
||||
success: function (data) {
|
||||
|
@ -1296,7 +1362,7 @@ $(document).ready( function() {
|
|||
jQuery.ajax ({
|
||||
data: params.join ("&"),
|
||||
type: 'POST',
|
||||
url: action="ajax.php",
|
||||
url: action="<?php echo ui_get_full_url("ajax.php", false, false, false); ?>",
|
||||
async: false,
|
||||
timeout: 10000,
|
||||
success: function (data) {
|
||||
|
|
Loading…
Reference in New Issue