2010-09-17 Sergio Martin <sergio.martin@artica.es>
* include/functions_events.php pandoradb.sql extras/pandoradb_migrate_v3.1_to_v3.2.sql operation/events/events_validate.php operation/events/events_list.php operation/events/events.php: Deleted several columns from the events view and adding a show/hide advanced fields feature. Added a new state 'in process' to validation and an input comment when a status is changed. * include/fgraph.php: Fixed quotes in constant definition * include/functions_ui.php include/functions_agents.php include/functions_alerts.php operation/agentes/alerts_status.php operation/agentes/alerts_status.functions.php images/bell_pause.png godmode/alerts/alert_list.list.php godmode/alerts/alert_list.php godmode/massive/massive_operations.php godmode/massive/massive_standby_alerts.php: Added the feature of set and set off on standby an alert in the alets management and view if an alert is in standby in the rest of views. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3251 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
815adff2a4
commit
4f7fb22103
|
@ -1,3 +1,33 @@
|
|||
2010-09-17 Sergio Martin <sergio.martin@artica.es>
|
||||
|
||||
* include/functions_events.php
|
||||
pandoradb.sql
|
||||
extras/pandoradb_migrate_v3.1_to_v3.2.sql
|
||||
operation/events/events_validate.php
|
||||
operation/events/events_list.php
|
||||
operation/events/events.php: Deleted several
|
||||
columns from the events view and adding a
|
||||
show/hide advanced fields feature.
|
||||
Added a new state 'in process' to validation
|
||||
and an input comment when a status is changed.
|
||||
|
||||
* include/fgraph.php: Fixed quotes
|
||||
in constant definition
|
||||
|
||||
* include/functions_ui.php
|
||||
include/functions_agents.php
|
||||
include/functions_alerts.php
|
||||
operation/agentes/alerts_status.php
|
||||
operation/agentes/alerts_status.functions.php
|
||||
images/bell_pause.png
|
||||
godmode/alerts/alert_list.list.php
|
||||
godmode/alerts/alert_list.php
|
||||
godmode/massive/massive_operations.php
|
||||
godmode/massive/massive_standby_alerts.php: Added
|
||||
the feature of set and set off on standby an alert
|
||||
in the alets management and view if an alert is in
|
||||
standby in the rest of views.
|
||||
|
||||
2010-09-17 Miguel de Dios <miguel.dedios@artica.es>
|
||||
|
||||
* include/fgraph.php: added function "grafico_modulo_sparse_mobile" for
|
||||
|
|
|
@ -122,3 +122,8 @@ CREATE TABLE IF NOT EXISTS `tagent_custom_data` (
|
|||
PRIMARY KEY (`id_field`, `id_agent`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `tagent_custom_data`
|
||||
-- -----------------------------------------------------
|
||||
|
||||
ALTER TABLE `tevento` MODIFY COLUMN `user_comment` TEXT NOT NULL;
|
||||
|
|
|
@ -34,10 +34,6 @@ if (! give_acl ($config['id_user'], 0, "LW")) {
|
|||
exit;
|
||||
}
|
||||
|
||||
if (isset($_GET["tab"])) {
|
||||
echo "<h2>".__('Alerts')."</h2>";
|
||||
}
|
||||
|
||||
// Table for filter controls
|
||||
$form_filter = '<form method="post" action="index.php?sec=galertas&sec2=godmode/alerts/alert_list&refr='.$config["refr"].'&pure='.$config["pure"].'">';
|
||||
$form_filter .= "<input type='hidden' name='search' value='1' />\n";
|
||||
|
@ -88,6 +84,11 @@ $ed_list = array ();
|
|||
$ed_list[0] = __('Enable');
|
||||
$ed_list[1] = __('Disable');
|
||||
$form_filter .= print_select ($ed_list, 'enabledisable', $enabledisable, '', __('All'), -1, true);
|
||||
$form_filter .= "</td><td>".__('Standby')."</td><td>";
|
||||
$sb_list = array ();
|
||||
$sb_list[1] = __('Standby on');
|
||||
$sb_list[0] = __('Standby off');
|
||||
$form_filter .= print_select ($sb_list, 'standby', $standby, '', __('All'), -1, true);
|
||||
$form_filter .= "</td></tr>\n";
|
||||
|
||||
$form_filter .= "<tr>\n";
|
||||
|
@ -128,6 +129,8 @@ if ($searchFlag) {
|
|||
$where .= " AND id IN (SELECT id_alert_template_module FROM talert_template_module_actions WHERE id_alert_action = " . $actionID . ")";
|
||||
if ($enabledisable != -1)
|
||||
$where .= " AND talert_template_modules.disabled =" . $enabledisable;
|
||||
if ($standby != -1)
|
||||
$where .= " AND talert_template_modules.standby =" . $standby;
|
||||
}
|
||||
|
||||
$total = get_agent_alerts_simple (array_keys ($agents), false,
|
||||
|
@ -142,6 +145,8 @@ $sort = get_parameter('sort', 'none');
|
|||
$selected = 'border: 1px solid black;';
|
||||
$selectDisabledUp = '';
|
||||
$selectDisabledDown = '';
|
||||
$selectStandbyUp = '';
|
||||
$selectStandbyDown = '';
|
||||
$selectAgentUp = '';
|
||||
$selectAgentDown = '';
|
||||
$selectModuleUp = '';
|
||||
|
@ -162,6 +167,18 @@ switch ($sortField) {
|
|||
break;
|
||||
}
|
||||
break;
|
||||
case 'standby':
|
||||
switch ($sort) {
|
||||
case 'up':
|
||||
$selectStandbyUp = $selected;
|
||||
$order = array('field' => 'standby', 'order' => 'ASC');
|
||||
break;
|
||||
case 'down':
|
||||
$selectStandbyDown = $selected;
|
||||
$order = array('field' => 'standby', 'order' => 'DESC');
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'agent':
|
||||
switch ($sort) {
|
||||
case 'up':
|
||||
|
@ -202,6 +219,8 @@ switch ($sortField) {
|
|||
if (!$id_agente) {
|
||||
$selectDisabledUp = '';
|
||||
$selectDisabledDown = '';
|
||||
$selectStandbyUp = '';
|
||||
$selectStandbyDown = '';
|
||||
$selectAgentUp = $selected;
|
||||
$selectAgentDown = '';
|
||||
$selectModuleUp = '';
|
||||
|
@ -213,6 +232,8 @@ switch ($sortField) {
|
|||
else {
|
||||
$selectDisabledUp = '';
|
||||
$selectDisabledDown = '';
|
||||
$selectStandbyUp = '';
|
||||
$selectStandbyDown = '';
|
||||
$selectAgentUp = '';
|
||||
$selectAgentDown = '';
|
||||
$selectModuleUp = $selected;
|
||||
|
@ -247,19 +268,23 @@ $table->width = '90%';
|
|||
$table->size = array ();
|
||||
|
||||
$table->align[0] = 'center';
|
||||
$table->align[1] = 'center';
|
||||
|
||||
$table->head = array ();
|
||||
$table->head[0] = "<span title='" . __('Enabled / Disabled') . "'>" . __('E/D') . "</span>" . ' ' .
|
||||
$table->head[0] = "<span title='" . __('Enabled / Disabled') . "'>" . __('E/D') . "</span><br>" .
|
||||
'<a href="' . $url . '&sort_field=disabled&sort=up"><img src="images/sort_up.png" style="' . $selectDisabledUp . '" /></a>' .
|
||||
'<a href="' . $url . '&sort_field=disabled&sort=down"><img src="images/sort_down.png" style="' . $selectDisabledDown . '" /></a>';
|
||||
$table->head[1] = "<span title='" . __('Standby') . "'>" . __('Standby') . "</span><br>" .
|
||||
'<a href="' . $url . '&sort_field=standby&sort=up"><img src="images/sort_up.png" style="' . $selectStandbyUp . '" /></a>' .
|
||||
'<a href="' . $url . '&sort_field=standby&sort=down"><img src="images/sort_down.png" style="' . $selectStandbyDown . '" /></a>';
|
||||
if (! $id_agente) {
|
||||
$table->style = array ();
|
||||
$table->style[1] = 'font-weight: bold';
|
||||
$table->head[1] = __('Agent') . ' ' .
|
||||
$table->style[2] = 'font-weight: bold';
|
||||
$table->head[2] = __('Agent') . '<br>' .
|
||||
'<a href="' . $url . '&sort_field=agent&sort=up"><img src="images/sort_up.png" style="' . $selectAgentUp . '" /></a>' .
|
||||
'<a href="' . $url . '&sort_field=agent&sort=down"><img src="images/sort_down.png" style="' . $selectAgentDown . '" /></a>';
|
||||
$table->size[0] = '12%';
|
||||
$table->size[1] = '15%';
|
||||
$table->size[0] = '8%';
|
||||
$table->size[1] = '8%';
|
||||
$table->size[2] = '20%';
|
||||
$table->size[3] = '15%';
|
||||
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
|
||||
|
@ -269,7 +294,8 @@ if (! $id_agente) {
|
|||
}
|
||||
else {
|
||||
/* Different sizes or the layout screws up */
|
||||
$table->size[0] = '12%';
|
||||
$table->size[0] = '8%';
|
||||
$table->size[1] = '8%';
|
||||
$table->size[2] = '30%';
|
||||
$table->size[3] = '20%';
|
||||
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
|
||||
|
@ -278,18 +304,18 @@ else {
|
|||
$table->size[5] = '50%';
|
||||
}
|
||||
|
||||
$table->head[2] = __('Module') . ' ' .
|
||||
$table->head[3] = __('Module') . '<br>' .
|
||||
'<a href="' . $url . '&sort_field=module&sort=up"><img src="images/sort_up.png" style="' . $selectModuleUp . '" /></a>' .
|
||||
'<a href="' . $url . '&sort_field=module&sort=down"><img src="images/sort_down.png" style="' . $selectModuleDown . '" /></a>';
|
||||
$table->head[3] = __('Template') . ' ' .
|
||||
$table->head[4] = __('Template') . '<br>' .
|
||||
'<a href="' . $url . '&sort_field=template&sort=up"><img src="images/sort_up.png" style="' . $selectTemplateUp . '" /></a>' .
|
||||
'<a href="' . $url . '&sort_field=template&sort=down"><img src="images/sort_down.png" style="' . $selectTemplateDown . '" /></a>';
|
||||
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
|
||||
$table->head[4] = "<span title='" . __('Policy') . "'>" . __('P.') . "</span>";
|
||||
$table->head[5] = "<span title='" . __('Policy') . "'>" . __('P.') . "</span>";
|
||||
}
|
||||
$table->head[5] = __('Actions');
|
||||
$table->head[6] = __('Status');
|
||||
$table->head[7] = __('Delete');
|
||||
$table->head[6] = __('Actions');
|
||||
$table->head[7] = __('Status');
|
||||
$table->head[8] = __('Delete');
|
||||
|
||||
$table->valign[6] = 'middle';
|
||||
$table->align[6] = 'center';
|
||||
|
@ -325,33 +351,46 @@ foreach ($simple_alerts as $alert) {
|
|||
}
|
||||
$data[0] .= print_input_hidden ('id_alert', $alert['id'], true);
|
||||
$data[0] .= '</form>';
|
||||
|
||||
$data[1] = '<form class="standby_alert_form" method="post" style="display: inline;">';
|
||||
if (!$alert['standby']) {
|
||||
$data[1] .= print_input_image ('standby_off', 'images/bell.png', 1, '', true);
|
||||
$data[1] .= print_input_hidden ('standbyon_alert', 1, true);
|
||||
}
|
||||
else {
|
||||
$data[1] .= print_input_image ('standby_on', 'images/bell_pause.png', 1, '', true);
|
||||
$data[1] .= print_input_hidden ('standbyoff_alert', 1, true);
|
||||
}
|
||||
$data[1] .= print_input_hidden ('id_alert', $alert['id'], true);
|
||||
$data[1] .= '</form>';
|
||||
|
||||
if (! $id_agente) {
|
||||
$id_agent = get_agentmodule_agent ($alert['id_agent_module']);
|
||||
$data[1] = '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=main&id_agente='.$id_agent.'">';
|
||||
$data[2] = '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=main&id_agente='.$id_agent.'">';
|
||||
if ($alert['disabled'])
|
||||
$data[1] .= '<span style="font-style: italic; color: #aaaaaa;">';
|
||||
$data[1] .= get_agent_name ($id_agent);
|
||||
$data[2] .= '<span style="font-style: italic; color: #aaaaaa;">';
|
||||
$data[2] .= get_agent_name ($id_agent);
|
||||
if ($alert['disabled'])
|
||||
$data[1] .= '</span>';
|
||||
$data[1] .= '</a>';
|
||||
$data[2] .= '</span>';
|
||||
$data[2] .= '</a>';
|
||||
}
|
||||
$data[2] = get_agentmodule_name ($alert['id_agent_module']);
|
||||
$data[3] = ' <a class="template_details"
|
||||
$data[3] = get_agentmodule_name ($alert['id_agent_module']);
|
||||
$data[4] = ' <a class="template_details"
|
||||
href="ajax.php?page=godmode/alerts/alert_templates&get_template_tooltip=1&id_template='.$alert['id_alert_template'].'">
|
||||
<img id="template-details-'.$alert['id_alert_template'].'" class="img_help" src="images/zoom.png"/></a> ';
|
||||
|
||||
$data[3] .= "<a href='index.php?sec=galertas&sec2=godmode/alerts/configure_alert_template&id=".$alert['id_alert_template']."'>";
|
||||
$data[3] .= get_alert_template_name ($alert['id_alert_template']);
|
||||
$data[3] .= "</a>";
|
||||
$data[4] .= "<a href='index.php?sec=galertas&sec2=godmode/alerts/configure_alert_template&id=".$alert['id_alert_template']."'>";
|
||||
$data[4] .= get_alert_template_name ($alert['id_alert_template']);
|
||||
$data[4] .= "</a>";
|
||||
|
||||
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
|
||||
$policyInfo = isAlertInPolicy($alert['id_agent_module'], $alert['id_alert_template'], false);
|
||||
if ($policyInfo === false)
|
||||
$data[4] = '';
|
||||
$data[5] = '';
|
||||
else {
|
||||
$img = 'images/policies.png';
|
||||
|
||||
$data[4] = '<a href="?sec=gpolicies&sec2=enterprise/godmode/policies/policies&id=' . $policyInfo['id_policy'] . '">' .
|
||||
$data[5] = '<a href="?sec=gpolicies&sec2=enterprise/godmode/policies/policies&id=' . $policyInfo['id_policy'] . '">' .
|
||||
print_image($img,true, array('title' => $policyInfo['name_policy'])) .
|
||||
'</a>';
|
||||
}
|
||||
|
@ -359,60 +398,60 @@ foreach ($simple_alerts as $alert) {
|
|||
|
||||
$actions = get_alert_agent_module_actions ($alert['id']);
|
||||
|
||||
$data[5] = '';
|
||||
$data[6] = '';
|
||||
if (empty($actions)){
|
||||
// Get and show default actions for this alert
|
||||
$default_action = get_db_sql ("SELECT id_alert_action FROM talert_templates WHERE id = ".$alert["id_alert_template"]);
|
||||
if ($default_action != ""){
|
||||
$data[5] = __("Default"). " : ".get_db_sql ("SELECT name FROM talert_actions WHERE id = $default_action");
|
||||
$data[6] = __("Default"). " : ".get_db_sql ("SELECT name FROM talert_actions WHERE id = $default_action");
|
||||
}
|
||||
|
||||
} else {
|
||||
$data[5] = '<ul class="action_list">';
|
||||
$data[6] = '<ul class="action_list">';
|
||||
foreach ($actions as $action_id => $action) {
|
||||
$data[5] .= '<li>';
|
||||
$data[6] .= '<li>';
|
||||
if ($alert['disabled'])
|
||||
$data[5] .= '<font class="action_name" style="font-style: italic; color: #aaaaaa;">';
|
||||
$data[6] .= '<font class="action_name" style="font-style: italic; color: #aaaaaa;">';
|
||||
else
|
||||
$data[5] .= '<font class="action_name">';
|
||||
$data[5] .= $action['name'];
|
||||
$data[5] .= ' <em>(';
|
||||
$data[6] .= '<font class="action_name">';
|
||||
$data[6] .= $action['name'];
|
||||
$data[6] .= ' <em>(';
|
||||
if ($action['fires_min'] == $action['fires_max']) {
|
||||
if ($action['fires_min'] == 0)
|
||||
$data[5] .= __('Always');
|
||||
$data[6] .= __('Always');
|
||||
else
|
||||
$data[5] .= __('On').' '.$action['fires_min'];
|
||||
$data[6] .= __('On').' '.$action['fires_min'];
|
||||
}
|
||||
else {
|
||||
if ($action['fires_min'] == 0)
|
||||
$data[5] .= __('Until').' '.$action['fires_max'];
|
||||
$data[6] .= __('Until').' '.$action['fires_max'];
|
||||
else
|
||||
$data[5] .= __('From').' '.$action['fires_min'].
|
||||
$data[6] .= __('From').' '.$action['fires_min'].
|
||||
' '.__('to').' '.$action['fires_max'];
|
||||
}
|
||||
$data[5] .= ')</em>';
|
||||
$data[5] .= '</font>';
|
||||
// $data[5] .= ' <span class="delete" style="clear:right">';
|
||||
$data[5] .= '<form method="post" class="delete_link" style="display: inline; vertical-align: -50%;">';
|
||||
$data[5] .= print_input_image ('delete', 'images/cross.png', 1, '', true);
|
||||
$data[5] .= print_input_hidden ('delete_action', 1, true);
|
||||
$data[5] .= print_input_hidden ('id_alert', $alert['id'], true);
|
||||
$data[5] .= print_input_hidden ('id_action', $action_id, true);
|
||||
$data[5] .= '</form>';
|
||||
// $data[5] .= '</span>';
|
||||
$data[5] .= '</li>';
|
||||
$data[6] .= ')</em>';
|
||||
$data[6] .= '</font>';
|
||||
// $data[6] .= ' <span class="delete" style="clear:right">';
|
||||
$data[6] .= '<form method="post" class="delete_link" style="display: inline; vertical-align: -50%;">';
|
||||
$data[6] .= print_input_image ('delete', 'images/cross.png', 1, '', true);
|
||||
$data[6] .= print_input_hidden ('delete_action', 1, true);
|
||||
$data[6] .= print_input_hidden ('id_alert', $alert['id'], true);
|
||||
$data[6] .= print_input_hidden ('id_action', $action_id, true);
|
||||
$data[6] .= '</form>';
|
||||
// $data[6] .= '</span>';
|
||||
$data[6] .= '</li>';
|
||||
}
|
||||
$data[5] .= '</ul>';
|
||||
$data[6] .= '</ul>';
|
||||
}
|
||||
|
||||
|
||||
$data[5] .= '<a class="add_action" id="add-action-'.$alert['id'].'" href="#">';
|
||||
$data[5] .= print_image ('images/add.png', true);
|
||||
$data[6] .= '<a class="add_action" id="add-action-'.$alert['id'].'" href="#">';
|
||||
$data[6] .= print_image ('images/add.png', true);
|
||||
if ($alert['disabled'])
|
||||
$data[5] .= ' '. '<span style="font-style: italic; color: #aaaaaa;">' .__('Add action') . '</span>';
|
||||
$data[6] .= ' '. '<span style="font-style: italic; color: #aaaaaa;">' .__('Add action') . '</span>';
|
||||
else
|
||||
$data[5] .= ' ' . __('Add action');
|
||||
$data[5] .= '</a>';
|
||||
$data[6] .= ' ' . __('Add action');
|
||||
$data[6] .= '</a>';
|
||||
|
||||
$status = STATUS_ALERT_NOT_FIRED;
|
||||
$title = "";
|
||||
|
@ -428,14 +467,14 @@ foreach ($simple_alerts as $alert) {
|
|||
$title = __('Alert not fired');
|
||||
}
|
||||
|
||||
$data[6] = print_status_image($status, $title, true);
|
||||
$data[7] = print_status_image($status, $title, true);
|
||||
|
||||
$data[7] = '<form class="delete_alert_form" method="post" style="display: inline;">';
|
||||
$data[8] = '<form class="delete_alert_form" method="post" style="display: inline;">';
|
||||
|
||||
$data[7] .= print_input_image ('delete', 'images/cross.png', 1, '', true);
|
||||
$data[7] .= print_input_hidden ('delete_alert', 1, true);
|
||||
$data[7] .= print_input_hidden ('id_alert', $alert['id'], true);
|
||||
$data[7] .= '</form>';
|
||||
$data[8] .= print_input_image ('delete', 'images/cross.png', 1, '', true);
|
||||
$data[8] .= print_input_hidden ('delete_alert', 1, true);
|
||||
$data[8] .= print_input_hidden ('id_alert', $alert['id'], true);
|
||||
$data[8] .= '</form>';
|
||||
array_push ($table->data, $data);
|
||||
}
|
||||
|
||||
|
@ -547,6 +586,24 @@ $(document).ready (function () {
|
|||
$(this).attr ("src", "images/lightbulb_off.png");
|
||||
}
|
||||
);
|
||||
|
||||
$("input[name=standby_on]").attr ("title", "<?php echo __('Set off standby')?>")
|
||||
.hover (function () {
|
||||
$(this).attr ("src", "images/bell.png");
|
||||
},
|
||||
function () {
|
||||
$(this).attr ("src", "images/bell_pause.png");
|
||||
}
|
||||
);
|
||||
|
||||
$("input[name=standby_off]").attr ("title", "<?php echo __('Set standby')?>")
|
||||
.hover (function () {
|
||||
$(this).attr ("src", "images/bell_pause.png");
|
||||
},
|
||||
function () {
|
||||
$(this).attr ("src", "images/bell.png");
|
||||
}
|
||||
);
|
||||
$("form.disable_alert_form").submit (function () {
|
||||
return true;
|
||||
});
|
||||
|
|
|
@ -44,6 +44,8 @@ $delete_action = (bool) get_parameter ('delete_action');
|
|||
$delete_alert = (bool) get_parameter ('delete_alert');
|
||||
$disable_alert = (bool) get_parameter ('disable_alert');
|
||||
$enable_alert = (bool) get_parameter ('enable_alert');
|
||||
$standbyon_alert = (bool) get_parameter ('standbyon_alert');
|
||||
$standbyoff_alert = (bool) get_parameter ('standbyoff_alert');
|
||||
$tab = get_parameter('tab', 'list');
|
||||
$group = get_parameter('group', 0); //0 is All group
|
||||
$templateName = get_parameter('template_name','');
|
||||
|
@ -56,6 +58,7 @@ $searchType = get_parameter('search_type','');
|
|||
$priority = get_parameter('priority','');
|
||||
$searchFlag = get_parameter('search',0);
|
||||
$enabledisable = get_parameter('enabledisable','');
|
||||
$standby = get_parameter('standby','');
|
||||
|
||||
$messageAction = '';
|
||||
|
||||
|
@ -151,6 +154,20 @@ if ($disable_alert) {
|
|||
$messageAction = print_result_message ($result, __('Successfully disabled'), __('Could not be disabled'), '', true);
|
||||
}
|
||||
|
||||
if ($standbyon_alert) {
|
||||
$id_alert = (int) get_parameter ('id_alert');
|
||||
|
||||
$result = set_alerts_agent_module_standby ($id_alert, true);
|
||||
$messageAction = print_result_message ($result, __('Successfully set standby'), __('Could not be set standby'), '', true);
|
||||
}
|
||||
|
||||
if ($standbyoff_alert) {
|
||||
$id_alert = (int) get_parameter ('id_alert');
|
||||
|
||||
$result = set_alerts_agent_module_standby ($id_alert, false);
|
||||
$messageAction = print_result_message ($result, __('Successfully set off standby'), __('Could not be set off standby'), '', true);
|
||||
}
|
||||
|
||||
if ($id_agente) {
|
||||
$agents = array ($id_agente => get_agent_name ($id_agente));
|
||||
|
||||
|
@ -180,10 +197,10 @@ else {
|
|||
|
||||
$buttons[$tab]['active'] = true;
|
||||
|
||||
if (isset($_GET["tab"])) {
|
||||
print_page_header(__('Alerts') . ' » ' . __('Manage alerts') . ' » ' . __('Create'), "images/god2.png", false, "manage_alert_list", true, $buttons);
|
||||
} else {
|
||||
if ($tab == 'list') {
|
||||
print_page_header(__('Alerts') . ' » ' . __('Manage alerts') . ' » ' . __('List'), "images/god2.png", false, "manage_alert_list", true, $buttons);
|
||||
} else {
|
||||
print_page_header(__('Alerts') . ' » ' . __('Manage alerts') . ' » ' . __('Create'), "images/god2.png", false, "manage_alert_list", true, $buttons);
|
||||
}
|
||||
|
||||
echo $messageAction;
|
||||
|
|
|
@ -34,7 +34,7 @@ $option = (string) get_parameter ('option', '');
|
|||
|
||||
$options_alerts = array('add_alerts' => __('Massive alerts addition'), 'delete_alerts' => __('Massive alerts deletion'),
|
||||
'add_action_alerts' => __('Massive alert actions addition'), 'delete_action_alerts' => __('Massive alert actions deletion'),
|
||||
'enable_disable_alerts' => __('Massive alert enable/disable'));
|
||||
'enable_disable_alerts' => __('Massive alert enable/disable'), 'standby_alerts' => __('Massive alert setting standby'));
|
||||
|
||||
$options_agents = array('delete_agents' => __('Massive agents deletion'));
|
||||
|
||||
|
@ -149,6 +149,9 @@ switch ($option) {
|
|||
case 'enable_disable_alerts':
|
||||
require_once ('godmode/massive/massive_enable_disable_alerts.php');
|
||||
break;
|
||||
case 'standby_alerts':
|
||||
require_once ('godmode/massive/massive_standby_alerts.php');
|
||||
break;
|
||||
case 'add_profiles':
|
||||
require_once ('godmode/massive/massive_add_profiles.php');
|
||||
break;
|
||||
|
|
|
@ -0,0 +1,206 @@
|
|||
<?php
|
||||
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
|
||||
// Please see http://pandorafms.org for full contribution list
|
||||
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation for version 2.
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
|
||||
// Load global vars
|
||||
check_login ();
|
||||
|
||||
if (! check_acl ($config['id_user'], 0, "AW")) {
|
||||
audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation",
|
||||
"Trying to access massive alert deletion");
|
||||
require ("general/noaccess.php");
|
||||
return;
|
||||
}
|
||||
|
||||
require_once ('include/functions_agents.php');
|
||||
require_once ('include/functions_alerts.php');
|
||||
|
||||
if (is_ajax ()) {
|
||||
$get_alerts = (bool) get_parameter ('get_alerts');
|
||||
|
||||
if ($get_alerts) {
|
||||
$id_group = (int) get_parameter ('id_group');
|
||||
$id_alert_template = (int) get_parameter ('id_alert_template');
|
||||
$standby = (int) get_parameter ('standby');
|
||||
|
||||
$agents_alerts = get_agents_with_alert_template ($id_alert_template, $id_group,
|
||||
array('order' => 'tagente.nombre, talert_template_modules.standby', '`talert_template_modules`.standby' => $standby),
|
||||
array ('LEFT(CONCAT(LEFT(tagente.nombre,40), " - ", tagente_modulo.nombre), 85) as agent_agentmodule_name',
|
||||
'talert_template_modules.id as template_module_id'));
|
||||
|
||||
echo json_encode (index_array ($agents_alerts, 'template_module_id', 'agent_agentmodule_name'));
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
$id_group = (int) get_parameter ('id_group');
|
||||
$action = (string) get_parameter ('action', '');
|
||||
|
||||
$result = false;
|
||||
|
||||
switch($action) {
|
||||
case 'set_off_standby_alerts':
|
||||
$id_alert_template = (int) get_parameter ('id_alert_template_standby', 0);
|
||||
$id_standby_alerts = get_parameter_post ('id_standby_alerts', array());
|
||||
foreach($id_standby_alerts as $id_alert) {
|
||||
$result = set_alerts_agent_module_standby ($id_alert, false);
|
||||
}
|
||||
print_result_message ($result, __('Successfully set off standby'), __('Could not be set off standby'));
|
||||
break;
|
||||
case 'set_standby_alerts':
|
||||
$id_alert_template = (int) get_parameter ('id_alert_template_standby', 0);
|
||||
$id_not_standby_alerts = get_parameter_post ('id_not_standby_alerts', array());
|
||||
|
||||
foreach($id_not_standby_alerts as $id_alert) {
|
||||
$result = set_alerts_agent_module_standby ($id_alert, true);
|
||||
}
|
||||
print_result_message ($result, __('Successfully set standby'), __('Could not be set standby'));
|
||||
break;
|
||||
default:
|
||||
$id_alert_template = (int) get_parameter ('id_alert_template', 0);
|
||||
break;
|
||||
}
|
||||
|
||||
$groups = get_user_groups ();
|
||||
|
||||
$table->id = 'delete_table';
|
||||
$table->width = '95%';
|
||||
$table->data = array ();
|
||||
$table->style = array ();
|
||||
$table->style[0] = 'font-weight: bold; vertical-align:top';
|
||||
$table->style[2] = 'font-weight: bold';
|
||||
$table->size = array ();
|
||||
$table->size[0] = '15%';
|
||||
$table->size[1] = '85%';
|
||||
|
||||
$table->data = array ();
|
||||
|
||||
$templates = get_alert_templates (false, array ('id', 'name'));
|
||||
$table->data[0][0] = '<form method="post" action="index.php?sec=gmassive&sec2=godmode/massive/massive_operations&tab=massive_alerts&option=standby_alerts&action=set_standby_alerts" onsubmit="if (! confirm(\''.__('Are you sure?').'\')) return false;">';
|
||||
$table->data[0][0] .= print_input_hidden('id_alert_template_not_standby', $id_alert_template, true);
|
||||
$table->data[0][0] .= __('Alert template');
|
||||
$table->data[0][1] = print_select (index_array ($templates, 'id', 'name'),
|
||||
'id_alert_template', $id_alert_template, false, __('All'), 0, true);
|
||||
|
||||
$table->data[1][0] = __('Group');
|
||||
$table->data[1][1] = print_select_groups(false, "AR", true, 'id_group', $id_group,
|
||||
'', '', '', true, false, true, '');
|
||||
|
||||
$table->data[2][0] = __('Not standby alerts').print_help_tip(__('Format').":<br> ".__('Agent')." - ".__('Module'), true);
|
||||
$table->data[2][0] .= '<span id="alerts_loading" class="invisible">';
|
||||
$table->data[2][0] .= '<img src="images/spinner.png" />';
|
||||
$table->data[2][0] .= '</span>';
|
||||
$agents_alerts = get_agents_with_alert_template ($id_alert_template, $id_group,
|
||||
false, array ('tagente.nombre', 'tagente.id_agente'));
|
||||
$table->data[2][1] = print_select (index_array ($agents_alerts, 'id_agente', 'nombre'),
|
||||
'id_not_standby_alerts[]', '', '', '', '', true, true, true, '', $id_alert_template == 0);
|
||||
|
||||
$table->data[3][0] = __('Action');
|
||||
|
||||
$table->data[3][1] = "<table border='0' width='100%'><tr><td>".print_input_image ('standby_alerts', 'images/darrowdown.png', 1, 'margin-left: 150px;', true, array ('title' => __('Set standby selected alerts')))."</td><td>";
|
||||
$table->data[3][1] .= '</form>';
|
||||
$table->data[3][1] .= '<form method="post" action="index.php?sec=gmassive&sec2=godmode/massive/massive_operations&tab=massive_alerts&option=standby_alerts&action=set_off_standby_alerts" onsubmit="if (! confirm(\''.__('Are you sure?').'\')) return false;">';
|
||||
$table->data[3][1] .= print_input_hidden('id_alert_template_standby', $id_alert_template, true);
|
||||
$table->data[3][1] .= print_input_image ('set_off_standby_alerts', 'images/darrowup.png', 1, 'margin-left: 200px;', true, array ('title' => __('Set standby selected alerts')))."</td></tr></table>";
|
||||
|
||||
$table->data[4][0] = __('Standby alerts').print_help_tip(__('Format').":<br> ".__('Agent')." - ".__('Module'), true);
|
||||
$table->data[4][0] .= '<span id="alerts_loading2" class="invisible">';
|
||||
$table->data[4][0] .= '<img src="images/spinner.png" />';
|
||||
$table->data[4][0] .= '</span>';
|
||||
$table->data[4][1] = print_select (index_array ($agents_alerts, 'id_agente2', 'nombre'),
|
||||
'id_standby_alerts[]', '', '', '', '', true, true, true, '', $id_alert_template == 0);
|
||||
$table->data[4][1] .= '</form>';
|
||||
|
||||
print_table ($table);
|
||||
|
||||
echo '<h3 class="error invisible" id="message"> </h3>';
|
||||
|
||||
require_jquery_file ('form');
|
||||
require_jquery_file ('pandora.controls');
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
/* <![CDATA[ */
|
||||
$(document).ready (function () {
|
||||
update_alerts();
|
||||
|
||||
$("#id_alert_template").change (function () {
|
||||
if (this.value != 0) {
|
||||
$("#id_not_standby_alerts").enable ();
|
||||
$("#id_standby_alerts").enable ();
|
||||
$("#id_group").enable ().change ();
|
||||
} else {
|
||||
$("#id_group, #id_not_standby_alerts").disable ();
|
||||
$("#id_group, #id_standby_alerts").disable ();
|
||||
}
|
||||
$("#hidden-id_alert_template_not_standby").attr("value",$("#id_alert_template").attr("value"));
|
||||
$("#hidden-id_alert_template_standby").val($("#id_alert_template").attr("value"));
|
||||
});
|
||||
|
||||
|
||||
function update_alerts() {
|
||||
var $select = $("#id_not_standby_alerts").disable ();
|
||||
var $select2 = $("#id_standby_alerts").disable ();
|
||||
$("#alerts_loading").show ();
|
||||
$("#alerts_loading2").show ();
|
||||
$("option", $select).remove ();
|
||||
$("option", $select2).remove ();
|
||||
|
||||
jQuery.post ("ajax.php",
|
||||
{"page" : "godmode/massive/massive_standby_alerts",
|
||||
"get_alerts" : 1,
|
||||
"id_group" : this.value,
|
||||
"id_alert_template" : $("#id_alert_template").attr("value"),
|
||||
"standby" : 0
|
||||
},
|
||||
function (data, status) {
|
||||
options = "";
|
||||
jQuery.each (data, function (id, value) {
|
||||
options += "<option value=\""+id+"\">"+value+"</option>";
|
||||
});
|
||||
$("#id_not_standby_alerts").append (options);
|
||||
$("#alerts_loading").hide ();
|
||||
$select.enable ();
|
||||
},
|
||||
"json"
|
||||
);
|
||||
|
||||
jQuery.post ("ajax.php",
|
||||
{"page" : "godmode/massive/massive_standby_alerts",
|
||||
"get_alerts" : 1,
|
||||
"id_group" : this.value,
|
||||
"id_alert_template" : $("#id_alert_template").attr("value"),
|
||||
"standby" : 1
|
||||
},
|
||||
function (data, status) {
|
||||
options = "";
|
||||
jQuery.each (data, function (id, value) {
|
||||
options += "<option value=\""+id+"\">"+value+"</option>";
|
||||
});
|
||||
$("#id_standby_alerts").append (options);
|
||||
$("#alerts_loading2").hide ();
|
||||
$select2.enable ();
|
||||
},
|
||||
"json"
|
||||
);
|
||||
}
|
||||
|
||||
$("#id_group").change (function () {
|
||||
update_alerts();
|
||||
});
|
||||
});
|
||||
/* ]]> */
|
||||
</script>
|
Binary file not shown.
After Width: | Height: | Size: 863 B |
|
@ -42,7 +42,8 @@ else {
|
|||
|
||||
|
||||
set_time_limit (0);
|
||||
error_reporting (0);
|
||||
//error_reporting (0);
|
||||
error_reporting (E_ALL);
|
||||
|
||||
if (! isset ($config["id_user"])) {
|
||||
session_start ();
|
||||
|
@ -973,7 +974,7 @@ function grafico_eventos_grupo ($width = 300, $height = 200, $url = "") {
|
|||
$url = html_entity_decode (rawurldecode ($url), ENT_QUOTES); //It was urlencoded, so we urldecode it
|
||||
$data = array ();
|
||||
$loop = 0;
|
||||
define (NUM_PIECES_PIE, 6);
|
||||
define ('NUM_PIECES_PIE', 6);
|
||||
|
||||
$badstrings = array (";", "SELECT ", "DELETE ", "UPDATE ", "INSERT ", "EXEC");
|
||||
//remove bad strings from the query so queries like ; DELETE FROM don't pass
|
||||
|
|
|
@ -110,22 +110,29 @@ function create_agent ($name, $id_group, $interval, $ip_address, $values = false
|
|||
* alerts found.
|
||||
*/
|
||||
function get_agent_alerts_simple ($id_agent = false, $filter = '', $options = false, $where = '', $allModules = false, $orderby = false, $idGroup = false, $count = false) {
|
||||
if (is_array($filter)) {
|
||||
$disabled = $filter['disabled'];
|
||||
$filter = ' AND talert_template_modules.standby = "'.$filter['standby'].'"';
|
||||
}else {
|
||||
$filter = '';
|
||||
$disabled = $filter;
|
||||
}
|
||||
|
||||
switch ($filter) {
|
||||
switch ($disabled) {
|
||||
case "notfired":
|
||||
$filter = ' AND times_fired = 0 AND talert_template_modules.disabled = 0';
|
||||
$filter .= ' AND times_fired = 0 AND talert_template_modules.disabled = 0';
|
||||
break;
|
||||
case "fired":
|
||||
$filter = ' AND times_fired > 0 AND talert_template_modules.disabled = 0';
|
||||
$filter .= ' AND times_fired > 0 AND talert_template_modules.disabled = 0';
|
||||
break;
|
||||
case "disabled":
|
||||
$filter = ' AND talert_template_modules.disabled = 1';
|
||||
$filter .= ' AND talert_template_modules.disabled = 1';
|
||||
break;
|
||||
case 'all_enabled':
|
||||
$filter = ' AND talert_template_modules.disabled = 0';
|
||||
case "all_enabled":
|
||||
$filter .= ' AND talert_template_modules.disabled = 0';
|
||||
break;
|
||||
default:
|
||||
$filter = '';
|
||||
$filter .= '';
|
||||
}
|
||||
|
||||
if (is_array ($options)) {
|
||||
|
@ -180,7 +187,7 @@ function get_agent_alerts_simple ($id_agent = false, $filter = '', $options = fa
|
|||
ON talert_template_modules.id_alert_template = t4.id
|
||||
WHERE id_agent_module in (%s) %s %s %s",
|
||||
$selectText, $subQuery, $where, $filter, $orderbyText);
|
||||
|
||||
|
||||
$alerts = get_db_all_rows_sql ($sql);
|
||||
|
||||
if ($alerts === false)
|
||||
|
@ -206,20 +213,20 @@ function get_agent_alerts_simple ($id_agent = false, $filter = '', $options = fa
|
|||
*/
|
||||
function get_agent_alerts_compound ($id_agent = false, $filter = '', $options = false, $idGroup = false, $count = false, $where = '') {
|
||||
switch ($filter) {
|
||||
case "notfired":
|
||||
$filter = ' AND times_fired = 0 AND disabled = 0';
|
||||
break;
|
||||
case "fired":
|
||||
$filter = ' AND times_fired > 0 AND disabled = 0';
|
||||
break;
|
||||
case "disabled":
|
||||
$filter = ' AND disabled = 1';
|
||||
break;
|
||||
case 'all_enabled':
|
||||
$filter = ' AND disabled = 0';
|
||||
break;
|
||||
default:
|
||||
$filter = '';
|
||||
case "notfired":
|
||||
$filter = ' AND times_fired = 0 AND disabled = 0';
|
||||
break;
|
||||
case "fired":
|
||||
$filter = ' AND times_fired > 0 AND disabled = 0';
|
||||
break;
|
||||
case "disabled":
|
||||
$filter = ' AND disabled = 1';
|
||||
break;
|
||||
case 'all_enabled':
|
||||
$filter = ' AND disabled = 0';
|
||||
break;
|
||||
default:
|
||||
$filter = '';
|
||||
}
|
||||
|
||||
if (is_array ($options)) {
|
||||
|
|
|
@ -526,6 +526,13 @@ function set_alerts_agent_module_disable ($id_alert_agent_module, $disabled) {
|
|||
array ('id' => $id_alert_agent_module))) !== false;
|
||||
}
|
||||
|
||||
function set_alerts_agent_module_standby ($id_alert_agent_module, $standby) {
|
||||
$id_alert_agent_module = safe_int ($id_alert_agent_module, 0);
|
||||
return (@process_sql_update ('talert_template_modules',
|
||||
array ('standby' => (bool) $standby),
|
||||
array ('id' => $id_alert_agent_module))) !== false;
|
||||
}
|
||||
|
||||
function get_alerts_agent_module_last_fired ($id_alert_agent_module) {
|
||||
$id_alert_agent_module = safe_int ($id_alert_agent_module, 1);
|
||||
return get_db_value ('last_fired', 'talert_template_modules', 'id',
|
||||
|
|
|
@ -150,7 +150,7 @@ function delete_event ($id_event, $similar = true) {
|
|||
*
|
||||
* @return bool Whether or not it was successful
|
||||
*/
|
||||
function validate_event ($id_event, $similars = true) {
|
||||
function validate_event ($id_event, $similars = true, $comment = '', $new_status = 1) {
|
||||
global $config;
|
||||
|
||||
//Cleans up the selection for all unwanted values also casts any single values as an array
|
||||
|
@ -166,8 +166,34 @@ function validate_event ($id_event, $similars = true) {
|
|||
process_sql_begin ();
|
||||
$errors = 0;
|
||||
|
||||
switch($new_status) {
|
||||
case 1:
|
||||
$new_status_string = __('Validated');
|
||||
break;
|
||||
case 2:
|
||||
$new_status_string = __('Setted in process');
|
||||
break;
|
||||
}
|
||||
|
||||
$comment = str_replace(array("\r\n", "\r", "\n"), '<br>', $comment);
|
||||
|
||||
if($comment != '') {
|
||||
$commentbox = '<div style="border:1px dotted #CCC; min-height: 10px;">'.$comment.'</div>';
|
||||
}else {
|
||||
$commentbox = '';
|
||||
}
|
||||
|
||||
$comment = '<b>-- '.$new_status_string.' '.__('by').' '.$config['id_user'].' '.'['.date ($config["date_format"]).'] --</b><br>'.$commentbox;
|
||||
|
||||
foreach ($id_event as $event) {
|
||||
$sql = sprintf ("UPDATE tevento SET estado = 1, id_usuario = '%s' WHERE id_evento = %d", $config['id_user'], $event);
|
||||
$fullevent = get_event($event);
|
||||
|
||||
if($fullevent['user_comment'] != ''){
|
||||
$commentbox = '<div style="border:1px dotted #CCC; min-height: 10px;">'.$fullevent['user_comment'].'</div>';
|
||||
$comment .= '<br>'.$fullevent['user_comment'];
|
||||
}
|
||||
|
||||
$sql = sprintf ("UPDATE tevento SET estado = %d, id_usuario = '%s', user_comment = '%s' WHERE id_evento = %d", $new_status, $config['id_user'], $comment, $event);
|
||||
$ret = process_sql ($sql);
|
||||
|
||||
if (give_acl ($config["id_user"], get_event_group ($event), "IW") == 0) {
|
||||
|
@ -403,50 +429,105 @@ function print_event_type_img ($type, $return = false) {
|
|||
switch ($type) {
|
||||
case "alert_recovered":
|
||||
$output .= print_image ("images/error.png", true,
|
||||
array ("title" => __('Alert recovered')));
|
||||
array ("title" => print_event_type_description($type, true)));
|
||||
break;
|
||||
case "alert_manual_validation":
|
||||
$output .= print_image ("images/eye.png", true,
|
||||
array ("title" => __('Alert manually validated')));
|
||||
array ("title" => print_event_type_description($type, true)));
|
||||
break;
|
||||
case "going_up_warning":
|
||||
$output .= print_image ("images/b_yellow.png", true,
|
||||
array ("title" => __('Going from critical to warning')));
|
||||
array ("title" => print_event_type_description($type, true)));
|
||||
break;
|
||||
case "going_down_critical":
|
||||
case "going_up_critical": //This is to be backwards compatible
|
||||
$output .= print_image ("images/b_red.png", true,
|
||||
array ("title" => __('Going down to critical state')));
|
||||
array ("title" => print_event_type_description($type, true)));
|
||||
break;
|
||||
case "going_up_normal":
|
||||
case "going_down_normal": //This is to be backwards compatible
|
||||
$output .= print_image ("images/b_green.png", true,
|
||||
array ("title" => __('Going up to normal state')));
|
||||
array ("title" => print_event_type_description($type, true)));
|
||||
break;
|
||||
case "going_down_warning":
|
||||
$output .= print_image ("images/b_yellow.png", true,
|
||||
array ("title" => __('Going down from normal to warning')));
|
||||
array ("title" => print_event_type_description($type, true)));
|
||||
break;
|
||||
case "alert_fired":
|
||||
$output .= print_image ("images/bell.png", true,
|
||||
array ("title" => __('Alert fired')));
|
||||
array ("title" => print_event_type_description($type, true)));
|
||||
break;
|
||||
case "system";
|
||||
$output .= print_image ("images/cog.png", true,
|
||||
array ("title" => __('SYSTEM')));
|
||||
array ("title" => print_event_type_description($type, true)));
|
||||
break;
|
||||
case "recon_host_detected";
|
||||
$output .= print_image ("images/network.png", true,
|
||||
array ("title" => __('Recon server detected a new host')));
|
||||
array ("title" => print_event_type_description($type, true)));
|
||||
break;
|
||||
case "new_agent";
|
||||
$output .= print_image ("images/wand.png", true,
|
||||
array ("title" => __('New agent created')));
|
||||
array ("title" => print_event_type_description($type, true)));
|
||||
break;
|
||||
case "unknown":
|
||||
default:
|
||||
$output .= print_image ("images/err.png", true,
|
||||
array ("title" => __('Unknown type:').': '.$type));
|
||||
array ("title" => print_event_type_description($type, true)));
|
||||
break;
|
||||
}
|
||||
|
||||
if ($return)
|
||||
return $output;
|
||||
echo $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints the event type description
|
||||
*
|
||||
* @param string $type Event type from SQL
|
||||
* @param bool $return Whether to return or print
|
||||
*
|
||||
* @return string HTML with img
|
||||
*/
|
||||
function print_event_type_description ($type, $return = false) {
|
||||
$output = '';
|
||||
|
||||
switch ($type) {
|
||||
case "alert_recovered":
|
||||
$output .= __('Alert recovered');
|
||||
break;
|
||||
case "alert_manual_validation":
|
||||
$output .= __('Alert manually validated');
|
||||
break;
|
||||
case "going_up_warning":
|
||||
$output .= __('Going from critical to warning');
|
||||
break;
|
||||
case "going_down_critical":
|
||||
case "going_up_critical": //This is to be backwards compatible
|
||||
$output .= __('Going down to critical state');
|
||||
break;
|
||||
case "going_up_normal":
|
||||
case "going_down_normal": //This is to be backwards compatible
|
||||
$output .= __('Going up to normal state');
|
||||
break;
|
||||
case "going_down_warning":
|
||||
$output .= __('Going down from normal to warning');
|
||||
break;
|
||||
case "alert_fired":
|
||||
$output .= __('Alert fired');
|
||||
break;
|
||||
case "system";
|
||||
$output .= __('SYSTEM');
|
||||
break;
|
||||
case "recon_host_detected";
|
||||
$output .= __('Recon server detected a new host');
|
||||
break;
|
||||
case "new_agent";
|
||||
$output .= __('New agent created');
|
||||
break;
|
||||
case "unknown":
|
||||
default:
|
||||
$output .= __('Unknown type:').': '.$type;
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -375,26 +375,26 @@ function format_alert_row ($alert, $compound = false, $agent = true, $url = '')
|
|||
|
||||
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
|
||||
if ($agent) {
|
||||
$index = array('policy' => 0, 'force_execution' => 1, 'agent_name' => 2, 'module_name' => 3,
|
||||
'description' => 4, 'template' => 4, 'action' => 5, 'last_fired' => 6, 'status' => 7,
|
||||
'validate' => 8);
|
||||
$index = array('policy' => 0, 'standby' => 1, 'force_execution' => 2, 'agent_name' => 3, 'module_name' => 4,
|
||||
'description' => 5, 'template' => 5, 'action' => 6, 'last_fired' => 7, 'status' => 8,
|
||||
'validate' => 9);
|
||||
}
|
||||
else {
|
||||
$index = array('policy' => 0, 'force_execution' => 1, 'agent_name' => 2, 'module_name' => 2,
|
||||
'description' => 3, 'template' => 3, 'action' => 4, 'last_fired' => 5, 'status' => 6,
|
||||
'validate' => 7);
|
||||
$index = array('policy' => 0, 'standby' => 1, 'force_execution' => 2, 'agent_name' => 3, 'module_name' => 3,
|
||||
'description' => 4, 'template' => 4, 'action' => 5, 'last_fired' => 6, 'status' => 7,
|
||||
'validate' => 8);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ($agent) {
|
||||
$index = array('force_execution' => 0, 'agent_name' => 1, 'module_name' => 2,
|
||||
'description' => 3, 'template' => 3, 'action' => 4, 'last_fired' => 5, 'status' => 6,
|
||||
'validate' => 6);
|
||||
$index = array('standby' => 0, 'force_execution' => 1, 'agent_name' => 2, 'module_name' => 3,
|
||||
'description' => 4, 'template' => 4, 'action' => 5, 'last_fired' => 6, 'status' => 7,
|
||||
'validate' => 7);
|
||||
}
|
||||
else {
|
||||
$index = array('force_execution' => 0, 'agent_name' => 1, 'module_name' => 1,
|
||||
'description' => 2, 'template' => 2, 'action' => 3, 'last_fired' => 4, 'status' => 5,
|
||||
'validate' => 6);
|
||||
$index = array('standby' => 0, 'force_execution' => 1, 'agent_name' => 2, 'module_name' => 2,
|
||||
'description' => 3, 'template' => 3, 'action' => 4, 'last_fired' => 5, 'status' => 6,
|
||||
'validate' => 7);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -444,6 +444,12 @@ function format_alert_row ($alert, $compound = false, $agent = true, $url = '')
|
|||
else if (($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) && ($compound))
|
||||
$data[$index['policy']] = '';
|
||||
|
||||
// Standby
|
||||
$data[$index['standby']] = '';
|
||||
if ($alert["standby"] == 1) {
|
||||
$data[$index['standby']] = print_image ('images/bell_pause.png', true, array('title' => __('Standby on')));
|
||||
}
|
||||
|
||||
// Force alert execution
|
||||
$data[$index['force_execution']] = '';
|
||||
if (! $compound) {
|
||||
|
|
|
@ -37,7 +37,7 @@ function validateAlert() {
|
|||
}
|
||||
}
|
||||
|
||||
function printFormFilterAlert($id_group, $filter, $free_search, $url) {
|
||||
function printFormFilterAlert($id_group, $filter, $free_search, $url, $filter_standby = false, $return = false) {
|
||||
$table->width = '90%';
|
||||
$table->data = array ();
|
||||
$table->style = array ();
|
||||
|
@ -52,17 +52,30 @@ function printFormFilterAlert($id_group, $filter, $free_search, $url) {
|
|||
$alert_status_filter['fired'] = __('Fired');
|
||||
$alert_status_filter['notfired'] = __('Not fired');
|
||||
$alert_status_filter['disabled'] = __('Disabled');
|
||||
|
||||
$alert_standby = array();
|
||||
$alert_standby['all'] = __('All');
|
||||
$alert_standby['standby_on'] = __('Standby on');
|
||||
$alert_standby['standby_off'] = __('Standby off');
|
||||
|
||||
$table->data[0][2] = __('Status');
|
||||
$table->data[0][3] = print_select ($alert_status_filter, "filter", $filter, 'javascript:this.form.submit();', '', '', true);
|
||||
$table->data[0][4] = '';
|
||||
$table->data[1][0] = __('Free text for search')
|
||||
. '<a href="#" class="tip"> <span>' . __("Filter by agent name, module name, template name or action name") . '</span></a>';
|
||||
$table->data[1][1] = print_input_text('free_search', $free_search, '', 20, 40, true);
|
||||
$table->colspan[1][2] = 2;
|
||||
$table->data[1][2] = print_submit_button(__('Filter'), 'filter_button', false, 'class="sub search"', true);
|
||||
$table->data[1][2] = __('Standby');
|
||||
$table->data[1][3] = print_select ($alert_standby, "filter_standby", $filter_standby, 'javascript:this.form.submit();', '', '', true);
|
||||
$table->data[1][4] = print_submit_button(__('Filter'), 'filter_button', false, 'class="sub search"', true);
|
||||
|
||||
echo '<form method="post" action="'.$url.'">';
|
||||
print_table ($table);
|
||||
echo '</form>';
|
||||
$data = '<form method="post" action="'.$url.'">';
|
||||
$data .= print_table ($table, true);
|
||||
$data .= '</form>';
|
||||
|
||||
if($return) {
|
||||
return $data;
|
||||
}else{
|
||||
echo $data;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -24,6 +24,7 @@ require_once('operation/agentes/alerts_status.functions.php');
|
|||
$isFunctionPolicies = enterprise_include_once ('include/functions_policies.php');
|
||||
|
||||
$filter = get_parameter ("filter", "all_enabled");
|
||||
$filter_standby = get_parameter ("filter_standby", "all");
|
||||
$offset_simple = (int) get_parameter_get ("offset_simple", 0);
|
||||
$offset_combined = (int) get_parameter_get("offset_combined", 0);
|
||||
$id_group = (int) get_parameter ("ag_group", 0); //0 is the All group (selects all groups)
|
||||
|
@ -39,7 +40,7 @@ $flag_alert = (bool) get_parameter ('force_execution', 0);
|
|||
$alert_validate = (bool) get_parameter ('alert_validate', 0);
|
||||
$tab = get_parameter_get ("tab", null);
|
||||
|
||||
$url = 'index.php?sec='.$sec.'&sec2='.$sec2.'&refr='.$config["refr"].'&filter='.$filter.'&ag_group='.$id_group;
|
||||
$url = 'index.php?sec='.$sec.'&sec2='.$sec2.'&refr='.$config["refr"].'&filter='.$filter.'&filter_standby='.$filter_standby.'&ag_group='.$id_group;
|
||||
|
||||
if ($flag_alert == 1 && give_acl($config['id_user'], $id_group, "AW")) {
|
||||
forceExecution($id_group);
|
||||
|
@ -178,16 +179,32 @@ switch ($sortField) {
|
|||
}
|
||||
|
||||
$alerts = array();
|
||||
$alerts['alerts_simple'] = get_agent_alerts_simple ($agents, $filter, array('offset' => $offset_simple, 'limit' => $config['block_size'], 'order' => $order), $whereAlertSimple, false, false, $idGroup);
|
||||
$options_simple = array('offset' => $offset_simple, 'limit' => $config['block_size'], 'order' => $order);
|
||||
$options_combined = array('limit' => $config["block_size"], 'offset' => $offset_combined);
|
||||
|
||||
$filter_alert = array();
|
||||
if($filter_standby == 'standby_on') {
|
||||
$filter_alert['disabled'] = $filter;
|
||||
$filter_alert['standby'] = '1';
|
||||
}else if($filter_standby == 'standby_off') {
|
||||
$filter_alert['disabled'] = $filter;
|
||||
$filter_alert['standby'] = '0';
|
||||
}else {
|
||||
$filter_alert = $filter;
|
||||
}
|
||||
|
||||
$alerts['alerts_simple'] = get_agent_alerts_simple ($agents, $filter_alert, $options_simple, $whereAlertSimple, false, false, $idGroup);
|
||||
$countAlertsSimple = get_agent_alerts_simple ($agents, $filter, false, $whereAlertSimple, false, false, $idGroup, true);
|
||||
$alerts['alerts_combined'] = get_agent_alerts_compound($agents, $filter, array('limit' => $config["block_size"], 'offset' => $offset_combined), $idGroup, false, $whereAlertCombined);
|
||||
|
||||
$alerts['alerts_combined'] = get_agent_alerts_compound($agents, $filter, $options_combined, $idGroup, false, $whereAlertCombined);
|
||||
$countAlertsCombined = get_agent_alerts_compound($agents, $filter, false, $idGroup, true, $whereAlertCombined);
|
||||
if ($tab != null) {
|
||||
$url = $url.'&tab='.$tab;
|
||||
}
|
||||
|
||||
// Filter form
|
||||
if ($print_agent) {
|
||||
printFormFilterAlert($id_group, $filter, $free_search, $url);
|
||||
toggle(printFormFilterAlert($id_group, $filter, $free_search, $url, $filter_standby, true),__('Alert control filter'), __('Toggle filter(s)'));
|
||||
}
|
||||
|
||||
$table->width = '95%';
|
||||
|
@ -201,14 +218,75 @@ if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
|
|||
if ($print_agent) {
|
||||
$table->size[0] = '20px';
|
||||
$table->size[1] = '20px';
|
||||
$table->size[2] = '25%';
|
||||
$table->size[2] = '20px';
|
||||
$table->size[3] = '25%';
|
||||
$table->size[4] = '30%';
|
||||
$table->size[4] = '25%';
|
||||
$table->size[5] = '30%';
|
||||
$table->size[6] = '30%';
|
||||
$table->size[7] = '20px';
|
||||
$table->size[8] = '60px';
|
||||
|
||||
$table->head[0] = "<span title='" . __('Policy') . "'>" . __('P.') . "</span>";
|
||||
$table->head[1] = "<span title='" . __('Standby') . "'>" . __('S.') . "</span>";
|
||||
$table->head[2] = "<span title='" . __('Force execution') . "'>" . __('F.') . "</span>";
|
||||
$table->head[3] = __('Agent') . ' ' .
|
||||
'<a href="' . $url . '&sort_field=agent&sort=up"><img src="images/sort_up.png" style="' . $selectAgentUp . '" /></a>' .
|
||||
'<a href="' . $url . '&sort_field=agent&sort=down"><img src="images/sort_down.png" style="' . $selectAgentDown . '" /></a>';
|
||||
$table->head[4] = __('Module') . ' ' .
|
||||
'<a href="' . $url . '&sort_field=module&sort=up"><img src="images/sort_up.png" style="' . $selectModuleUp . '" /></a>' .
|
||||
'<a href="' . $url . '&sort_field=module&sort=down"><img src="images/sort_down.png" style="' . $selectModuleDown . '" /></a>';
|
||||
$table->head[5] = __('Template') . ' ' .
|
||||
'<a href="' . $url . '&sort_field=template&sort=up"><img src="images/sort_up.png" style="' . $selectTemplateUp . '" /></a>' .
|
||||
'<a href="' . $url . '&sort_field=template&sort=down"><img src="images/sort_down.png" style="' . $selectTemplateDown . '" /></a>';
|
||||
$table->head[6] = __('Action');
|
||||
$table->head[7] = __('Last fired');
|
||||
$table->head[8] = __('Status');
|
||||
$table->head[9] = __('Validate');
|
||||
|
||||
$table->align[8] = 'center';
|
||||
$table->align[9] = 'center';
|
||||
}
|
||||
else {
|
||||
$table->size[0] = '20px';
|
||||
$table->size[1] = '20px';
|
||||
$table->size[2] = '20px';
|
||||
$table->size[3] = '25%';
|
||||
$table->size[4] = '50%';
|
||||
$table->size[5] = '25%';
|
||||
$table->size[6] = '20px';
|
||||
$table->size[7] = '60px';
|
||||
|
||||
$table->head[0] = "<span title='" . __('Policy') . "'>" . __('P.') . "</span>";
|
||||
$table->head[1] = "<span title='" . __('Standby') . "'>" . __('S.') . "</span>";
|
||||
$table->head[2] = "<span title='" . __('Force execution') . "'>" . __('F.') . "</span>";
|
||||
$table->head[3] = __('Module') . ' ' .
|
||||
'<a href="' . $url . '&sort_field=module&sort=up"><img src="images/sort_up.png" style="' . $selectModuleUp . '" /></a>' .
|
||||
'<a href="' . $url . '&sort_field=module&sort=down"><img src="images/sort_down.png" style="' . $selectModuleDown . '" /></a>';
|
||||
$table->head[4] = __('Template') . ' ' .
|
||||
'<a href="' . $url . '&sort_field=template&sort=up"><img src="images/sort_up.png" style="' . $selectTemplateUp . '" /></a>' .
|
||||
'<a href="' . $url . '&sort_field=template&sort=down"><img src="images/sort_down.png" style="' . $selectTemplateDown . '" /></a>';
|
||||
$table->head[5] = __('Action');
|
||||
$table->head[6] = __('Last fired');
|
||||
$table->head[7] = __('Status');
|
||||
$table->head[8] = __('Validate');
|
||||
|
||||
$table->align[7] = 'center';
|
||||
$table->align[8] = 'center';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($print_agent) {
|
||||
$table->size[0] = '20px';
|
||||
$table->size[1] = '20px';
|
||||
$table->size[2] = '25%';
|
||||
$table->size[3] = '25%';
|
||||
$table->size[4] = '50%';
|
||||
$table->size[5] = '25%';
|
||||
$table->size[6] = '20px';
|
||||
$table->size[7] = '60px';
|
||||
|
||||
$table->head[0] = "<span title='" . __('Standby') . "'>" . __('S.') . "</span>";
|
||||
$table->head[1] = "<span title='" . __('Force execution') . "'>" . __('F.') . "</span>";
|
||||
$table->head[2] = __('Agent') . ' ' .
|
||||
'<a href="' . $url . '&sort_field=agent&sort=up"><img src="images/sort_up.png" style="' . $selectAgentUp . '" /></a>' .
|
||||
|
@ -236,7 +314,7 @@ if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
|
|||
$table->size[5] = '20px';
|
||||
$table->size[6] = '60px';
|
||||
|
||||
$table->head[0] = "<span title='" . __('Policy') . "'>" . __('P.') . "</span>";
|
||||
$table->head[0] = "<span title='" . __('Standby') . "'>" . __('S.') . "</span>";
|
||||
$table->head[1] = "<span title='" . __('Force execution') . "'>" . __('F.') . "</span>";
|
||||
$table->head[2] = __('Module') . ' ' .
|
||||
'<a href="' . $url . '&sort_field=module&sort=up"><img src="images/sort_up.png" style="' . $selectModuleUp . '" /></a>' .
|
||||
|
@ -253,59 +331,6 @@ if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
|
|||
$table->align[7] = 'center';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($print_agent) {
|
||||
$table->size[0] = '20px';
|
||||
$table->size[1] = '25%';
|
||||
$table->size[2] = '25%';
|
||||
$table->size[3] = '50%';
|
||||
$table->size[4] = '25%';
|
||||
$table->size[5] = '20px';
|
||||
$table->size[6] = '60px';
|
||||
|
||||
$table->head[0] = "<span title='" . __('Force execution') . "'>" . __('F.') . "</span>";
|
||||
$table->head[1] = __('Agent') . ' ' .
|
||||
'<a href="' . $url . '&sort_field=agent&sort=up"><img src="images/sort_up.png" style="' . $selectAgentUp . '" /></a>' .
|
||||
'<a href="' . $url . '&sort_field=agent&sort=down"><img src="images/sort_down.png" style="' . $selectAgentDown . '" /></a>';
|
||||
$table->head[2] = __('Module') . ' ' .
|
||||
'<a href="' . $url . '&sort_field=module&sort=up"><img src="images/sort_up.png" style="' . $selectModuleUp . '" /></a>' .
|
||||
'<a href="' . $url . '&sort_field=module&sort=down"><img src="images/sort_down.png" style="' . $selectModuleDown . '" /></a>';
|
||||
$table->head[3] = __('Template') . ' ' .
|
||||
'<a href="' . $url . '&sort_field=template&sort=up"><img src="images/sort_up.png" style="' . $selectTemplateUp . '" /></a>' .
|
||||
'<a href="' . $url . '&sort_field=template&sort=down"><img src="images/sort_down.png" style="' . $selectTemplateDown . '" /></a>';
|
||||
$table->head[4] = __('Action');
|
||||
$table->head[5] = __('Last fired');
|
||||
$table->head[6] = __('Status');
|
||||
$table->head[7] = __('Validate');
|
||||
|
||||
$table->align[6] = 'center';
|
||||
$table->align[7] = 'center';
|
||||
}
|
||||
else {
|
||||
$table->size[0] = '20px';
|
||||
$table->size[1] = '25%';
|
||||
$table->size[2] = '50%';
|
||||
$table->size[3] = '25%';
|
||||
$table->size[4] = '20px';
|
||||
$table->size[5] = '60px';
|
||||
|
||||
$table->head[0] = "<span title='" . __('Force execution') . "'>" . __('F.') . "</span>";
|
||||
$table->head[1] = __('Module') . ' ' .
|
||||
'<a href="' . $url . '&sort_field=module&sort=up"><img src="images/sort_up.png" style="' . $selectModuleUp . '" /></a>' .
|
||||
'<a href="' . $url . '&sort_field=module&sort=down"><img src="images/sort_down.png" style="' . $selectModuleDown . '" /></a>';
|
||||
$table->head[2] = __('Template') . ' ' .
|
||||
'<a href="' . $url . '&sort_field=template&sort=up"><img src="images/sort_up.png" style="' . $selectTemplateUp . '" /></a>' .
|
||||
'<a href="' . $url . '&sort_field=template&sort=down"><img src="images/sort_down.png" style="' . $selectTemplateDown . '" /></a>';
|
||||
$table->head[3] = __('Action');
|
||||
$table->head[4] = __('Last fired');
|
||||
$table->head[5] = __('Status');
|
||||
$table->head[6] = __('Validate');
|
||||
|
||||
$table->align[5] = 'center';
|
||||
$table->align[6] = 'center';
|
||||
}
|
||||
}
|
||||
|
||||
$table->title = __('Single alerts');
|
||||
$table->titlestyle = "background-color:#799E48;";
|
||||
|
@ -339,14 +364,16 @@ $table->titlestyle = "background-color:#799E48;";
|
|||
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
|
||||
$table->head[0] = '';
|
||||
$table->head[1] = '';
|
||||
$table->head[2] = __('Agent');
|
||||
$table->head[3] = __('Description');
|
||||
$table->head[2] = '';
|
||||
$table->head[3] = __('Agent');
|
||||
$table->head[4] = __('Description');
|
||||
}
|
||||
else
|
||||
{
|
||||
$table->head[0] = '';
|
||||
$table->head[1] = __('Agent');
|
||||
$table->head[2] = __('Description');
|
||||
$table->head[1] = '';
|
||||
$table->head[2] = __('Agent');
|
||||
$table->head[3] = __('Description');
|
||||
}
|
||||
$table->data = array ();
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
global $config;
|
||||
|
||||
require_once ("include/functions_events.php"); //Event processing functions
|
||||
require_once ("include/functions_alerts.php"); //Alerts processing functions
|
||||
|
||||
check_login ();
|
||||
|
||||
|
@ -33,6 +34,7 @@ if (is_ajax ()) {
|
|||
$validate_event = (bool) get_parameter ('validate_event');
|
||||
$delete_event = (bool) get_parameter ('delete_event');
|
||||
$get_events_fired = (bool) get_parameter('get_events_fired');
|
||||
$standby_alert = (bool) get_parameter('standby_alert');
|
||||
|
||||
if ($get_event_tooltip) {
|
||||
$id = (int) get_parameter ('id');
|
||||
|
@ -64,11 +66,29 @@ if (is_ajax ()) {
|
|||
return;
|
||||
}
|
||||
|
||||
if ($standby_alert) {
|
||||
$id = (int) get_parameter ('id');
|
||||
$event = get_event ($id);
|
||||
if ($event === false)
|
||||
return;
|
||||
|
||||
set_alerts_agent_module_standby ($event['id_alert_am'], 1);
|
||||
return;
|
||||
}
|
||||
|
||||
if ($validate_event) {
|
||||
$id = (int) get_parameter ("id");
|
||||
$similars = (bool) get_parameter ('similars');
|
||||
|
||||
$return = validate_event ($id, $similars);
|
||||
$comment = (string) get_parameter ('comment');
|
||||
$new_status = get_parameter ('new_status');
|
||||
|
||||
// Set off the standby mode when close an event
|
||||
if($new_status == 1) {
|
||||
$event = get_event ($id);
|
||||
set_alerts_agent_module_standby ($event['id_alert_am'], 0);
|
||||
}
|
||||
|
||||
$return = validate_event ($id, $similars, $comment, $new_status);
|
||||
if ($return)
|
||||
echo 'ok';
|
||||
else
|
||||
|
@ -135,119 +155,23 @@ if ($config['flash_charts']) {
|
|||
|
||||
$offset = (int) get_parameter ("offset", 0);
|
||||
$ev_group = (int) get_parameter ("ev_group", 0); //0 = all
|
||||
$search = preg_replace ("/&([A-Za-z]{0,4}\w{2,3};|#[0-9]{2,3};)/", "%", rawurldecode (get_parameter ("search")));
|
||||
$event_type = get_parameter ("event_type", ''); // 0 all
|
||||
$severity = (int) get_parameter ("severity", -1); // -1 all
|
||||
$status = (int) get_parameter ("status", 0); // -1 all, 0 only red, 1 only green
|
||||
$status = (int) get_parameter ("status", 3); // -1 all, 0 only new, 1 only validated, 2 only in process, 3 only not validated,
|
||||
$id_agent = (int) get_parameter ("id_agent", -2); //-1 all, 0 system
|
||||
|
||||
if($id_agent == -2) {
|
||||
$text_agent = (string) get_parameter("text_agent", __("All"));
|
||||
|
||||
switch ($text_agent)
|
||||
{
|
||||
case __('All'):
|
||||
$id_agent = -1;
|
||||
break;
|
||||
case __('Server'):
|
||||
$id_agent = 0;
|
||||
break;
|
||||
default:
|
||||
$id_agent = get_agent_id($text_agent);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else{
|
||||
switch ($id_agent)
|
||||
{
|
||||
case -1:
|
||||
$text_agent = __('All');
|
||||
break;
|
||||
case 0:
|
||||
$text_agent = __('Server');
|
||||
break;
|
||||
default:
|
||||
$text_agent = get_agent_name($id_agent);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$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"]);
|
||||
$id_user_ack = get_parameter ("id_user_ack", 0);
|
||||
$group_rep = (int) get_parameter ("group_rep", 0);
|
||||
$delete = (bool) get_parameter ("delete");
|
||||
$validate = (bool) get_parameter ("validate");
|
||||
$validate = (bool) get_parameter ("validate", 0);
|
||||
$section = (string) get_parameter ("section", "list");
|
||||
|
||||
$search = preg_replace ("/&([A-Za-z]{0,4}\w{2,3};|#[0-9]{2,3};)/", "%", rawurldecode (get_parameter ("search")));
|
||||
$groups = get_user_groups ($config["id_user"], "IR");
|
||||
|
||||
//Group selection
|
||||
if ($ev_group > 0 && in_array ($ev_group, array_keys ($groups))) {
|
||||
//If a group is selected and it's in the groups allowed
|
||||
$sql_post = " AND id_grupo = $ev_group";
|
||||
} else {
|
||||
if (is_user_admin ($config["id_user"])) {
|
||||
//Do nothing if you're admin, you get full access
|
||||
$sql_post = "";
|
||||
} else {
|
||||
//Otherwise select all groups the user has rights to.
|
||||
$sql_post = " AND id_grupo IN (".implode (",", array_keys ($groups)).")";
|
||||
}
|
||||
}
|
||||
|
||||
// Skip system messages if user is not PM
|
||||
if (!give_acl ($config["id_user"], 0, "PM")) {
|
||||
$sql_post .= " AND id_grupo != 0";
|
||||
}
|
||||
|
||||
if ($status == 1) {
|
||||
$sql_post .= " AND estado = 1";
|
||||
}
|
||||
elseif ($status == 0) {
|
||||
$sql_post .= " AND estado = 0";
|
||||
}
|
||||
|
||||
if ($search != "") {
|
||||
$sql_post .= " AND evento LIKE '%".$search."%'";
|
||||
}
|
||||
|
||||
if ($event_type != "") {
|
||||
// If normal, warning, could be several (going_up_warning, going_down_warning... too complex
|
||||
// for the user so for him is presented only "warning, critical and normal"
|
||||
if ($event_type == "warning" || $event_type == "critical" || $event_type == "normal") {
|
||||
$sql_post .= " AND event_type LIKE '%$event_type%' ";
|
||||
}
|
||||
elseif ($event_type == "not_normal") {
|
||||
$sql_post .= " AND event_type LIKE '%warning%' OR event_type LIKE '%critical%' OR event_type LIKE '%unknown%' ";
|
||||
}
|
||||
else {
|
||||
$sql_post .= " AND event_type = '".$event_type."'";
|
||||
}
|
||||
|
||||
}
|
||||
if ($severity != -1)
|
||||
$sql_post .= " AND criticity >= ".$severity;
|
||||
if ($id_agent != -1)
|
||||
$sql_post .= " AND id_agente = ".$id_agent;
|
||||
if ($id_event != -1)
|
||||
$sql_post .= " AND id_evento = ".$id_event;
|
||||
|
||||
if ($id_user_ack != "0")
|
||||
$sql_post .= " AND id_usuario = '".$id_user_ack."'";
|
||||
|
||||
|
||||
if ($event_view_hr > 0) {
|
||||
$unixtime = get_system_time () - ($event_view_hr * 3600); //Put hours in seconds
|
||||
$sql_post .= " AND utimestamp > ".$unixtime;
|
||||
}
|
||||
|
||||
$url = "index.php?sec=eventos&sec2=operation/events/events&search=" .
|
||||
rawurlencode($search) . "&event_type=" . $event_type .
|
||||
"&severity=" . $severity . "&status=" . $status . "&ev_group=" .
|
||||
$ev_group . "&refr=" . $config["refr"] . "&id_agent=" .
|
||||
$id_agent . "&id_event=" . $id_event . "&pagination=" .
|
||||
$pagination . "&group_rep=" . $group_rep . "&event_view_hr=" .
|
||||
$event_view_hr . "&id_user_ack=" . $id_user_ack;
|
||||
$ids = (array) get_parameter ("eventid", -1);
|
||||
|
||||
// Header
|
||||
if ($config["pure"] == 0) {
|
||||
|
@ -269,7 +193,7 @@ if ($config["pure"] == 0) {
|
|||
);
|
||||
|
||||
print_page_header (__("Events"), "images/lightning_go.png", false, "eventview", false, $buttons);
|
||||
|
||||
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
function openSoundEventWindow() {
|
||||
|
@ -292,15 +216,38 @@ else {
|
|||
echo "</h2>";
|
||||
}
|
||||
|
||||
if($section == 'validate' && $ids[0] == -1){
|
||||
$section = 'list';
|
||||
print_error_message (__('No events selected'));
|
||||
}
|
||||
|
||||
//Process validation (pass array or single value)
|
||||
if ($validate) {
|
||||
$ids = (array) get_parameter ("eventid", -1);
|
||||
|
||||
if($ids[0] != -1){
|
||||
$return = validate_event ($ids, ($group_rep == 1));
|
||||
$ids = get_parameter ("eventid", -1);
|
||||
$comment = get_parameter ("comment", '');
|
||||
$new_status = get_parameter ("select_validate", 1);
|
||||
$ids = explode(',',$ids);
|
||||
|
||||
// Avoid to re-set inprocess events
|
||||
if($new_status == 2) {
|
||||
foreach($ids as $key => $id) {
|
||||
$event = get_event($id);
|
||||
if($event['estado'] == 2) {
|
||||
unset($ids[$key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(isset($ids[0]) && $ids[0] != -1){
|
||||
$return = validate_event ($ids, ($group_rep == 1), $comment, $new_status);
|
||||
if($new_status == 1) {
|
||||
print_result_message ($return,
|
||||
__('Successfully validated'),
|
||||
__('Could not be validated'));
|
||||
}else if($new_status == 2) {
|
||||
print_result_message ($return,
|
||||
__('Successfully set in process'),
|
||||
__('Could not be set in process'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -316,351 +263,18 @@ if ($delete) {
|
|||
}
|
||||
}
|
||||
|
||||
//Link to toggle filter
|
||||
echo '<a href="#" id="tgl_event_control"><b>'.__('Event control filter').'</b> '.print_image ("images/down.png", true, array ("title" => __('Toggle filter(s)'))).'</a><br><br>';
|
||||
|
||||
//Start div
|
||||
echo '<div id="event_control" style="display:none">';
|
||||
|
||||
// Table for filter controls
|
||||
echo '<form method="post" action="index.php?sec=eventos&sec2=operation/events/events&refr='.$config["refr"].'&pure='.$config["pure"].'">';
|
||||
echo '<table style="float:left;" width="550" cellpadding="4" cellspacing="4" class="databox"><tr>';
|
||||
|
||||
// Group combo
|
||||
echo "<td>".__('Group')."</td><td>";
|
||||
print_select_groups($config["id_user"], "IR", true, 'ev_group', $ev_group, '', '', 0, false, false, false, 'w130');
|
||||
echo "</td>";
|
||||
|
||||
// Event type
|
||||
echo "<td>".__('Event type')."</td><td>";
|
||||
$types = get_event_types ();
|
||||
// Expand standard array to add not_normal (not exist in the array, used only for searches)
|
||||
$types["not_normal"] = __("Not normal");
|
||||
print_select ($types, 'event_type', $event_type, '', __('All'), '');
|
||||
|
||||
|
||||
echo "</td></tr><tr>";
|
||||
|
||||
// Severity
|
||||
echo "<td>".__('Severity')."</td><td>";
|
||||
print_select (get_priorities (), "severity", $severity, '', __('All'), '-1');
|
||||
echo '</td>';
|
||||
|
||||
// Status
|
||||
echo "<td>".__('Event status')."</td><td>";
|
||||
$fields = array ();
|
||||
$fields[-1] = __('All event');
|
||||
$fields[1] = __('Only validated');
|
||||
$fields[0] = __('Only pending');
|
||||
|
||||
print_select ($fields, 'status', $status, '', '', '');
|
||||
|
||||
//NEW LINE
|
||||
echo "</td></tr><tr>";
|
||||
|
||||
// Free search
|
||||
echo "<td>".__('Free search')."</td><td>";
|
||||
print_input_text ('search', $search, '', 15);
|
||||
echo '</td>';
|
||||
|
||||
//Agent search
|
||||
echo "<td>".__('Agent search')."</td><td>";
|
||||
print_input_text_extended ('text_agent', $text_agent, 'text_id_agent', '', 30, 100, false, '',
|
||||
array('style' => 'background: url(images/lightning.png) no-repeat right;'))
|
||||
. '<a href="#" class="tip"> <span>' . __("Type at least two characters to search") . '</span></a>';
|
||||
|
||||
|
||||
echo "</td></tr>";
|
||||
|
||||
// User selectable block size
|
||||
echo '<tr><td>';
|
||||
echo __('Block size for pagination');
|
||||
echo '</td>';
|
||||
$lpagination[25] = 25;
|
||||
$lpagination[50] = 50;
|
||||
$lpagination[100] = 100;
|
||||
$lpagination[200] = 200;
|
||||
$lpagination[500] = 500;
|
||||
|
||||
echo "<td>";
|
||||
print_select ($lpagination, "pagination", $pagination, '', __('Default'), $config["block_size"]);
|
||||
echo "</td>";
|
||||
|
||||
echo "<td>".__('Max. hours old')."</td>";
|
||||
echo "<td>";
|
||||
print_input_text ('event_view_hr', $event_view_hr, '', 5);
|
||||
echo "</td>";
|
||||
|
||||
|
||||
echo "</tr><tr>";
|
||||
echo "<td>".__('User ack.')."</td>";
|
||||
echo "<td>";
|
||||
$users = get_users_info ();
|
||||
print_select ($users, "id_user_ack", $id_user_ack, '', __('Any'), 0);
|
||||
echo "</td>";
|
||||
|
||||
echo "<td>";
|
||||
echo __("Repeated");
|
||||
echo "</td><td>";
|
||||
|
||||
$repeated_sel[0] = __("All events");
|
||||
$repeated_sel[1] = __("Group events");
|
||||
print_select ($repeated_sel, "group_rep", $group_rep, '');
|
||||
echo "</td></tr>";
|
||||
|
||||
echo '<tr><td colspan="4" style="text-align:right">';
|
||||
//The buttons
|
||||
print_submit_button (__('Update'), '', false, 'class="sub upd"');
|
||||
|
||||
echo "</td></tr></table></form>"; //This is the filter div
|
||||
echo '<div style="width:220px; float:left;">';
|
||||
if ($config['flash_charts']) {
|
||||
echo grafico_eventos_grupo (220, 180, rawurlencode ($sql_post));
|
||||
} else {
|
||||
print_image ("include/fgraph.php?tipo=group_events&width=220&height=180&url=".rawurlencode ($sql_post), false, array ("border" => 0));
|
||||
switch($section) {
|
||||
case 'list':
|
||||
require_once('operation/events/events_list.php');
|
||||
break;
|
||||
case 'validate':
|
||||
require_once('operation/events/events_validate.php');
|
||||
break;
|
||||
}
|
||||
echo '</div>';
|
||||
echo '<div id="steps_clean"> </div>';
|
||||
echo '</div>';
|
||||
|
||||
if ($group_rep == 0) {
|
||||
$sql = "SELECT * FROM tevento WHERE 1=1 ".$sql_post." ORDER BY utimestamp DESC LIMIT ".$offset.",".$pagination;
|
||||
} else {
|
||||
$sql = "SELECT *, COUNT(*) AS event_rep, MAX(utimestamp) AS timestamp_rep FROM tevento WHERE 1=1 ".$sql_post." GROUP BY evento, id_agentmodule ORDER BY timestamp_rep DESC LIMIT ".$offset.",".$pagination;
|
||||
}
|
||||
|
||||
//Extract the events by filter (or not) from db
|
||||
$result = get_db_all_rows_sql ($sql);
|
||||
|
||||
if ($group_rep == 0) {
|
||||
$sql = "SELECT COUNT(id_evento) FROM tevento WHERE 1=1 ".$sql_post;
|
||||
} else {
|
||||
$sql = "SELECT COUNT(DISTINCT(evento)) FROM tevento WHERE 1=1 ".$sql_post;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//Count the events with this filter (TODO but not utimestamp).
|
||||
$total_events = (int) get_db_sql ($sql);
|
||||
|
||||
if (empty ($result)) {
|
||||
$result = array ();
|
||||
}
|
||||
|
||||
$table->width = '100%';
|
||||
$table->id = "eventtable";
|
||||
$table->cellpadding = 4;
|
||||
$table->cellspacing = 4;
|
||||
$table->class = "databox";
|
||||
$table->head = array ();
|
||||
$table->data = array ();
|
||||
|
||||
$table->head[0] = "<span title='" . __('Validate') . "'>" . __('V.') . "</span>";
|
||||
$table->align[0] = 'center';
|
||||
|
||||
$table->head[1] = "<span title='" . __('Severity') . "'>" . __('S.') . "</span>";
|
||||
$table->align[1] = 'center';
|
||||
|
||||
$table->head[2] ="<span title='" . __('Type') . "'>" . __('T.') . "</span>";
|
||||
$table->headclass[2] = 'f9';
|
||||
$table->align[2] = 'center';
|
||||
|
||||
$table->head[3] = __('Event name');
|
||||
|
||||
$table->head[4] = __('Agent name');
|
||||
$table->align[4] = 'center';
|
||||
|
||||
$table->head[5] = __('S.');
|
||||
$table->align[5] = 'center';
|
||||
|
||||
$table->head[6] = __('G.');
|
||||
$table->align[6] = 'center';
|
||||
|
||||
if ($group_rep == 0) {
|
||||
$table->head[7] = __('User ID');
|
||||
} else {
|
||||
$table->head[7] = __('Count');
|
||||
}
|
||||
$table->align[7] = 'center';
|
||||
|
||||
$table->head[8] = __('Timestamp');
|
||||
$table->align[8] = 'center';
|
||||
|
||||
$table->head[9] = __('Action');
|
||||
$table->align[9] = 'right';
|
||||
$table->size[9] = '50px';
|
||||
|
||||
$table->head[10] = print_checkbox ("allbox", "1", false, true);
|
||||
$table->align[10] = 'center';
|
||||
|
||||
//Arrange data. We already did ACL's in the query
|
||||
foreach ($result as $event) {
|
||||
$data = array ();
|
||||
|
||||
//First pass along the class of this row
|
||||
$table->rowclass[] = get_priority_class ($event["criticity"]);
|
||||
|
||||
// Colored box
|
||||
if ($event["estado"] == 0) {
|
||||
$img = "images/tick_off.png";
|
||||
$title = __('Event not validated');
|
||||
}
|
||||
else {
|
||||
$img = "images/tick.png";
|
||||
$title = __('Event validated');
|
||||
}
|
||||
$data[0] = print_image ($img, true,
|
||||
array ("class" => "image_status",
|
||||
"width" => 16,
|
||||
"height" => 16,
|
||||
"title" => $title));
|
||||
|
||||
switch ($event["criticity"]) {
|
||||
default:
|
||||
case 0:
|
||||
$img = "images/status_sets/default/severity_maintenance.png";
|
||||
break;
|
||||
case 1:
|
||||
$img = "images/status_sets/default/severity_informational.png";
|
||||
break;
|
||||
case 2:
|
||||
$img = "images/status_sets/default/severity_normal.png";
|
||||
break;
|
||||
case 3:
|
||||
$img = "images/status_sets/default/severity_warning.png";
|
||||
break;
|
||||
case 4:
|
||||
$img = "images/status_sets/default/severity_critical.png";
|
||||
break;
|
||||
}
|
||||
|
||||
$data[1] = print_image ($img, true,
|
||||
array ("class" => "image_status",
|
||||
"width" => 12,
|
||||
"height" => 12,
|
||||
"title" => get_priority_name ($event["criticity"])));
|
||||
|
||||
$data[2] = print_event_type_img ($event["event_type"], true);
|
||||
|
||||
// Event description
|
||||
$data[3] = '<span title="'.$event["evento"].'" class="f9">';
|
||||
$data[3] .= '<a href="'.$url.'&group_rep=0&pure='.$config["pure"].'&search='.rawurlencode ($event["evento"]).'">';
|
||||
if (strlen ($event["evento"]) > 50) {
|
||||
$data[3] .= mb_substr ($event["evento"], 0, 50)."...";
|
||||
}
|
||||
else {
|
||||
$data[3] .= $event["evento"];
|
||||
}
|
||||
$data[3] .= '</a></span>';
|
||||
|
||||
if ($event["event_type"] == "system") {
|
||||
$data[4] = __('System');
|
||||
}
|
||||
elseif ($event["id_agente"] > 0) {
|
||||
// Agent name
|
||||
$data[4] = print_agent_name ($event["id_agente"], true);
|
||||
}
|
||||
else {
|
||||
$data[4] = __('Alert').__('SNMP');
|
||||
}
|
||||
|
||||
$data[5] = '';
|
||||
if ($event["id_agentmodule"] != 0) {
|
||||
$data[5] .= '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$event["id_agente"].'&tab=data">';
|
||||
$data[5] .= print_image ("images/bricks.png", true,
|
||||
array ("title" => __('Go to data overview')));
|
||||
$data[5] .= '</a> ';
|
||||
}
|
||||
if ($event["id_alert_am"] != 0) {
|
||||
$data[5] .= '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$event["id_agente"].'&tab=alert">';
|
||||
$data[5] .= print_image ("images/bell.png", true,
|
||||
array ("title" => __('Go to alert overview')));
|
||||
$data[5] .= '</a>';
|
||||
}
|
||||
|
||||
$data[6] = print_group_icon ($event["id_grupo"], true);
|
||||
|
||||
if ($group_rep == 1) {
|
||||
$data[7] = $event["event_rep"];
|
||||
}
|
||||
else {
|
||||
if (!empty ($event["estado"])) {
|
||||
if ($event["id_usuario"] != '0' && $event["id_usuario"] != '' && $event["id_usuario"] != 'system' && $event["id_usuario"] != "System"){
|
||||
$data[7] = '<a href="index.php?sec=usuarios&sec2=operation/users/user_edit&id='.$event["id_usuario"].'" title="'.dame_nombre_real ($event["id_usuario"]).'">'.mb_substr ($event["id_usuario"],0,8).'</a>';
|
||||
}
|
||||
else {
|
||||
$data[7] = __('System');
|
||||
}
|
||||
}
|
||||
else {
|
||||
$data[7] = '';
|
||||
}
|
||||
}
|
||||
|
||||
//Time
|
||||
if ($group_rep == 1) {
|
||||
$data[8] = print_timestamp ($event['timestamp_rep'], true);
|
||||
}
|
||||
else {
|
||||
$data[8] = print_timestamp ($event["timestamp"], true);
|
||||
}
|
||||
|
||||
//Actions
|
||||
$data[9] = '';
|
||||
// Validate event
|
||||
if (($event["estado"] == 0) and (give_acl ($config["id_user"], $event["id_grupo"], "IW") == 1)) {
|
||||
$data[9] .= '<a class="validate_event" href="#" onclick="return false" id="delete-'.$event["id_evento"].'">';
|
||||
$data[9] .= print_image ("images/ok.png", true,
|
||||
array ("title" => __('Validate event')));
|
||||
$data[9] .= '</a>';
|
||||
}
|
||||
// Delete event
|
||||
if (give_acl ($config["id_user"], $event["id_grupo"], "IM") == 1) {
|
||||
$data[9] .= '<a class="delete_event" href="#" onclick="return false" id="validate-'.$event['id_evento'].'">';
|
||||
$data[9] .= print_image ("images/cross.png", true,
|
||||
array ("title" => __('Delete event')));
|
||||
$data[9] .= '</a>';
|
||||
}
|
||||
// Create incident from this event
|
||||
if (give_acl ($config["id_user"], $event["id_grupo"], "IW") == 1) {
|
||||
$data[9] .= '<a href="index.php?sec=incidencias&sec2=operation/incidents/incident_detail&insert_form&from_event='.$event["id_evento"].'">';
|
||||
$data[9] .= print_image ("images/page_lightning.png", true,
|
||||
array ("title" => __('Create incident from event')));
|
||||
$data[9] .= '</a>';
|
||||
}
|
||||
|
||||
//Checkbox
|
||||
$data[10] = print_checkbox_extended ("eventid[]", $event["id_evento"], false, false, false, 'class="chk"', true);
|
||||
|
||||
array_push ($table->data, $data);
|
||||
}
|
||||
|
||||
echo '<div id="events_list">';
|
||||
if (!empty ($table->data)) {
|
||||
pagination ($total_events, $url."&pure=".$config["pure"], $offset, $pagination);
|
||||
echo '<form method="post" action="'.$url.'&pure='.$config["pure"].'">';
|
||||
|
||||
print_table ($table);
|
||||
|
||||
echo '<div style="width:'.$table->width.';" class="action-buttons">';
|
||||
if (give_acl ($config["id_user"], 0, "IW") == 1) {
|
||||
print_submit_button (__('Validate'), 'validate', false, 'class="sub ok"');
|
||||
}
|
||||
if (give_acl ($config["id_user"], 0,"IM") == 1) {
|
||||
print_submit_button (__('Delete'), 'delete', false, 'class="sub delete"');
|
||||
}
|
||||
echo '</div></form>';
|
||||
|
||||
}
|
||||
else {
|
||||
echo '<div class="nf">'.__('No events').'</div>';
|
||||
}
|
||||
echo '</div>';
|
||||
|
||||
unset ($table);
|
||||
|
||||
require_jquery_file ('bgiframe');
|
||||
require_jquery_file ('autocomplete');
|
||||
|
||||
?>
|
||||
<script language="javascript" type="text/javascript">
|
||||
/* <![CDATA[ */
|
||||
|
@ -697,6 +311,17 @@ $(document).ready( function() {
|
|||
$("input[name='eventid[]']").attr('checked', $(this).attr('checked'));
|
||||
});
|
||||
|
||||
$('.select_validate').change (function() {
|
||||
display = $(".standby_alert_checkbox").css('display');
|
||||
|
||||
if (display != 'none') {
|
||||
$(".standby_alert_checkbox").css('display', 'none');
|
||||
}
|
||||
else {
|
||||
$(".standby_alert_checkbox").css('display', '');
|
||||
}
|
||||
});
|
||||
|
||||
$("#tgl_event_control").click (function () {
|
||||
$("#event_control").toggle ();
|
||||
return false;
|
||||
|
@ -705,19 +330,43 @@ $(document).ready( function() {
|
|||
$("a.validate_event").click (function () {
|
||||
$tr = $(this).parents ("tr");
|
||||
id = this.id.split ("-").pop ();
|
||||
var comment = $('#textarea_comment_'+id).val();
|
||||
var select_validate = $('#select_validate_'+id).val(); // 1 validate, 2 in process
|
||||
var checkbox_standby_alert = $('#checkbox-standby-alert-'+id).attr('checked');
|
||||
|
||||
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",
|
||||
{"page" : "operation/events/events",
|
||||
"validate_event" : 1,
|
||||
"id" : id,
|
||||
"comment" : comment,
|
||||
"new_status" : select_validate,
|
||||
"similar" : <?php echo ($group_rep ? 1 : 0) ?>
|
||||
},
|
||||
function (data, status) {
|
||||
if (data == "ok") {
|
||||
<?php if ($status == 0) : ?>
|
||||
$tr.remove ();
|
||||
<?php else: ?>
|
||||
$("img.image_status", $tr).attr ("src", "images/pixel_green.png");
|
||||
<?php endif; ?>
|
||||
$("#status_img_"+id).attr ("src", "images/spiner.gif");
|
||||
location.reload();
|
||||
} else {
|
||||
$("#result")
|
||||
.showMessage ("<?php echo __('Could not be validated')?>")
|
||||
|
@ -726,7 +375,7 @@ $(document).ready( function() {
|
|||
},
|
||||
"html"
|
||||
);
|
||||
return false;
|
||||
toggleCommentForm(id);
|
||||
});
|
||||
|
||||
$("a.delete_event").click (function () {
|
||||
|
@ -750,6 +399,41 @@ $(document).ready( function() {
|
|||
);
|
||||
return false;
|
||||
});
|
||||
|
||||
function toggleDiv (divid){
|
||||
if (document.getElementById(divid).style.display == 'none'){
|
||||
document.getElementById(divid).style.display = 'block';
|
||||
} else {
|
||||
document.getElementById(divid).style.display = 'none';
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
/* ]]> */
|
||||
|
||||
function toggleCommentForm(id_event) {
|
||||
display = $('.event_form_' + id_event).css('display');
|
||||
|
||||
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 {
|
||||
$('.event_form_' + id_event).css('display', '');
|
||||
}
|
||||
}
|
||||
|
||||
function toggleVisibleExtendedInfo(id_event) {
|
||||
display = $('.event_info_' + id_event).css('display');
|
||||
|
||||
if (display != 'none') {
|
||||
$('.event_info_' + id_event).css('display', 'none');
|
||||
}
|
||||
else {
|
||||
$('.event_info_' + id_event).css('display', '');
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -0,0 +1,579 @@
|
|||
<?php
|
||||
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
|
||||
// Please see http://pandorafms.org for full contribution list
|
||||
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation for version 2.
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
|
||||
// Load global vars
|
||||
global $config;
|
||||
|
||||
require_once ("include/functions_events.php"); //Event processing functions
|
||||
require_once ("include/functions_alerts.php"); //Alerts processing functions
|
||||
|
||||
check_login ();
|
||||
|
||||
if (! give_acl ($config["id_user"], 0, "IR")) {
|
||||
audit_db ($config["id_user"], $_SERVER['REMOTE_ADDR'], "ACL Violation",
|
||||
"Trying to access event viewer");
|
||||
require ("general/noaccess.php");
|
||||
return;
|
||||
}
|
||||
|
||||
if($id_agent == -2) {
|
||||
$text_agent = (string) get_parameter("text_agent", __("All"));
|
||||
|
||||
switch ($text_agent)
|
||||
{
|
||||
case __('All'):
|
||||
$id_agent = -1;
|
||||
break;
|
||||
case __('Server'):
|
||||
$id_agent = 0;
|
||||
break;
|
||||
default:
|
||||
$id_agent = get_agent_id($text_agent);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else{
|
||||
switch ($id_agent)
|
||||
{
|
||||
case -1:
|
||||
$text_agent = __('All');
|
||||
break;
|
||||
case 0:
|
||||
$text_agent = __('Server');
|
||||
break;
|
||||
default:
|
||||
$text_agent = get_agent_name($id_agent);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//Group selection
|
||||
if ($ev_group > 0 && in_array ($ev_group, array_keys ($groups))) {
|
||||
//If a group is selected and it's in the groups allowed
|
||||
$sql_post = " AND id_grupo = $ev_group";
|
||||
} else {
|
||||
if (is_user_admin ($config["id_user"])) {
|
||||
//Do nothing if you're admin, you get full access
|
||||
$sql_post = "";
|
||||
} else {
|
||||
//Otherwise select all groups the user has rights to.
|
||||
$sql_post = " AND id_grupo IN (".implode (",", array_keys ($groups)).")";
|
||||
}
|
||||
}
|
||||
|
||||
// Skip system messages if user is not PM
|
||||
if (!give_acl ($config["id_user"], 0, "PM")) {
|
||||
$sql_post .= " AND id_grupo != 0";
|
||||
}
|
||||
|
||||
switch($status) {
|
||||
case 0:
|
||||
case 1:
|
||||
case 2:
|
||||
$sql_post .= " AND estado = ".$status;
|
||||
break;
|
||||
case 3:
|
||||
$sql_post .= " AND (estado = 0 OR estado = 2)";
|
||||
break;
|
||||
}
|
||||
|
||||
if ($search != "") {
|
||||
$sql_post .= " AND evento LIKE '%".$search."%'";
|
||||
}
|
||||
|
||||
if ($event_type != "") {
|
||||
// If normal, warning, could be several (going_up_warning, going_down_warning... too complex
|
||||
// for the user so for him is presented only "warning, critical and normal"
|
||||
if ($event_type == "warning" || $event_type == "critical" || $event_type == "normal") {
|
||||
$sql_post .= " AND event_type LIKE '%$event_type%' ";
|
||||
}
|
||||
elseif ($event_type == "not_normal") {
|
||||
$sql_post .= " AND event_type LIKE '%warning%' OR event_type LIKE '%critical%' OR event_type LIKE '%unknown%' ";
|
||||
}
|
||||
else {
|
||||
$sql_post .= " AND event_type = '".$event_type."'";
|
||||
}
|
||||
|
||||
}
|
||||
if ($severity != -1)
|
||||
$sql_post .= " AND criticity >= ".$severity;
|
||||
if ($id_agent != -1)
|
||||
$sql_post .= " AND id_agente = ".$id_agent;
|
||||
if ($id_event != -1)
|
||||
$sql_post .= " AND id_evento = ".$id_event;
|
||||
|
||||
if ($id_user_ack != "0")
|
||||
$sql_post .= " AND id_usuario = '".$id_user_ack."'";
|
||||
|
||||
|
||||
if ($event_view_hr > 0) {
|
||||
$unixtime = get_system_time () - ($event_view_hr * 3600); //Put hours in seconds
|
||||
$sql_post .= " AND utimestamp > ".$unixtime;
|
||||
}
|
||||
|
||||
$url = "index.php?sec=eventos&sec2=operation/events/events&search=" .
|
||||
rawurlencode($search) . "&event_type=" . $event_type .
|
||||
"&severity=" . $severity . "&status=" . $status . "&ev_group=" .
|
||||
$ev_group . "&refr=" . $config["refr"] . "&id_agent=" .
|
||||
$id_agent . "&id_event=" . $id_event . "&pagination=" .
|
||||
$pagination . "&group_rep=" . $group_rep . "&event_view_hr=" .
|
||||
$event_view_hr . "&id_user_ack=" . $id_user_ack . "&offset=" . $offset;
|
||||
|
||||
//Link to toggle filter
|
||||
echo '<a href="#" id="tgl_event_control"><b>'.__('Event control filter').'</b> '.print_image ("images/down.png", true, array ("title" => __('Toggle filter(s)'))).'</a><br><br>';
|
||||
|
||||
//Start div
|
||||
echo '<div id="event_control" style="display:none">';
|
||||
|
||||
// Table for filter controls
|
||||
echo '<form method="post" action="index.php?sec=eventos&sec2=operation/events/events&refr='.$config["refr"].'&pure='.$config["pure"].'&section=list">';
|
||||
echo '<table style="float:left;" width="550" cellpadding="4" cellspacing="4" class="databox"><tr>';
|
||||
|
||||
// Group combo
|
||||
echo "<td>".__('Group')."</td><td>";
|
||||
print_select_groups($config["id_user"], "IR", true, 'ev_group', $ev_group, '', '', 0, false, false, false, 'w130');
|
||||
echo "</td>";
|
||||
|
||||
// Event type
|
||||
echo "<td>".__('Event type')."</td><td>";
|
||||
$types = get_event_types ();
|
||||
// Expand standard array to add not_normal (not exist in the array, used only for searches)
|
||||
$types["not_normal"] = __("Not normal");
|
||||
print_select ($types, 'event_type', $event_type, '', __('All'), '');
|
||||
|
||||
|
||||
echo "</td></tr><tr>";
|
||||
|
||||
// Severity
|
||||
echo "<td>".__('Severity')."</td><td>";
|
||||
print_select (get_priorities (), "severity", $severity, '', __('All'), '-1');
|
||||
echo '</td>';
|
||||
|
||||
// Status
|
||||
echo "<td>".__('Event status')."</td><td>";
|
||||
$fields = array ();
|
||||
$fields[-1] = __('All event');
|
||||
$fields[0] = __('Only new');
|
||||
$fields[1] = __('Only validated');
|
||||
$fields[2] = __('Only in process');
|
||||
$fields[3] = __('Only not validated');
|
||||
|
||||
print_select ($fields, 'status', $status, '', '', '');
|
||||
|
||||
//NEW LINE
|
||||
echo "</td></tr><tr>";
|
||||
|
||||
// Free search
|
||||
echo "<td>".__('Free search')."</td><td>";
|
||||
print_input_text ('search', $search, '', 15);
|
||||
echo '</td>';
|
||||
|
||||
//Agent search
|
||||
echo "<td>".__('Agent search')."</td><td>";
|
||||
print_input_text_extended ('text_agent', $text_agent, 'text_id_agent', '', 30, 100, false, '',
|
||||
array('style' => 'background: url(images/lightning.png) no-repeat right;'))
|
||||
. '<a href="#" class="tip"> <span>' . __("Type at least two characters to search") . '</span></a>';
|
||||
|
||||
|
||||
echo "</td></tr>";
|
||||
|
||||
// User selectable block size
|
||||
echo '<tr><td>';
|
||||
echo __('Block size for pagination');
|
||||
echo '</td>';
|
||||
$lpagination[25] = 25;
|
||||
$lpagination[50] = 50;
|
||||
$lpagination[100] = 100;
|
||||
$lpagination[200] = 200;
|
||||
$lpagination[500] = 500;
|
||||
|
||||
echo "<td>";
|
||||
print_select ($lpagination, "pagination", $pagination, '', __('Default'), $config["block_size"]);
|
||||
echo "</td>";
|
||||
|
||||
echo "<td>".__('Max. hours old')."</td>";
|
||||
echo "<td>";
|
||||
print_input_text ('event_view_hr', $event_view_hr, '', 5);
|
||||
echo "</td>";
|
||||
|
||||
|
||||
echo "</tr><tr>";
|
||||
echo "<td>".__('User ack.')."</td>";
|
||||
echo "<td>";
|
||||
$users = get_users_info ();
|
||||
print_select ($users, "id_user_ack", $id_user_ack, '', __('Any'), 0);
|
||||
echo "</td>";
|
||||
|
||||
echo "<td>";
|
||||
echo __("Repeated");
|
||||
echo "</td><td>";
|
||||
|
||||
$repeated_sel[0] = __("All events");
|
||||
$repeated_sel[1] = __("Group events");
|
||||
print_select ($repeated_sel, "group_rep", $group_rep, '');
|
||||
echo "</td></tr>";
|
||||
|
||||
echo '<tr><td colspan="4" style="text-align:right">';
|
||||
//The buttons
|
||||
print_submit_button (__('Update'), '', false, 'class="sub upd"');
|
||||
|
||||
echo "</td></tr></table></form>"; //This is the filter div
|
||||
echo '<div style="width:220px; float:left;">';
|
||||
if ($config['flash_charts']) {
|
||||
echo grafico_eventos_grupo (220, 180, rawurlencode ($sql_post));
|
||||
} else {
|
||||
print_image ("include/fgraph.php?tipo=group_events&width=220&height=180&url=".rawurlencode ($sql_post), false, array ("border" => 0));
|
||||
}
|
||||
echo '</div>';
|
||||
echo '<div id="steps_clean"> </div>';
|
||||
echo '</div>';
|
||||
|
||||
if ($group_rep == 0) {
|
||||
$sql = "SELECT * FROM tevento WHERE 1=1 ".$sql_post." ORDER BY utimestamp DESC LIMIT ".$offset.",".$pagination;
|
||||
} else {
|
||||
$sql = "SELECT *, COUNT(*) AS event_rep, MAX(utimestamp) AS timestamp_rep FROM tevento WHERE 1=1 ".$sql_post." GROUP BY evento, id_agentmodule ORDER BY timestamp_rep DESC LIMIT ".$offset.",".$pagination;
|
||||
}
|
||||
|
||||
//Extract the events by filter (or not) from db
|
||||
$result = get_db_all_rows_sql ($sql);
|
||||
|
||||
if ($group_rep == 0) {
|
||||
$sql = "SELECT COUNT(id_evento) FROM tevento WHERE 1=1 ".$sql_post;
|
||||
} else {
|
||||
$sql = "SELECT COUNT(DISTINCT(evento)) FROM tevento WHERE 1=1 ".$sql_post;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//Count the events with this filter (TODO but not utimestamp).
|
||||
$total_events = (int) get_db_sql ($sql);
|
||||
|
||||
if (empty ($result)) {
|
||||
$result = array ();
|
||||
}
|
||||
|
||||
$table->width = '100%';
|
||||
$table->id = "eventtable";
|
||||
$table->cellpadding = 4;
|
||||
$table->cellspacing = 4;
|
||||
$table->class = "databox";
|
||||
$table->head = array ();
|
||||
$table->data = array ();
|
||||
|
||||
$table->head[0] = __('Status');
|
||||
$table->align[0] = 'center';
|
||||
|
||||
$table->head[1] = __('Event name');
|
||||
|
||||
$table->head[2] = __('Agent name');
|
||||
$table->align[2] = 'center';
|
||||
|
||||
$table->head[3] = __('Timestamp');
|
||||
$table->align[3] = 'center';
|
||||
|
||||
$table->head[4] = __('Action');
|
||||
$table->align[4] = 'center';
|
||||
$table->size[4] = '80px';
|
||||
|
||||
$table->head[5] = print_checkbox ("allbox", "1", false, true);
|
||||
$table->align[5] = 'center';
|
||||
|
||||
$idx = 0;
|
||||
//Arrange data. We already did ACL's in the query
|
||||
foreach ($result as $event) {
|
||||
$data = array ();
|
||||
|
||||
//First pass along the class of this row
|
||||
$table->rowclass[] = get_priority_class ($event["criticity"]);
|
||||
|
||||
// Colored box
|
||||
switch($event["estado"]) {
|
||||
case 0:
|
||||
$img_st = "images/star.png";
|
||||
$title_st = __('New event');
|
||||
break;
|
||||
case 1:
|
||||
$img_st = "images/tick.png";
|
||||
$title_st = __('Event validated');
|
||||
break;
|
||||
case 2:
|
||||
$img_st = "images/hourglass.png";
|
||||
$title_st = __('Event in process');
|
||||
break;
|
||||
}
|
||||
|
||||
$data[0] = print_image ($img_st, true,
|
||||
array ("class" => "image_status",
|
||||
"width" => 16,
|
||||
"height" => 16,
|
||||
"title" => $title_st,
|
||||
"id" => 'status_img_'.$event["id_evento"]));
|
||||
|
||||
switch ($event["criticity"]) {
|
||||
default:
|
||||
case 0:
|
||||
$img_sev = "images/status_sets/default/severity_maintenance.png";
|
||||
break;
|
||||
case 1:
|
||||
$img_sev = "images/status_sets/default/severity_informational.png";
|
||||
break;
|
||||
case 2:
|
||||
$img_sev = "images/status_sets/default/severity_normal.png";
|
||||
break;
|
||||
case 3:
|
||||
$img_sev = "images/status_sets/default/severity_warning.png";
|
||||
break;
|
||||
case 4:
|
||||
$img_sev = "images/status_sets/default/severity_critical.png";
|
||||
break;
|
||||
}
|
||||
|
||||
// Event description
|
||||
$data[1] = '<span title="'.$event["evento"].'" class="f9">';
|
||||
$data[1] .= '<a href="'.$url.'&group_rep=0&pure='.$config["pure"].'&search='.rawurlencode ($event["evento"]).'">';
|
||||
if (strlen ($event["evento"]) > 50) {
|
||||
$data[1] .= mb_substr ($event["evento"], 0, 50)."...";
|
||||
}
|
||||
else {
|
||||
$data[1] .= $event["evento"];
|
||||
}
|
||||
$data[1] .= '</a></span>';
|
||||
|
||||
if ($event["event_type"] == "system") {
|
||||
$data[2] = __('System');
|
||||
}
|
||||
elseif ($event["id_agente"] > 0) {
|
||||
// Agent name
|
||||
$data[2] = print_agent_name ($event["id_agente"], true);
|
||||
}
|
||||
else {
|
||||
$data[2] = __('Alert').__('SNMP');
|
||||
}
|
||||
|
||||
//Time
|
||||
if ($group_rep == 1) {
|
||||
$data[3] = print_timestamp ($event['timestamp_rep'], true);
|
||||
}
|
||||
else {
|
||||
$data[3] = print_timestamp ($event["timestamp"], true);
|
||||
}
|
||||
|
||||
//Actions
|
||||
$data[4] = '';
|
||||
// Validate event
|
||||
if (($event["estado"] != 1) and (give_acl ($config["id_user"], $event["id_grupo"], "IW") == 1)) {
|
||||
$data[4] .= '<a href="javascript: toggleCommentForm(' . $event['id_evento'] . ')" id="validate-'.$event["id_evento"].'">';
|
||||
$data[4] .= print_image ("images/ok.png", true,
|
||||
array ("title" => __('Validate event')));
|
||||
$data[4] .= '</a> ';
|
||||
}else {
|
||||
$data[4] .= print_image ("images/tick.png", true,
|
||||
array ("title" => __('Event validated'))).' ';
|
||||
}
|
||||
// Delete event
|
||||
if (give_acl ($config["id_user"], $event["id_grupo"], "IM") == 1) {
|
||||
if($event['estado'] != 2) {
|
||||
$data[4] .= '<a class="delete_event" href="#" onclick="return false" id="delete-'.$event['id_evento'].'">';
|
||||
$data[4] .= print_image ("images/cross.png", true,
|
||||
array ("title" => __('Delete event')));
|
||||
$data[4] .= '</a> ';
|
||||
}else {
|
||||
$data[4] .= print_image ("images/cross.disabled.png", true,
|
||||
array ("title" => __('Is not allowed delete events in process'))).' ';
|
||||
}
|
||||
}
|
||||
|
||||
$data[4] .= '<a href="javascript: toggleVisibleExtendedInfo(' . $event["id_evento"] . ');">';
|
||||
$data[4] .= print_image ("images/eye.png", true,
|
||||
array ("title" => __('Show more')));
|
||||
$data[4] .= '</a> ';
|
||||
|
||||
// Create incident from this event
|
||||
if (give_acl ($config["id_user"], $event["id_grupo"], "IW") == 1) {
|
||||
$data[4] .= '<a href="index.php?sec=incidencias&sec2=operation/incidents/incident_detail&insert_form&from_event='.$event["id_evento"].'">';
|
||||
$data[4] .= print_image ("images/page_lightning.png", true,
|
||||
array ("title" => __('Create incident from event')));
|
||||
$data[4] .= '</a>';
|
||||
}
|
||||
|
||||
//Checkbox
|
||||
if($event["estado"] != 1) {
|
||||
$data[5] = print_checkbox_extended ("eventid[]", $event["id_evento"], false, false, false, 'class="chk"', true);
|
||||
}
|
||||
else {
|
||||
$data[5] = '';
|
||||
}
|
||||
array_push ($table->data, $data);
|
||||
|
||||
//Hiden row with description form
|
||||
$string = '<form method="post" action="'.$url.'&section=list">';
|
||||
$string .= '<table border="0" style="width:80%; margin-left: 10%;"><tr><td align="left" valign="top" width="30px">';
|
||||
$string .= '<td align="right"><b>' . __('Comment:') . '</b></td>';
|
||||
$string .= '<td align="left" width="450px"><b>' . print_textarea("comment_".$event["id_evento"], 2, 10, '', 'style="min-height: 10px; width: 250px;"', true) . '</b></td>';
|
||||
$string .= '<td align="left" width="200px">';
|
||||
$string .= '<div style="text-align:center;">';
|
||||
if($event["estado"] == 0) {
|
||||
$string .= print_select(array('1' => __('Validate'), '2' => __('Set in process')), 'select_validate_'.$event["id_evento"], '', '', '', 0, true, false, false, 'select_validate').'<br><br>';
|
||||
}
|
||||
$string .= '<a class="validate_event" href="javascript: toggleCommentForm(' . $event['id_evento'] . ')" id="validate-'.$event["id_evento"].'">';
|
||||
if($event["estado"] == 2) {
|
||||
$string .= print_button (__('Validate'), 'validate', false, '', 'class="sub ok validate_event" id="validate-'.$event["id_evento"].'"', true).'</div>';
|
||||
}else {
|
||||
$string .= print_button (__('Change status'), 'validate', false, '', 'class="sub ok validate_event" id="validate-'.$event["id_evento"].'"', true).'</div>';
|
||||
}
|
||||
$string .= '</a>';
|
||||
$string .= '</td><td width="400px">';
|
||||
if($event["id_alert_am"] != 0) {
|
||||
$string .= '<div class="standby_alert_checkbox" style="display: none">'.__('Set alert on standby').'<br>'.print_checkbox('standby-alert-'.$event["id_evento"], 'ff2', false, true).'</div>';
|
||||
}
|
||||
$string .= '</td></tr></table></form>';
|
||||
|
||||
$data = array($string);
|
||||
|
||||
$idx++;
|
||||
|
||||
$table->rowclass[$idx] = 'event_form_' . $event["id_evento"].' event_form';
|
||||
$table->colspan[$idx][0] = 10;
|
||||
$table->rowstyle[$idx] = 'display: none;';
|
||||
array_push ($table->data, $data);
|
||||
|
||||
//Hiden row with extended description
|
||||
$string = '<table border="0" width="90%"><tr>';
|
||||
$string .= '<td align="left" valign="top" width="25%">';
|
||||
$string .= '<b>' . __('Event name') . ':</b></td><td align="left">';
|
||||
$string .= $event["evento"];
|
||||
$string .= '</td></tr><tr>';
|
||||
$string .= '<td align="left" valign="top" width="15%">';
|
||||
$string .= '<b>' . __('Severity') . ':</b></td><td align="left">';
|
||||
$string .= print_image ($img_sev, true,
|
||||
array ("class" => "image_status",
|
||||
"width" => 12,
|
||||
"height" => 12,
|
||||
"title" => get_priority_name ($event["criticity"])));
|
||||
$string .= ' '.get_priority_name ($event["criticity"]);
|
||||
$string .= '</td></tr><tr>';
|
||||
$string .= '<td align="left" valign="top" width="15%">';
|
||||
$string .= '<b>' . __('Type') . ':</b></td><td align="left">';
|
||||
$string .= print_event_type_img ($event["event_type"], true).' '.print_event_type_description($event["event_type"], true);
|
||||
$string .= '</td></tr><tr>';
|
||||
$string .= '<td align="left" valign="top" width="15%">';
|
||||
$string .= '<b>' . __('Agent name') . ':</b></td><td align="left">';
|
||||
$string .= print_agent_name ($event["id_agente"], true);
|
||||
$string .= '</td></tr><tr>';
|
||||
|
||||
|
||||
if ($event["id_agentmodule"] != 0) {
|
||||
$string .= '<td align="left" valign="top" width="15%">';
|
||||
$string .= '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$event["id_agente"].'&tab=data">';
|
||||
$string .= '<b>' . __('Agent module source') . ':</b></td><td align="left">';
|
||||
$string .= print_image ("images/bricks.png", true,
|
||||
array ("title" => __('Go to data overview')));
|
||||
$string .= '</a></td></tr><tr>';
|
||||
}
|
||||
|
||||
if ($event["id_alert_am"] != 0) {
|
||||
$string .= '<td align="left" valign="top" width="15%">';
|
||||
$string .= '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$event["id_agente"].'&tab=alert">';
|
||||
$string .= '<b>' . __('Alert source') . ':</b></td><td align="left">';
|
||||
$standby = get_db_value('standby', 'talert_template_modules', 'id', $event["id_alert_am"]);
|
||||
if(!$standby) {
|
||||
$string .= print_image ("images/bell.png", true,
|
||||
array ("title" => __('Go to data overview')));
|
||||
}else {
|
||||
$string .= print_image ("images/bell_pause.png", true,
|
||||
array ("title" => __('Go to data overview')));
|
||||
}
|
||||
|
||||
$string .= '</a></td></tr><tr>';
|
||||
}
|
||||
|
||||
$string .= '<td align="left" valign="top" width="15%">';
|
||||
$string .= '<b>' . __('Group') . ':</b></td><td align="left">';
|
||||
$string .= print_group_icon ($event["id_grupo"], true);
|
||||
$string .= ' '. get_group_name ($event["id_grupo"], true);
|
||||
$string .= '</td></tr><tr>';
|
||||
$string .= '<td align="left" valign="top" width="15%">';
|
||||
if ($group_rep == 0) {
|
||||
$string .= '<b>' . __('User ID') . ':</b></td><td align="left">';
|
||||
} else {
|
||||
$string .= '<b>' . __('Count') . ':</b></td><td align="left">';
|
||||
}
|
||||
|
||||
if ($group_rep == 1) {
|
||||
$string .= $event["event_rep"];
|
||||
}
|
||||
else {
|
||||
if (!empty ($event["estado"])) {
|
||||
if ($event["id_usuario"] != '0' && $event["id_usuario"] != '' && $event["id_usuario"] != 'system' && $event["id_usuario"] != "System"){
|
||||
$string .= '<a href="index.php?sec=usuarios&sec2=operation/users/user_edit&id='.$event["id_usuario"].'" title="'.get_user_fullname ($event["id_usuario"]).'">'.mb_substr ($event["id_usuario"],0,8).'</a>';
|
||||
}
|
||||
else {
|
||||
$string .= __('System');
|
||||
}
|
||||
}
|
||||
else {
|
||||
$string .= '<i>- ' . __('Empty') . ' -</i>';
|
||||
}
|
||||
}
|
||||
$string .= '</td></tr>';
|
||||
$string .= '<tr><td align="left" valign="top">' . '<b>' . __('Comments') . ':</td><td align="left">';
|
||||
if($event["user_comment"] != '') {
|
||||
$string .= $event["user_comment"];
|
||||
} else {
|
||||
$string .= '<i>- ' . __('Empty') . ' -</i>';
|
||||
}
|
||||
|
||||
$string .= '</td></tr>';
|
||||
$string .= '</table>';
|
||||
|
||||
$data = array($string);
|
||||
|
||||
$idx++;
|
||||
|
||||
$table->rowclass[$idx] = 'event_info_' . $event["id_evento"].' event_info';
|
||||
$table->colspan[$idx][0] = 10;
|
||||
$table->rowstyle[$idx] = 'display: none;';
|
||||
array_push ($table->data, $data);
|
||||
|
||||
$idx++;
|
||||
}
|
||||
|
||||
echo '<div id="events_list">';
|
||||
if (!empty ($table->data)) {
|
||||
pagination ($total_events, $url."&pure=".$config["pure"], $offset, $pagination);
|
||||
|
||||
echo '<form method="post" action="'.$url.'&section=validate">';
|
||||
|
||||
print_table ($table);
|
||||
|
||||
echo '<div style="width:'.$table->width.';" class="action-buttons">';
|
||||
if (give_acl ($config["id_user"], 0, "IW") == 1) {
|
||||
print_submit_button (__('Change status'), 'validate_btn', false, 'class="sub ok"');
|
||||
}
|
||||
if (give_acl ($config["id_user"], 0,"IM") == 1) {
|
||||
print_submit_button (__('Delete'), 'delete', false, 'class="sub delete"');
|
||||
}
|
||||
echo '</div></form>';
|
||||
|
||||
}
|
||||
else {
|
||||
echo '<div class="nf">'.__('No events').'</div>';
|
||||
}
|
||||
echo '</div>';
|
||||
|
||||
unset ($table);
|
||||
|
||||
?>
|
|
@ -0,0 +1,84 @@
|
|||
<?php
|
||||
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
|
||||
// Please see http://pandorafms.org for full contribution list
|
||||
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation for version 2.
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
|
||||
// Load global vars
|
||||
global $config;
|
||||
|
||||
require_once ("include/functions_events.php"); //Event processing functions
|
||||
require_once ("include/functions_alerts.php"); //Alerts processing functions
|
||||
|
||||
check_login ();
|
||||
|
||||
if (! give_acl ($config["id_user"], 0, "IR")) {
|
||||
audit_db ($config["id_user"], $_SERVER['REMOTE_ADDR'], "ACL Violation",
|
||||
"Trying to access event viewer");
|
||||
require ("general/noaccess.php");
|
||||
return;
|
||||
}
|
||||
|
||||
$ids = (array) get_parameter ("eventid", -1);
|
||||
|
||||
$url_val = "index.php?sec=eventos&sec2=operation/events/events&search=" .
|
||||
rawurlencode($search) . "&event_type=" . $event_type .
|
||||
"&severity=" . $severity . "&status=" . $status . "&ev_group=" .
|
||||
$ev_group . "&refr=" . $config["refr"] . "&id_agent=" .
|
||||
$id_agent . "&id_event=" . $id_event . "&pagination=" .
|
||||
$pagination . "&group_rep=" . $group_rep . "&event_view_hr=" .
|
||||
$event_view_hr . "&id_user_ack=" . $id_user_ack . "&offset=" . $offset . "&validate=1";
|
||||
|
||||
$event_list = "<b>".__('Events to validate').":</b>";
|
||||
|
||||
$event_list .= '';
|
||||
$event_list .= "<ul>";
|
||||
$any_alert = false;
|
||||
$any_inprocess = false;
|
||||
foreach($ids as $key => $id) {
|
||||
$event = get_event($id);
|
||||
$event_list .= "<il>".$event['evento']."</il><br>";
|
||||
if($event['id_alert_am'] != 0) {
|
||||
$any_alert = true;
|
||||
}
|
||||
if($event['estado'] == 2) {
|
||||
$any_inprocess = true;
|
||||
}
|
||||
}
|
||||
$event_list .= "</ul>";
|
||||
|
||||
//Hiden row with description form
|
||||
$string = '<form method="post" action="'.$url_val.'">';
|
||||
$string .= '<table border="0" style="width:80%; margin-left: 10%;"><tr><td align="left" valign="top" width="30px">';
|
||||
$string .= '<td align="right"><b>' . __('Comment:') . '</b></td>';
|
||||
$string .= print_input_hidden('eventid', implode(',',$ids), true);
|
||||
$string .= '<td align="left" width="450px"><b>' . print_textarea("comment", 2, 10, '', 'style="min-height: 10px; width: 250px;"', true) . '</b></td>';
|
||||
$string .= '<td align="left" width="200px">';
|
||||
$string .= '<div style="text-align:center;">';
|
||||
if(!$any_inprocess) {
|
||||
$string .= print_select(array('1' => __('Validate'), '2' => __('Set in process')), 'select_validate', '', '', '', 0, true, false, false, 'select_validate').'<br><br>';
|
||||
$string .= print_submit_button (__('Change status'), 'validate', false, 'class="sub ok validate_event" id="validate"', true).'</div>';
|
||||
}else {
|
||||
$string .= print_submit_button (__('Validate'), 'validate', false, 'class="sub ok validate_event" id="validate"', true).'</div>';
|
||||
}
|
||||
$string .= '</td><td width="400px">';
|
||||
if($any_alert) {
|
||||
$string .= '<div class="standby_alert_checkbox" style="display: none">'.__('Set alert on standby').'<br>'.print_checkbox('standby-alert', 'ff2', false, true).'</div>';
|
||||
}
|
||||
$string .= '</td></tr></table></form>';
|
||||
|
||||
echo $string;
|
||||
|
||||
echo "<br><br>".$event_list;
|
||||
|
||||
?>
|
|
@ -414,7 +414,7 @@ CREATE TABLE IF NOT EXISTS `tevento` (
|
|||
`id_agentmodule` int(10) NOT NULL default '0',
|
||||
`id_alert_am` int(10) NOT NULL default '0',
|
||||
`criticity` int(4) unsigned NOT NULL default '0',
|
||||
`user_comment` varchar(255) NOT NULL default '',
|
||||
`user_comment` text NOT NULL,
|
||||
PRIMARY KEY (`id_evento`),
|
||||
KEY `indice_1` (`id_agente`,`id_evento`),
|
||||
KEY `indice_2` (`utimestamp`,`id_evento`),
|
||||
|
|
Loading…
Reference in New Issue