2009-02-20 Evi Vanoost <vanooste@rcbi.rochester.edu>

* pandoradb_migrate_20_to_21.sql, pandoradb.sql: Fixed going up/down
	strings
	
	* godmode/setup/setup.php: Fixed event hours display
	
	* operation/events/events.php: Fixed several major bugs with pagination
	and the new event types.
	
	* include/functions.php, include/functions_ui.php, 
	include/functions_html.php: Moved pagination and print_help_tip to 
	functions_ui.php. Repeat id's are now fixed backwards compatible. 
	Also fixed a bug in print_select where type comparisons against would 
	fail since PHP evaluates strings to (int) 0
	
	* include/functions_events.php: Added print_event_type_img () and altered
	the other functions to work with it

git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1471 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
guruevi 2009-02-20 21:48:09 +00:00
parent 1d925146a5
commit beb130087a
12 changed files with 412 additions and 348 deletions

View File

@ -1,3 +1,22 @@
2009-02-20 Evi Vanoost <vanooste@rcbi.rochester.edu>
* pandoradb_migrate_20_to_21.sql, pandoradb.sql: Fixed going up/down
strings
* godmode/setup/setup.php: Fixed event hours display
* operation/events/events.php: Fixed several major bugs with pagination
and the new event types.
* include/functions.php, include/functions_ui.php,
include/functions_html.php: Moved pagination and print_help_tip to
functions_ui.php. Repeat id's are now fixed backwards compatible.
Also fixed a bug in print_select where type comparisons against would
fail since PHP evaluates strings to (int) 0
* include/functions_events.php: Added print_event_type_img () and altered
the other functions to work with it
2009-02-20 Esteban Sanchez <estebans@artica.es>
* styles/pandora.css: Added input.add to a list which was missing.

View File

@ -129,27 +129,26 @@ $table->data[13][1] = print_select ($file_styles, 'style', $config["style"], '',
$table->data[14][0] = __('Block size for pagination');
$table->data[14][1] = print_input_text ('block_size', $config["block_size"], '', 5, 5, true);
$table->data[14][0] = __('Default hours for event view');
$table->data[14][1] = print_input_text ('event_view_hr', $config["event_view_hr"], '', 5, 5, true);
$table->data[15][0] = __('Default hours for event view');
$table->data[15][1] = print_input_text ('event_view_hr', $config["event_view_hr"], '', 5, 5, true);
$table->data[15][0] = __('Timestamp or time comparation') . pandora_help ("time_stamp-comparation", true);
$table->data[15][1] = __('Comparation in rollover').' ';
$table->data[15][1] .= print_radio_button ('prominent_time', "timestamp", '', $config["prominent_time"], true);
$table->data[15][1] .= '<br />'.__('Timestamp in rollover').' ';
$table->data[15][1] .= print_radio_button ('prominent_time', "comparation", '', $config["prominent_time"], true);
$table->data[16][0] = __('Timestamp or time comparation') . pandora_help ("time_stamp-comparation", true);
$table->data[16][1] = __('Comparation in rollover').' ';
$table->data[16][1] .= print_radio_button ('prominent_time', "timestamp", '', $config["prominent_time"], true);
$table->data[16][1] .= '<br />'.__('Timestamp in rollover').' ';
$table->data[16][1] .= print_radio_button ('prominent_time', "comparation", '', $config["prominent_time"], true);
$table->data[16][0] = __('Time source') . pandora_help ("timesource", true);
$table->data[17][0] = __('Time source') . pandora_help ("timesource", true);
$sources["system"] = __('System');
$sources["sql"] = __('Database');
$table->data[16][1] = print_select ($sources, 'timesource', $config["timesource"], '', '', '', true);
$table->data[17][1] = print_select ($sources, 'timesource', $config["timesource"], '', '', '', true);
$table->data[17][0] = __('Automatic update check');
$table->data[17][1] = print_checkbox ('autoupdate', 1, $config["autoupdate"], true);
$table->data[18][0] = __('Automatic update check');
$table->data[18][1] = print_checkbox ('autoupdate', 1, $config["autoupdate"], true);
$table->data[18][0] = __('Enforce https');
$table->data[18][1] = print_checkbox ('https', 1, $config["https"], true);
$table->data[19][0] = __('Enforce https');
$table->data[19][1] = print_checkbox ('https', 1, $config["https"], true);
// 18
enterprise_hook ('load_snmpforward_enterprise');
echo '<form id="form_setup" method="POST" action="index.php?sec=gsetup&amp;sec2=godmode/setup/setup">';

View File

@ -258,125 +258,6 @@ function list_files ($directory, $stringSearch, $searchHandler, $return = false)
}
}
/**
* Prints a pagination menu to browse into a collection of data.
*
* @param int $count Number of elements in the collection.
* @param string $url URL of the pagination links. It must include all form
* values as GET form.
* @param int $offset Current offset for the pagination. Default value would be
* taken from $_REQUEST['offset']
* @param int $pagination Current pagination size. If a user requests a larger
* pagination than config["block_size"]
* @param bool $return Whether to return or print this
*
* @return string The pagination div or nothing if no pagination needs to be done
*/
function pagination ($count, $url, $offset = 0, $pagination = 0, $return = false) {
global $config;
if (empty ($pagination)) {
$pagination = $config["block_size"];
}
if (empty ($offset)) {
$offset = (int) get_parameter ('offset');
}
/* URL passed render links with some parameter
&offset - Offset records passed to next page
&counter - Number of items to be blocked
Pagination needs $url to build the base URL to render links, its a base url, like
" http://pandora/index.php?sec=godmode&sec2=godmode/admin_access_logs "
*/
$block_limit = 15; // Visualize only $block_limit blocks
if ($count <= $pagination) {
return false;
}
// If exists more registers than I can put in a page, calculate index markers
$index_counter = ceil($count/$pagination); // Number of blocks of block_size with data
$index_page = ceil($offset/$pagination)-(ceil($block_limit/2)); // block to begin to show data;
if ($index_page < 0)
$index_page = 0;
// This calculate index_limit, block limit for this search.
if (($index_page + $block_limit) > $index_counter)
$index_limit = $index_counter;
else
$index_limit = $index_page + $block_limit;
// This calculate if there are more blocks than visible (more than $block_limit blocks)
if ($index_counter > $block_limit )
$paginacion_maxima = 1; // If maximum blocks ($block_limit), show only 10 and "...."
else
$paginacion_maxima = 0;
// This setup first block of query
if ( $paginacion_maxima == 1)
if ($index_page == 0)
$inicio_pag = 0;
else
$inicio_pag = $index_page;
else
$inicio_pag = 0;
$output = '<div>';
// Show GOTO FIRST button
$output .= '<a href="'.$url.'&offset=0"><img src="images/control_start_blue.png" class="bot" /></a>&nbsp;';
// Show PREVIOUS button
if ($index_page > 0){
$index_page_prev= ($index_page-(floor($block_limit/2)))*$pagination;
if ($index_page_prev < 0)
$index_page_prev = 0;
$output .= '<a href="'.$url.'&offset='.$index_page_prev.'"><img src="images/control_rewind_blue.png" class="bot" /></a>';
}
$output .= "&nbsp;&nbsp;";
// Draw blocks markers
// $i stores number of page
for ($i = $inicio_pag; $i < $index_limit; $i++) {
$inicio_bloque = ($i * $pagination);
$final_bloque = $inicio_bloque + $pagination;
if ($final_bloque > $count){ // if upper limit is beyond max, this shouldnt be possible !
$final_bloque = ($i-1) * $pagination + $count-(($i-1) * $pagination);
}
$output .= "<span>";
$inicio_bloque_fake = $inicio_bloque + 1;
// To Calculate last block (doesnt end with round data,
// it must be shown if not round to block limit)
$output .= '<a href="'.$url.'&offset='.$inicio_bloque.'">';
if ($inicio_bloque == $offset) {
$output .= "<b>[ $i ]</b>";
} else {
$output .= "[ $i ]";
}
$output .= '</a></span>';
}
$output .= "&nbsp;&nbsp;";
// Show NEXT PAGE (fast forward)
// Index_counter stores max of blocks
if (($paginacion_maxima == 1) AND (($index_counter - $i) > 0)) {
$prox_bloque = ($i + ceil ($block_limit / 2)) * $pagination;
if ($prox_bloque > $count)
$prox_bloque = ($count -1) - $pagination;
$output .= '<a href="'.$url.'&offset='.$prox_bloque.'"><img class="bot" src="images/control_fastforward_blue.png" /></a>';
$i = $index_counter;
}
// if exists more registers than i can put in a page (defined by $block_size config parameter)
// get offset for index calculation
// Draw "last" block link, ajust for last block will be the same
// as painted in last block (last integer block).
if (($count - $pagination) > 0) {
$myoffset = floor (($count - 1) / $pagination) * $pagination;
$output .= '<a href="'.$url.'&offset='.$myoffset.'"><img class="bot" src="images/control_end_blue.png" /></a>';
}
// End div and layout
$output .= "</div>";
if ($return === false)
echo $output;
return $output;
}
/**
* Format a number with decimals and thousands separator.
*

View File

@ -225,32 +225,7 @@ function print_events_table ($filter = "", $limit = 10, $width = 440, $return =
}
/* Event type */
switch ($event["event_type"]) {
case "alert_recovered":
$data[1] = print_image ("images/error.png", true, array ("title" => __('Alert recovered')));
break;
case "alert_manual_validation":
$data[1] = print_image ("images/eye.png", true, array ("title" => __('Alert manually validated')));
break;
case "monitor_up":
$data[1] = print_image ("images/lightbulb.png", true, array ("title" => __('Monitor up')));
break;
case "monitor_down":
$data[1] = print_image ("images/lightbulb_off.png", true, array ("title" => __('Monitor down')));
break;
case "alert_fired":
$data[1] = print_image ("images/bell.png", true, array ("title" => __('Alert fired')));
break;
case "system";
$data[1] = print_image ("images/cog.png", true, array ("title" => __('System')));
break;
case "recon_host_detected";
$data[1] = print_image ("images/network.png", true, array ("title" => __('Host detected by recon server')));
break;
default:
$data[1] = print_image ("images/err.png", true, array ("title" => $event["event_type"]));
break;
}
$data[1] = print_event_type_img ($event["event_type"], true);
// Event description wrap around by default at 44 or ~3 lines (10 seems to be a good ratio to wrap around for most sizes. Smaller number gets longer strings)
$wrap = floor ($width / 10);
@ -263,7 +238,7 @@ function print_events_table ($filter = "", $limit = 10, $width = 440, $return =
if ($event["id_agente"] > 0) {
// Agent name
$data[3] = print_agent_name ($event["id_agente"], true, floor ($width / 20)); //At 440 this would be be 22
$data[3] = print_agent_name ($event["id_agente"], true, floor ($width / 20)); //At 440 this would be be 22.
// for System or SNMP generated alerts
} elseif ($event["event_type"] == "system") {
$data[3] = __('System');
@ -290,4 +265,43 @@ function print_events_table ($filter = "", $limit = 10, $width = 440, $return =
return $return;
}
}
/**
* Prints the event type image
*
* @param string $type Event type from SQL
* @param bool $return Whether to return or print
*
* @return string HTML with img
*/
function print_event_type_img ($type, $return = false) {
switch ($type) {
case "alert_recovered":
return print_image ("images/error.png", $return, array ("title" => __('Alert recovered')));
case "alert_manual_validation":
return print_image ("images/eye.png", $return, array ("title" => __('Alert manually validated')));
case "going_up_warning":
return print_image ("images/b_yellow.png", $return, array ("title" => __('Going from critical to warning')));
case "going_down_critical":
case "going_up_critical": //This is to be backwards compatible
return print_image ("images/b_red.png", $return, array ("title" => __('Going down to critical state')));
case "going_up_normal":
case "going_down_normal": //This is to be backwards compatible
return print_image ("images/b_green.png", $return, array ("title" => __('Going up to normal state')));
case "going_down_warning":
return print_image ("images/b_yellow.png", $return, array ("title" => __('Going down from normal to warning')));
case "alert_fired":
return print_image ("images/bell.png", $return, array ("title" => __('Alert fired')));
case "system";
return print_image ("images/cog.png", $return, array ("title" => __('SYSTEM')));
case "recon_host_detected";
return print_image ("images/network.png", $return, array ("title" => __('Recon server detected a new host')));
case "new_agent";
return print_image ("images/wand.png", $return, array ("title" => __('New agent created')));
case "unknown":
default:
return print_image ("images/err.png", $return, array ("title" => __('Unknown type:').': '.$type));
}
}
?>

View File

@ -39,6 +39,16 @@
function print_select ($fields, $name, $selected = '', $script = '', $nothing = '', $nothing_value = '0', $return = false, $multiple = false, $sort = true, $class = '', $disabled = false) {
$output = "\n";
static $idcounter = array ();
//If duplicate names exist, it will start numbering. Otherwise it won't (for backwards compatibility)
if (isset ($idcounter[$name])) {
$idcounter[$name]++;
$name = $name.$idcounter;
} else {
$idcounter[$name] = 0;
}
$attributes = "";
if (!empty ($script)) {
$attributes .= ' onchange="'.$script.'"';
@ -72,7 +82,7 @@ function print_select ($fields, $name, $selected = '', $script = '', $nothing =
$output .= '<option value="'.$value.'"';
if (is_array ($selected) && in_array ($value, $selected)) {
$output .= ' selected="selected"';
} elseif (!is_array ($selected) && $value == $selected) {
} elseif (!is_array ($selected) && $value === $selected) { //Needs type comparison otherwise if $selected = 0 and $value = "string" this would evaluate to true
$output .= ' selected="selected"';
}
if ($label === '') {
@ -292,7 +302,7 @@ function print_submit_button ($label = 'OK', $name = '', $disabled = false, $att
if (!$name) {
$name="unnamed";
}
$output = '<input type="submit" id="submit-'.$name.'" name="'.$name.'" value="'. $label .'" '. $attributes;
if ($disabled)
$output .= ' disabled="disabled"';
@ -345,6 +355,16 @@ function print_button ($label = 'OK', $name = '', $disabled = false, $script = '
* @return string HTML code if return parameter is true.
*/
function print_textarea ($name, $rows, $columns, $value = '', $attributes = '', $return = false) {
static $idcounter = array ();
//If duplicate names exist, it will start numbering. Otherwise it won't
if (isset ($idcounter[$name])) {
$idcounter[$name]++;
$name = $name.$idcounter;
} else {
$idcounter[$name] = 0;
}
$output = '<textarea id="textarea_'.$name.'" name="'.$name.'" cols="'.$columns.'" rows="'.$rows.'" '.$attributes.' >';
$output .= safe_input ($value);
$output .= '</textarea>';
@ -641,8 +661,18 @@ function print_radio_button ($name, $value, $label = '', $checkedvalue = '', $re
* @return string HTML code if return parameter is true.
*/
function print_checkbox_extended ($name, $value, $checked, $disabled, $script, $attributes, $return = false) {
static $idcounter = array ();
//If duplicate names exist, it will start numbering. Otherwise it won't
if (isset ($idcounter[$name])) {
$idcounter[$name]++;
$name = $name.$idcounter[$name];
} else {
$idcounter[$name] = 0;
}
$output = '<input name="'.$name.'" type="checkbox" value="'.$value.'" '. ($checked ? 'checked="checked"': '');
$output .= ' id="checkbox-'.$name.'"';
$output .= ' id="checkbox-'.str_replace (array ("[", "]"), '', $name).'"'; //[ and ] are some of those things that can't be in an id string. Add more where necessary
if ($script != '') {
$output .= ' onClick="'. $script . '"';
@ -677,23 +707,6 @@ function print_checkbox ($name, $value, $checked = false, $return = false) {
echo $output;
}
/**
* Prints only a tip button which shows a text when the user puts the mouse over it.
*
* @param string Complete text to show in the tip
* @param bool whether to return an output string or echo now
*
* @return string HTML code if return parameter is true.
*/
function print_help_tip ($text, $return = false) {
$output = '<a href="#" class="tip">&nbsp;<span>'.$text.'</span></a>';
if ($return)
return $output;
echo $output;
}
/**
* Prints an image HTML element.
*

View File

@ -652,4 +652,144 @@ function process_page_body ($string, $bitfield) {
return $output;
}
/**
* Prints a pagination menu to browse into a collection of data.
*
* @param int $count Number of elements in the collection.
* @param string $url URL of the pagination links. It must include all form
* values as GET form.
* @param int $offset Current offset for the pagination. Default value would be
* taken from $_REQUEST['offset']
* @param int $pagination Current pagination size. If a user requests a larger
* pagination than config["block_size"]
* @param bool $return Whether to return or print this
*
* @return string The pagination div or nothing if no pagination needs to be done
*/
function pagination ($count, $url, $offset = 0, $pagination = 0, $return = false) {
global $config;
if (empty ($pagination)) {
$pagination = $config["block_size"];
}
if (empty ($offset)) {
$offset = (int) get_parameter ('offset');
}
$url = safe_input ($url);
/* URL passed render links with some parameter
&offset - Offset records passed to next page
&counter - Number of items to be blocked
Pagination needs $url to build the base URL to render links, its a base url, like
" http://pandora/index.php?sec=godmode&sec2=godmode/admin_access_logs "
*/
$block_limit = 15; // Visualize only $block_limit blocks
if ($count <= $pagination) {
return false;
}
// If exists more registers than I can put in a page, calculate index markers
$index_counter = ceil($count/$pagination); // Number of blocks of block_size with data
$index_page = ceil($offset/$pagination)-(ceil($block_limit/2)); // block to begin to show data;
if ($index_page < 0)
$index_page = 0;
// This calculate index_limit, block limit for this search.
if (($index_page + $block_limit) > $index_counter)
$index_limit = $index_counter;
else
$index_limit = $index_page + $block_limit;
// This calculate if there are more blocks than visible (more than $block_limit blocks)
if ($index_counter > $block_limit )
$paginacion_maxima = 1; // If maximum blocks ($block_limit), show only 10 and "...."
else
$paginacion_maxima = 0;
// This setup first block of query
if ( $paginacion_maxima == 1)
if ($index_page == 0)
$inicio_pag = 0;
else
$inicio_pag = $index_page;
else
$inicio_pag = 0;
$output = '<div>';
// Show GOTO FIRST button
$output .= '<a href="'.$url.'&amp;offset=0">'.print_image ("images/control_start_blue.png", true, array ("class" => "bot")).'</a>&nbsp;';
// Show PREVIOUS button
if ($index_page > 0){
$index_page_prev= ($index_page-(floor($block_limit/2)))*$pagination;
if ($index_page_prev < 0)
$index_page_prev = 0;
$output .= '<a href="'.$url.'&amp;offset='.$index_page_prev.'">'.print_image ("images/control_rewind_blue.png", true, array ("class" => "bot")).'</a>';
}
$output .= "&nbsp;&nbsp;";
// Draw blocks markers
// $i stores number of page
for ($i = $inicio_pag; $i < $index_limit; $i++) {
$inicio_bloque = ($i * $pagination);
$final_bloque = $inicio_bloque + $pagination;
if ($final_bloque > $count){ // if upper limit is beyond max, this shouldnt be possible !
$final_bloque = ($i-1) * $pagination + $count-(($i-1) * $pagination);
}
$output .= "<span>";
$inicio_bloque_fake = $inicio_bloque + 1;
// To Calculate last block (doesnt end with round data,
// it must be shown if not round to block limit)
$output .= '<a href="'.$url.'&amp;offset='.$inicio_bloque.'">';
if ($inicio_bloque == $offset) {
$output .= "<b>[ $i ]</b>";
} else {
$output .= "[ $i ]";
}
$output .= '</a></span>';
}
$output .= "&nbsp;&nbsp;";
// Show NEXT PAGE (fast forward)
// Index_counter stores max of blocks
if (($paginacion_maxima == 1) AND (($index_counter - $i) > 0)) {
$prox_bloque = ($i + ceil ($block_limit / 2)) * $pagination;
if ($prox_bloque > $count)
$prox_bloque = ($count -1) - $pagination;
$output .= '<a href="'.$url.'&amp;offset='.$prox_bloque.'">'.print_image ("images/control_fastforward_blue.png", true, array ("class" => "bot")).'</a>';
$i = $index_counter;
}
// if exists more registers than i can put in a page (defined by $block_size config parameter)
// get offset for index calculation
// Draw "last" block link, ajust for last block will be the same
// as painted in last block (last integer block).
if (($count - $pagination) > 0) {
$myoffset = floor (($count - 1) / $pagination) * $pagination;
$output .= '<a href="'.$url.'&amp;offset='.$myoffset.'">'.print_image ("images/control_end_blue.png", true, array ("class" => "bot")).'</a>';
}
// End div and layout
$output .= "</div>";
if ($return === false)
echo $output;
return $output;
}
/**
* Prints only a tip button which shows a text when the user puts the mouse over it.
*
* @param string Complete text to show in the tip
* @param bool whether to return an output string or echo now
*
* @return string HTML code if return parameter is true.
*/
function print_help_tip ($text, $return = false) {
$output = '<a href="#" class="tip">&nbsp;<span>'.$text.'</span></a>';
if ($return)
return $output;
echo $output;
}
?>

View File

@ -50,9 +50,10 @@ if (!empty ($validate)) {
// Main code form / page
// ***********************************************************************
$offset = (int) get_parameter ( "offset",0);
$offset = (int) get_parameter ( "offset", 0);
$ev_group = (int) get_parameter ("ev_group", 1); //1 = all
$search = get_parameter ("search", ""); // free search
$search = preg_replace ("/&([A-Za-z]{0,4}\w{2,3};|#[0-9]{2,3};)/", "%", rawurldecode (get_parameter ("search"))); //Replace all types of &# HTML with % so that it doesn't fail on quotes
$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
@ -61,7 +62,7 @@ $id_event = (int) get_parameter ("id_event", -1);
$pagination = (int) get_parameter ("pagination", $config["block_size"]);
$groups = get_user_groups ($config["id_user"], "IR");
$event_view_hr = (int) get_parameter ("event_view_hr", $config["event_view_hr"]);
$id_user_ack = (int) get_parameter ("id_user_ack", 0);
$id_user_ack = get_parameter ("id_user_ack", 0);
$group_rep = (int) get_parameter ("group_rep", 1);
//Group selection
@ -84,9 +85,9 @@ if ($status == 1) {
}
if ($search != "")
$sql_post .= " AND evento LIKE '%$search%'";
$sql_post .= " AND evento LIKE '%".$search."%'";
if ($event_type != "")
$sql_post .= " AND event_type = '$event_type'";
$sql_post .= " AND event_type = '".$event_type."'";
if ($severity != -1)
$sql_post .= " AND criticity >= ".$severity;
if ($id_agent != -1)
@ -94,30 +95,38 @@ if ($id_agent != -1)
if ($id_event != -1)
$sql_post .= " AND id_evento = ".$id_event;
if ($id_user_ack != 0)
$sql_post .= " AND id_usuario == '$id_user_ack' ";
$sql_post .= " AND id_usuario == '".$id_user_ack."'";
$unixtime = date("U") - ($event_view_hr*60*60);
$sql_post .= " AND utimestamp > $unixtime ";
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=$search&event_type=$event_type&severity=$severity&status=$status&ev_group=$ev_group&refr=60&id_agent=$id_agent&id_event=$id_event&pagination=$pagination&group_rep=$group_rep";
$url = "index.php?sec=eventos&amp;sec2=operation/events/events&amp;search=".rawurlencode($search)."&amp;event_type=".$event_type."&amp;severity=".$severity."&amp;status=".$status."&amp;ev_group=".$ev_group."&amp;refr=".$config["refr"]."&amp;id_agent=".$id_agent."&amp;id_event=".$id_event."&amp;pagination=".$pagination."&amp;group_rep=".$group_rep."&amp;event_view_hr=".$event_view_hr."&amp;id_user_ack=".$id_user_ack;
echo "<h2>".__('Events')." &gt; ".__('Main event view'). "&nbsp";
echo "<h2>".__('Events')." &gt; ".__('Main event view'). "&nbsp;";
if ($config["pure"] == 1) {
echo "<a target='_top' href='$url&pure=0'><img src='images/monitor.png' title='".__('Normal screen')."'></a>";
echo '<a target="_top" href="'.$url.'&amp;pure=0">';
print_image ("images/monitor.png", false, array ("title" => __('Normal screen')));
echo '</a>';
} else {
// Fullscreen
echo "<a target='_top' href='$url&pure=1'><img src='images/monitor.png' title='".__('Full screen')."'></a>";
echo '<a target="_top" href="'.$url.'&amp;pure=1">';
print_image ("images/monitor.png", false, array ("title" => __('Full screen')));
echo '</a>';
}
echo "</h2>";
echo '<a href="#" id="tgl_event_control"><b>'.__('Event control filter').'</b>&nbsp;'.'<img src="images/wand.png" /></a>';
//Link to toggle filter
echo '<a href="#" id="tgl_event_control"><b>'.__('Event control filter').'</b>&nbsp;'.print_image ("images/wand.png", true, array ("title" => __('Toggle filter'))).'</a>';
echo '<div id="event_control" style="display:none">';
//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=60&pure='.$config["pure"].'">';
echo '<table style="width:550px; float:left;" cellpadding="4" cellspacing="4" class="databox"><tr>';
echo '<form method="post" action="index.php?sec=eventos&amp;sec2=operation/events/events&amp;refr='.$config["refr"].'&amp;pure='.$config["pure"].'">';
echo '<table style="float:left;" width="550" cellpadding="4" cellspacing="4" class="databox"><tr>';
// Group combo
echo "<td>".__('Group')."</td><td>";
@ -153,10 +162,12 @@ echo '</td>';
//Agent search
echo "<td>".__('Agent search')."</td><td>";
$sql = "SELECT DISTINCT(id_agente) FROM tevento WHERE 1=1 ".$sql_post;
$sql = "SELECT DISTINCT(id_agente) AS id_agent FROM tevento WHERE 1=1 ".$sql_post;
$result = get_db_all_rows_sql ($sql);
if ($result === false)
$result = array();
$agents = array ();
$agents[-1] = __('All');
@ -166,10 +177,11 @@ if (dame_admin ($config["id_user"])) {
foreach ($result as $id_row) {
$name_for_combo = "";
if ($id_row[0] > 0)
$name_for_combo = substr (get_agent_name ($id_row[0], "lower"),0,20);
if ($id_row["id_agent"] > 0)
$name_for_combo = mb_substr (get_agent_name ($id_row["id_agent"], "lower"),0,20);
if ($name_for_combo != "")
$agents[$id_row[0]] = $name_for_combo;
$agents[$id_row["id_agent"]] = $name_for_combo;
}
print_select ($agents, 'id_agent', $id_agent, 'javascript:this.form.submit();', '', '');
@ -195,15 +207,11 @@ print_input_text ('event_view_hr', $event_view_hr, '', 5);
echo "</td>";
echo "<tr>";
echo "</tr><tr>";
echo "<td>".__('User ack.')."</td>";
echo "<td>";
$users = get_users ();
$values = array ();
foreach ($users as $id_user => $user) {
$values[$id_user] = $user['id_user'];
}
print_select ($values, "id_user_ack", $id_user_ack, '', __('Any'), 0);
$users = get_users_info ();
print_select ($users, "id_user_ack", $id_user_ack, 'javascript:this.form.submit();', __('Any'), 0);
echo "</td>";
echo "<td>";
@ -212,45 +220,50 @@ echo "</td><td>";
$repeated_sel[0] = __("All events");
$repeated_sel[1] = __("Group events");
print_select ($repeated_sel, "group_rep", $group_rep);
print_select ($repeated_sel, "group_rep", $group_rep, 'javascript:this.form.submit();');
echo "</td></tr>";
echo "<tr><td colspan=4 align=right>";
echo '<tr><td colspan="4" style="text-align:right">';
//The buttons
print_submit_button (__('Update'), '', false, 'class="sub upd"');
// CSV
echo '&nbsp;&nbsp;&nbsp;
<a href="operation/events/export_csv.php?ev_group='.$ev_group.'&event_type='.$event_type.'&search='.$search.'&severity='.$severity.'&status='.$status.'&id_agent='.$id_agent.'">
<img src="images/disk.png" title="Export to CSV file" /></a>';
echo '&nbsp;&nbsp;&nbsp;<a href="operation/events/export_csv.php?ev_group='.$ev_group.'&amp;event_type='.$event_type.'&amp;search='.rawurlencode ($search).'&amp;severity='.$severity.'&amp;status='.$status.'&amp;id_agent='.$id_agent.'">';
print_image ("images/disk.png", false, array ("title" => __('Export to CSV file')));
echo '</a>';
// Marquee
echo '&nbsp;<a target="_top" href="operation/events/events_marquee.php"><img src="images/heart.png" title="'.__('Marquee display').'" /></a>';
echo '&nbsp;<a target="_top" href="operation/events/events_marquee.php">';
print_image ("images/heart.png", false, array ("title" => __('Marquee display')));
echo '</a>';
// RSS
echo '&nbsp;<a target="_top" href="operation/events/events_rss.php?ev_group='.$ev_group.'&event_type='.$event_type.'&search='.$search.'&severity='.$severity.'&status='.$status.'&id_agent='.$id_agent.'"><img src="images/transmit.png" title="'.__('RSS Events').'" /></a>';
echo '&nbsp;<a target="_top" href="operation/events/events_rss.php?ev_group='.$ev_group.'&amp;event_type='.$event_type.'&amp;search='.rawurlencode ($search).'&amp;severity='.$severity.'&amp;status='.$status.'&amp;id_agent='.$id_agent.'">';
print_image ("images/transmit.png", false, array ("title" => __('RSS Events')));
echo '</a>';
echo "</td></tr></table></form>"; //This is the internal table
echo '<div style="width:220px; float:left;"><img src="reporting/fgraph.php?tipo=group_events&width=220&height=180&url='.rawurlencode ($sql_post).'" border="0"></div>';
echo "</td></tr></table></form></div>"; //This is the filter div
echo '<div style="width:220px; float:left;">';
print_image ("reporting/fgraph.php?tipo=group_events&width=220&height=180&url=".rawurlencode ($sql_post), false, array ("border" => 0));
echo '</div><div style="clear:both">&nbsp;</div>';
if ($group_rep == 0)
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(timestamp) AS timestamp_rep FROM tevento WHERE 1=1 ".$sql_post." GROUP BY evento, id_agentmodule ORDER BY timestamp_rep 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;
}
$result = get_db_all_rows_sql ($sql);
if ($group_rep == 0)
$sql = "SELECT COUNT(id_evento) FROM tevento WHERE id_evento > 0 ".$sql_post;
else
$sql = "SELECT COUNT(id_evento) FROM tevento WHERE id_evento > 0 ".$sql_post." GROUP BY evento, id_agentmodule";
$total_events = get_db_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;
}
$total_events = (int) get_db_sql ($sql);
if (empty ($result)) {
$result = array ();
}
if (empty ($total_events)) {
$total_events = 0;
}
// Show pagination header
$offset = get_parameter ("offset", 0);
@ -288,10 +301,11 @@ $table->align[4] = 'center';
$table->head[5] = __('Group');
$table->align[5] = 'center';
if ($group_rep == 0)
if ($group_rep == 0) {
$table->head[6] = __('User ID');
else
} else {
$table->head[6] = __('Rep');
}
$table->align[6] = 'center';
$table->head[7] = __('Timestamp');
@ -312,55 +326,18 @@ foreach ($result as $row) {
// Colored box
if ($row["estado"] == 0) {
$data[0] = '<img src="images/pixel_red.png" width="20" height="20" title="'.get_priority_name ($row["criticity"]).'" />';
$data[0] = print_image ("images/pixel_red.png", true, array ("width" => 20, "height" => 20, "title" => get_priority_name ($row["criticity"])));
} else {
$data[0] = '<img src="images/pixel_green.png" width="20" height="20" title="'.get_priority_name ($row["criticity"]).'" />';
$data[0] = print_image ("images/pixel_green.png", true, array ("width" => 20, "height" => 20, "title" => get_priority_name ($row["criticity"])));
}
switch ($row["event_type"]) {
case "alert_recovered":
$data[1] = '<img src="images/error.png" title="'.__('Alert Recovered').'" />';
break;
case "alert_manual_validation":
$data[1] = '<img src="images/eye.png" title="'.__('Manual Alert Validation').'" />';
break;
case "going_up_warning":
$data[1] = '<img src="images/b_yellow.png" title="'.__('Going up Warning').'" />';
break;
case "going_up_critical":
$data[1] = '<img src="images/b_red.png" title="'.__('Going up Critical').'" />';
break;
case "going_down_normal":
$data[1] = '<img src="images/b_green.png" title="'.__('Going to Normal').'" />';
break;
case "going_down_warning":
$data[1] = '<img src="images/b_yellow.png" title="'.__('Going down Warning').'" />';
break;
case "alert_fired":
$data[1] = '<img src="images/bell.png" title="'.__('Alert Fired').'" />';
break;
case "system";
$data[1] = '<img src="images/cog.png" title="'.__('System').'" />';
break;
case "recon_host_detected";
$data[1] = '<img src="images/network.png" title="'.__('Host Detected (Recon)').'" />';
break;
case "new_agent";
$data[1] = '<img src="images/wand.png" title="'.__('New Agent').'" />';
break;
case "unknown":
default:
$data[1] = '<img src="images/err.png" title="'.__('Unknown type').': '.$row["event_type"].'" />';
break;
}
$data[1] = print_event_type_img ($row["event_type"], true);
// Event description
$data[2] = '<span title="'.$row["evento"].'" class="f9">';
$data[2] .= "<a href='$url&group_rep=0&id_agent=".$row["id_agente"]."&pure=".$config["pure"]."&search=".$row["evento"]."'>";
$data[2] .= '<a href="'.$url.'&amp;group_rep=0&amp;id_agent='.$row["id_agente"].'&amp;pure='.$config["pure"].'&amp;search='.rawurlencode ($row["evento"]).'">';
if (strlen ($row["evento"]) > 50) {
$data[2] .= substr ($row["evento"], 0, 50)."...";
$data[2] .= mb_substr ($row["evento"], 0, 50)."...";
} else {
$data[2] .= $row["evento"];
}
@ -370,36 +347,33 @@ foreach ($result as $row) {
$data[3] = __('System');
} elseif ($row["id_agente"] > 0) {
// Agent name
$agent_name = get_agent_name ($row["id_agente"]);
$data[3] = '<a href='.$url.'&pure='.$config["pure"].'&id_agent='.$row["id_agente"].'" title="'.$agent_name.'" class="f9"><b>';
if (strlen ($agent_name) > 16) {
$data[3] .= substr ($agent_name, 0, 14)."...";
} else {
$data[3] .= $agent_name;
}
$data[3] .= '</b></a>';
$data[3] = print_agent_name ($row["id_agente"], true);
} else {
$data[3] = __('Alert').__('SNMP');
}
$data[4] = '';
if ($row["id_agentmodule"] != 0) {
$data[4] .= '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$row["id_agente"].'&tab=data"><img src="images/bricks.png" border="0" /></a>&nbsp;';
$data[4] .= '<a href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente='.$row["id_agente"].'&amp;tab=data">';
$data[4] .= print_image ("images/bricks.png", true, array ("border" => 0, "title" => __('Go to data overview')));
$data[4] .= '</a>&nbsp;';
}
if ($row["id_alert_am"] != 0) {
$data[4] .= '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$row["id_agente"].'&tab=alert"><img src="images/bell.png" border="0" /></a>';
$data[4] .= '<a href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente='.$row["id_agente"].'&amp;tab=alert">';
$data[4] .= print_image ("images/bell.png", true, array ("border" => 0, "title" => __('Go to alert overview')));
$data[4] .= '</a>';
}
$data[5] = print_group_icon ($row["id_grupo"], true);
if ($group_rep == 1)
$data[6] = $row["event_rep"];
else {
if ($group_rep == 1) {
$data[6] = $row["event_rep"];
} else {
if (!empty ($row["estado"])) {
if ($row["id_usuario"] != '0' && $row["id_usuario"] != ''){
$data[6] = '<a href="index.php?sec=usuario&sec2=operation/user/user_edit&ver='.$row["id_usuario"].'" title="'.dame_nombre_real ($row["id_usuario"]).'">'.substr ($row["id_usuario"],0,8).'</a>';
$data[6] = '<a href="index.php?sec=usuario&amp;sec2=operation/user/user_edit&amp;ver='.$row["id_usuario"].'" title="'.dame_nombre_real ($row["id_usuario"]).'">'.mb_substr ($row["id_usuario"],0,8).'</a>';
} else {
$data[6]=__('System');
$data[6] = __('System');
}
} else {
$data[6] = '';
@ -408,7 +382,7 @@ foreach ($result as $row) {
//Time
if ($group_rep == 1){
if ($group_rep == 1) {
$data[7] = print_timestamp ($row['timestamp_rep'], true);
} else {
$data[7] = print_timestamp ($row["timestamp"], true);
@ -418,15 +392,21 @@ foreach ($result as $row) {
$data[8] = '';
// Validate event
if (($row["estado"] == 0) and (give_acl ($config["id_user"], $row["id_grupo"], "IW") == 1)) {
$data[8] .= '<a href="'.$url.'&validate=1&eventid='.$row["id_evento"].'&pure='.$config["pure"].'"><img src="images/ok.png" border="0" /></a>';
$data[8] .= '<a href="'.$url.'&amp;validate=1&amp;eventid='.$row["id_evento"].'&amp;pure='.$config["pure"].'">';
$data[8] .= print_image ("images/ok.png", true, array ("border" => 0, "title" => __('Validate event')));
$data[8] .= '</a>';
}
// Delete event
if (give_acl ($config["id_user"], $row["id_grupo"], "IM") == 1) {
$data[8] .= '<a href="'.$url.'&delete=1&eventid='.$row["id_evento"].'&pure='.$config["pure"].'"><img src="images/cross.png" border="0" /></a>';
$data[8] .= '<a href="'.$url.'&amp;delete=1&amp;eventid='.$row["id_evento"].'&amp;pure='.$config["pure"].'">';
$data[8] .= print_image ("images/cross.png", true, array ("border" => 0, "title" => __('Delete event')));
$data[8] .= '</a>';
}
// Create incident from this event
if (give_acl ($config["id_user"], $row["id_grupo"], "IW") == 1) {
$data[8] .= '<a href="index.php?sec=incidencias&sec2=operation/incidents/incident_detail&insert_form&from_event='.$row["id_evento"].'"><img src="images/page_lightning.png" border="0" /></a>';
$data[8] .= '<a href="index.php?sec=incidencias&amp;sec2=operation/incidents/incident_detail&amp;insert_form&amp;from_event='.$row["id_evento"].'">';
$data[8] .= print_image ("images/page_lightning.png", true, array ("border" => 0, "title" => __('Create incident from event')));
$data[8] .= '</a>';
}
//Checkbox
@ -435,15 +415,12 @@ foreach ($result as $row) {
array_push ($table->data, $data);
}
if (!empty ($table->data)) {
echo '<form method="post" action="'.$url.'&amp;pure='.$config["pure"].'">';
echo '<form method="post" action="'.$url.'&pure='.$config["pure"].'">';
if (!empty ($table->data))
print_table ($table);
if (empty ($table->data))
echo '<div style="visibility:hidden; width:750px; text-align:right">';
else
echo '<div style="width:750px; text-align:right">';
print_table ($table);
echo '<div style="width:750px; text-align:right">';
if (give_acl ($config["id_user"], 0, "IW") == 1) {
print_submit_button (__('Validate'), 'validate', false, 'class="sub ok"');
}
@ -451,41 +428,47 @@ foreach ($result as $row) {
print_submit_button (__('Delete'), 'delete', false, 'class="sub delete"');
}
echo '</div></form>';
echo '<script language="JavaScript" type="text/javascript">
$(document).ready( function() {
$("INPUT[name=\'allbox\']").click( function() {
$("INPUT[name=\'eventid[]\']").each( function() {
$(this).attr(\'checked\', !$(this).attr(\'checked\'));
});
return !(this).attr(\'checked\');
});
$("#tgl_event_control").click( function () {
$("#event_control").slideToggle ("slow");
});
});
</script>';
if (!empty ($table->data)){
if ($config["pure"]== 0) {
echo '<div style="padding-left:30px; width:150px; float:left; line-height:17px;">';
echo '<h3>'.__('Status').'</h3>';
echo '<img src="images/pixel_green.png" width="10" height="10" /> - '.__('Validated event');
echo '<br />';
echo '<img src="images/pixel_red.png" width="10" height="10" /> - '.__('Not validated event');
echo '</div><div style="padding-left:30px; width:150px; float:left; line-height:17px;">';
echo '<h3>'.__('Action').'</h3>';
echo '<img src="images/ok.png" /> - '.__('Validate event');
echo '<br />';
echo '<img src="images/cross.png" /> - '.__('Delete event');
echo '<br />';
echo '<img src="images/page_lightning.png" /> - '.__('Create incident');
echo '</div><div style="clear:both;">&nbsp;</div>';
}
}
else
echo '<div class="nf">'.__('No events').'</div>';
if ($config["pure"]== 0) {
//Print legend
echo '<div style="padding-left:30px; width:150px; float:left; line-height:17px;">';
echo '<h3>'.__('Status').'</h3>';
print_image ("images/pixel_green.png", false, array ("width" => 10, "height" => 10, "title" => __('Validated event')));
echo ' - '.__('Validated event');
echo '<br />';
print_image ("images/pixel_red.png", false, array ("width" => 10, "height" => 10, "title" => __('Event not validated')));
echo ' - '.__('Event not validated');
echo '</div><div style="padding-left:30px; width:150px; float:left; line-height:17px;">';
echo '<h3>'.__('Actions').'</h3>';
print_image ("images/ok.png", false, array ("title" => __('Validate event')));
echo ' - '.__('Validate event');
echo '<br />';
print_image ("images/cross.png", false, array ("title" => __('Delete event')));
echo ' - '.__('Delete event');
echo '<br />';
print_image ("images/page_lightning.png", false, array ("title" => __('Create incident from event')));
echo ' - '.__('Create incident from event');
echo '</div><div style="clear:both;">&nbsp;</div>';
}
} else {
echo '<div class="nf">'.__('No events').'</div>';
}
unset ($table);
?>
<script language="javascript" type="text/javascript">
/* <![CDATA[ */
$(document).ready( function() {
$("INPUT[name='allbox']").click( function() {
$("INPUT[name='eventid[]']").each( function() {
$(this).attr('checked', !$(this).attr('checked'));
});
return !(this).attr('checked');
});
$("#tgl_event_control").click( function () {
$("#event_control").toggle ();
return false;
});
});
/* ]]> */
</script>

View File

@ -382,7 +382,7 @@ CREATE TABLE IF NOT EXISTS `tevento` (
`timestamp` datetime NOT NULL default '0000-00-00 00:00:00',
`evento` varchar(255) NOT NULL default '',
`utimestamp` bigint(20) NOT NULL default '0',
`event_type` enum('unknown','alert_fired','alert_recovered','alert_ceased','alert_manual_validation','recon_host_detected','system','error','new_agent','going_up_warning','going_up_critical','going_down_warning','going_down_normal') default 'unknown',
`event_type` enum('unknown','alert_fired','alert_recovered','alert_ceased','alert_manual_validation','recon_host_detected','system','error','new_agent','going_up_warning','going_up_critical','going_down_warning','going_down_normal','going_down_critical','going_up_normal') default 'unknown',
`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',

View File

@ -274,3 +274,7 @@ ALTER TABLE treport_content ADD `id_agent` int(10) unsigned NOT NULL default 0;
-- Changes added 19 February 2009
ALTER TABLE `tmensajes` CHANGE `timestamp` `timestamp` BIGINT( 20 ) UNSIGNED NOT NULL DEFAULT '0'
-- Changes added 20 February 2009
ALTER TABLE `tevento` CHANGE `event_type` `event_type` ENUM( 'unknown', 'alert_fired', 'alert_recovered', 'alert_ceased', 'alert_manual_validation', 'recon_host_detected', 'system', 'error', 'new_agent', 'going_up_warning', 'going_up_critical', 'going_down_warning', 'going_down_normal', 'going_down_critical', 'going_up_normal' ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT 'unknown'

View File

@ -1,3 +1,11 @@
2009-02-20 Evi Vanoost <vanooste@rcbi.rochester.edu>
* bin/pandora_snmpconsole: Fixed SNMP console going down while
waiting on snmpd
* lib/PandoraFMS/DB.pm: Fixed language from going_down_normal to
going_up_normal and going_up_critical to going_down_critical
2009-02-11 Evi Vanoost <vanooste@rcbi.rochester.edu>
* bin/pandora_server: Fixed Data server. Wouldn't start because of

View File

@ -84,9 +84,14 @@ sub pandora_snmptrapd {
my $sql_insert;
my @index_data;
# open database, only ONCE. We pass reference to DBI handler ($dbh) to all subprocess
my $dbh = DBI->connect("DBI:mysql:$pa_config->{'dbname'}:$pa_config->{'dbhost'}:3306",$pa_config->{'dbuser'}, $pa_config->{'dbpass'}, { RaiseError => 1, AutoCommit => 1 });
while ( ! -e $snmp_logfile) { # Wait until a snmplogfile exists
sleep 5;
sleep ($pa_config{'server_threshold'});
pandora_serverkeepaliver($pa_config,2,$dbh);
}
open (SNMPLOGFILE, $snmp_logfile);
print " [*] SNMP Console enabled \n";
$index_data[0]=0;
@ -115,9 +120,7 @@ sub pandora_snmptrapd {
$datos = readline SNMPLOGFILE;
}
}
# open database, only ONCE. We pass reference to DBI handler ($dbh) to all subprocess
my $dbh = DBI->connect("DBI:mysql:$pa_config->{'dbname'}:$pa_config->{'dbhost'}:3306",$pa_config->{'dbuser'}, $pa_config->{'dbpass'}, { RaiseError => 1, AutoCommit => 1 });
my $trap2agent = enterprise_hook('snmp_get_trap2agent', [$dbh]);
# Main loop for reading file

View File

@ -812,13 +812,13 @@ sub pandora_writestate (%$$$$$$) {
$severity = 3;
enterprise_hook('mcast_change_report', [$pa_config, $module_data->{'nombre'}, $module_data->{'custom_id'}, $timestamp, 'WARN', $dbh]);
} elsif ($data_status->{'estado'} == 1){
$event_type = "going_up_critical";
$status_name = "going up to CRITICAL";
$event_type = "going_down_critical";
$status_name = "going down to CRITICAL";
$severity = 4;
enterprise_hook('mcast_change_report', [$pa_config, $module_data->{'nombre'}, $module_data->{'custom_id'}, $timestamp, 'ERR', $dbh]);
} elsif ($data_status->{'estado'} == 0){
$event_type = "going_down_normal";
$status_name = "going down to NORMAL";
$event_type = "going_up_normal";
$status_name = "going up to NORMAL";
$severity = 2;
enterprise_hook('mcast_change_report', [$pa_config, $module_data->{'nombre'}, $module_data->{'custom_id'}, $timestamp, 'OK', $dbh]);
}
@ -830,13 +830,13 @@ sub pandora_writestate (%$$$$$$) {
$module_data->{'id_agente'}, $severity, 0, $module_data->{'id_agente_modulo'},
$event_type, $dbh);
if ($event_type eq "going_down_warning"){
if ($event_type eq "going_up_warning"){
# Clean up and system mark all active CRITICAL events for this module
db_do ("UPDATE tevento SET estado=1 WHERE id_agentmodule = ".$module_data->{'id_agente_modulo'}." AND event_type = 'going_up_critical'", $dbh);
db_do ("UPDATE tevento SET estado=1 WHERE id_agentmodule = ".$module_data->{'id_agente_modulo'}." AND event_type = 'going_down_critical'", $dbh);
}
elsif ($event_type eq "going_down_normal"){
elsif ($event_type eq "going_up_normal"){
# Clean up and system mark all active WARNING and CRITICAL events for this module
db_do ("UPDATE tevento SET estado=1 WHERE id_agentmodule = ".$module_data->{'id_agente_modulo'}." AND (event_type = 'going_up_warning' OR event_type = 'going_down_warning' OR event_type = 'going_up_critical')", $dbh);
db_do ("UPDATE tevento SET estado=1 WHERE id_agentmodule = ".$module_data->{'id_agente_modulo'}." AND (event_type = 'going_up_warning' OR event_type = 'going_down_warning' OR event_type = 'going_down_critical')", $dbh);
}
}
}