From ae5d805e0827bd93e9fd262c04aab95b844b2312 Mon Sep 17 00:00:00 2001 From: Esteban Sanchez Date: Mon, 19 Jan 2009 15:31:56 +0000 Subject: [PATCH] 2009-01-19 Esteban Sanchez * godmode/agentes/alert_manager.php: Removed effect on AJAX tip. * include/functions.php: Removed deprecated function. * operation/agentes/estado_grupo.php, pandoradb_data.sql, operation/agentes/ver_agente.php, reporting/fgraph.php, operation/agentes/networkmap.php: Replaced references to old alert system with new one. * operation/agentes/networkmap.php: Replaced references to old alert system with new one. Removed effect on AJAX tip. * godmode/snmpconsole/snmp_alert.php: Style correction. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1357 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 16 +++ .../godmode/agentes/alert_manager.php | 3 +- .../godmode/snmpconsole/snmp_alert.php | 3 +- pandora_console/include/functions.php | 103 ------------------ .../operation/agentes/estado_grupo.php | 10 +- .../operation/agentes/networkmap.php | 11 +- .../operation/agentes/ver_agente.php | 18 ++- pandora_console/pandoradb_data.sql | 2 +- pandora_console/reporting/fgraph.php | 12 +- 9 files changed, 49 insertions(+), 129 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 7d849a5acb..a49d8dc453 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,19 @@ +2009-01-19 Esteban Sanchez + + * godmode/agentes/alert_manager.php: Removed effect on AJAX tip. + + * include/functions.php: Removed deprecated function. + + * operation/agentes/estado_grupo.php, pandoradb_data.sql, + operation/agentes/ver_agente.php, reporting/fgraph.php, + operation/agentes/networkmap.php: Replaced references to old alert + system with new one. + + * operation/agentes/networkmap.php: Replaced references to old alert + system with new one. Removed effect on AJAX tip. + + * godmode/snmpconsole/snmp_alert.php: Style correction. + 2009-01-19 Esteban Sanchez * godmode/agentes/configurar_agente.php: Removed references to old diff --git a/pandora_console/godmode/agentes/alert_manager.php b/pandora_console/godmode/agentes/alert_manager.php index 78f5031333..e019126068 100644 --- a/pandora_console/godmode/agentes/alert_manager.php +++ b/pandora_console/godmode/agentes/alert_manager.php @@ -307,8 +307,7 @@ $(document).ready (function () { $("a.template_details").cluetip ({ arrows: true, attribute: 'href', - cluetipClass: 'default', - fx: { open: 'fadeIn', openSpeed: 'slow' }, + cluetipClass: 'default' }).click (function () { return false; });; diff --git a/pandora_console/godmode/snmpconsole/snmp_alert.php b/pandora_console/godmode/snmpconsole/snmp_alert.php index a7ea1e69d7..c8c82b0b00 100644 --- a/pandora_console/godmode/snmpconsole/snmp_alert.php +++ b/pandora_console/godmode/snmpconsole/snmp_alert.php @@ -65,7 +65,8 @@ if (isset ($_GET["submit"])) { if ($id_as < 1) { $sql = sprintf ("INSERT INTO talert_snmp - (id_alert, al_field1, al_field2, al_field3, description, alert_type, agent, custom_oid, oid, time_threshold, max_alerts, min_alerts, priority) + (id_alert, al_field1, al_field2, al_field3, description, alert_type, + agent, custom_oid, oid, time_threshold, max_alerts, min_alerts, priority) VALUES (%d, '%s', '%s', '%s', '%s', %d, '%s', '%s', '%s', %d, %d, %d, %d) ", $alert_type, $al_field1, $al_field2, $al_field3, $description, $alert_trigger, $source_ip, $custom_value, $oid, $time_threshold, $max_alerts, $min_alerts, $priority); diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php index 9eb0eca697..42a72ed140 100644 --- a/pandora_console/include/functions.php +++ b/pandora_console/include/functions.php @@ -697,109 +697,6 @@ function get_alert_times ($row2) { return substr ($time_from_table, 0, 5)." - ".substr ($time_to_table, 0, 5); } -/** - * @deprecated This should be replaced with print_table and format_alert_row - */ -function show_alert_row_edit ($row2, $tdcolor = "datos", $id_tipo_modulo = 1, $combined = 0){ - global $config; - global $lang_label; - - $string = ""; - if ($row2["disable"] == 1){ - $string .= "".__('Disabled').""; - } elseif ($id_tipo_modulo != 0) { - $string .= ""; - } else { - $string .= "--"; - } - - if (isset($row2["operation"])){ - $string = $string."".$row2["operation"]; - } else { - $string = $string."".get_db_sql("SELECT nombre FROM talerta WHERE id_alerta = ".$row2["id_alerta"]); - } - - $string = $string."".human_time_description($row2["time_threshold"]); - if ($row2["dis_min"]) { - $mytempdata = fmod($row2["dis_min"], 1); - if ($mytempdata == 0) - $mymin = intval($row2["dis_min"]); - else - $mymin = $row2["dis_min"]; - $mymin = format_for_graph($mymin ); - } else { - $mymin = 0; - } - - - if ($row2["dis_max"]!=0){ - $mytempdata = fmod($row2["dis_max"], 1); - if ($mytempdata == 0) - $mymax = intval($row2["dis_max"]); - else - $mymax = $row2["dis_max"]; - $mymax = format_for_graph($mymax ); - } else { - $mymax = 0; - } - - - // We have alert text ? - if ($row2["alert_text"]!= "") { - $string = $string."".__('Text').""; - } else { - $string = $string."".$mymin.""; - $string = $string."".$mymax.""; - } - - // Alert times - $string = $string.""; - $string .= get_alert_times ($row2); - - // Description - $string = $string."".salida_limpia ($row2["descripcion"]); - - // Has recovery notify activated ? - if ($row2["recovery_notify"] > 0) - $recovery_notify = __('Yes'); - else - $recovery_notify = __('No'); - - // calculate priority - $priority = get_alert_priority ($row2["priority"]); - - // calculare firing conditions - if ($row2["alert_text"] != "") { - $firing_cond = __('Text')." (".substr($row2["alert_text"],0,12).")"; - } else { - $firing_cond = $row2["min_alerts"]." / ".$row2["max_alerts"]; - } - // calculate days - $firing_days = get_alert_days ( $row2 ); - - // More details EYE tooltip - $string = $string.""; - $string.= ""; - - // Add float info table - $string.= " - - - - - - - - - - -
".__('Recovery')."
$recovery_notify
".__('Priority')."
$priority
".__('Alert Ctrl.')."
".$firing_cond."
".__('Firing days')."
".$firing_days."
"; - - return $string; -} - /** * Get report types in an array. * diff --git a/pandora_console/operation/agentes/estado_grupo.php b/pandora_console/operation/agentes/estado_grupo.php index 5948973466..76dbcd8848 100644 --- a/pandora_console/operation/agentes/estado_grupo.php +++ b/pandora_console/operation/agentes/estado_grupo.php @@ -104,14 +104,14 @@ foreach ($groups as $id_group => $group_name) { if ($config["show_lastalerts"] == 1) { // How many alerts has been fired recently for this group: // SQL Join to get alert status for agents belong this group - $sql = sprintf ("SELECT SUM(talerta_agente_modulo.times_fired) - FROM tagente_modulo, talerta_agente_modulo, tagente + $sql = sprintf ("SELECT SUM(talert_template_modules.times_fired) + FROM tagente_modulo, talert_template_modules, tagente WHERE tagente.disabled = 0 AND tagente.id_grupo = %d AND tagente.id_agente = tagente_modulo.id_agente - AND talerta_agente_modulo.id_agente_modulo = tagente_modulo.id_agente_modulo", + AND talert_template_modules.id_agent_module = tagente_modulo.id_agente_modulo", $id_group); - $group_info["alerts"] = 0 + get_db_sql ($sql); + $group_info["alerts"] = (int) get_db_sql ($sql); } array_push ($groups_info, $group_info); } @@ -249,4 +249,4 @@ for ($table = 0; $table < $ancho; $table++) { } echo ""; -?> \ No newline at end of file +?> diff --git a/pandora_console/operation/agentes/networkmap.php b/pandora_console/operation/agentes/networkmap.php index 48ce79d196..898be2f949 100644 --- a/pandora_console/operation/agentes/networkmap.php +++ b/pandora_console/operation/agentes/networkmap.php @@ -110,14 +110,14 @@ function create_node ($agent, $simple = 0, $font_size = 10) { } // Check for alert - $sql = sprintf ('SELECT COUNT(talerta_agente_modulo.id_aam) - FROM talerta_agente_modulo, tagente_modulo, tagente + $sql = sprintf ('SELECT COUNT(talert_template_modules.id) + FROM talert_template_modules, tagente_modulo, tagente WHERE tagente.id_agente = %d AND tagente.disabled = 0 AND tagente.id_agente = tagente_modulo.id_agente AND tagente_modulo.disabled = 0 - AND tagente_modulo.id_agente_modulo = talerta_agente_modulo.id_agente_modulo - AND talerta_agente_modulo.times_fired > 0 ', + AND tagente_modulo.id_agente_modulo = talert_template_modules.id_agent_module + AND talert_template_modules.times_fired > 0 ', $agent['id_agente']); $alert_modules = get_db_sql ($sql); if ($alert_modules) @@ -394,8 +394,7 @@ $(document).ready (function () { $("area[title!='']").cluetip ({ arrows: true, attribute: 'title', - cluetipClass: 'default', - fx: { open: 'fadeIn', openSpeed: 'slow' }, + cluetipClass: 'default' }); }); diff --git a/pandora_console/operation/agentes/ver_agente.php b/pandora_console/operation/agentes/ver_agente.php index 24f423712a..bbe72e488f 100644 --- a/pandora_console/operation/agentes/ver_agente.php +++ b/pandora_console/operation/agentes/ver_agente.php @@ -92,18 +92,26 @@ if (defined ('AJAX')) { } // Alerts (if present) - $sql = sprintf ('SELECT COUNT(talerta_agente_modulo.id_aam) - FROM talerta_agente_modulo, tagente_modulo, tagente + $sql = sprintf ('SELECT COUNT(talert_template_modules.id) + FROM talert_template_modules, tagente_modulo, tagente WHERE tagente.id_agente = %d AND tagente.disabled = 0 AND tagente.id_agente = tagente_modulo.id_agente AND tagente_modulo.disabled = 0 - AND tagente_modulo.id_agente_modulo = talerta_agente_modulo.id_agente_modulo - AND talerta_agente_modulo.times_fired > 0 ', + AND tagente_modulo.id_agente_modulo = talert_template_modules.id_agent_module + AND talert_template_modules.times_fired > 0 ', $id_agent); $alert_modules = get_db_sql ($sql); if ($alert_modules > 0){ - $sql = sprintf ('SELECT tagente_modulo.nombre, talerta_agente_modulo.last_fired FROM talerta_agente_modulo, tagente_modulo, tagente WHERE tagente.id_agente = %d AND tagente.disabled = 0 AND tagente.id_agente = tagente_modulo.id_agente AND tagente_modulo.disabled = 0 AND tagente_modulo.id_agente_modulo = talerta_agente_modulo.id_agente_modulo AND talerta_agente_modulo.times_fired > 0 ', $id_agent); + $sql = sprintf ('SELECT tagente_modulo.nombre, talert_template_modules.last_fired + FROM talert_template_modules, tagente_modulo, tagente + WHERE tagente.id_agente = %d + AND tagente.disabled = 0 + AND tagente.id_agente = tagente_modulo.id_agente + AND tagente_modulo.disabled = 0 + AND tagente_modulo.id_agente_modulo = talert_template_modules.id_agent_module + AND talert_template_modules.times_fired > 0 ', + $id_agent); $alerts = get_db_all_rows_sql ($sql); echo ''.__('Alerts fired').':'; echo "
    "; diff --git a/pandora_console/pandoradb_data.sql b/pandora_console/pandoradb_data.sql index 366e18f538..04df39751b 100644 --- a/pandora_console/pandoradb_data.sql +++ b/pandora_console/pandoradb_data.sql @@ -23,7 +23,7 @@ -- --- Dumping data for table `talerta` +-- Dumping data for table `talert_commands` -- INSERT INTO `talert_commands` VALUES (1,'Compound only', 'Internal type', 'This alert will not be executed individually', 1); diff --git a/pandora_console/reporting/fgraph.php b/pandora_console/reporting/fgraph.php index df877d8d06..bb22943164 100644 --- a/pandora_console/reporting/fgraph.php +++ b/pandora_console/reporting/fgraph.php @@ -155,12 +155,12 @@ function graphic_combined_module ($module_list, $weight_list, $periodo, $width, $alert_low = 10000000; if ($show_alert == 1){ // If we want to show alerts limits - $sql1="SELECT * FROM talerta_agente_modulo where id_agente_modulo = ".$id_agente_modulo; + $sql1="SELECT * FROM talert_template_modules WHERE id_agent_module = ".$id_agente_modulo; $result=mysql_query($sql1); while ($row=mysql_fetch_array($result)){ - if ($row["dis_max"] > $alert_high) + if ($row["max_value"] > $alert_high) $alert_high = $row["dis_max"]; - if ($row["dis_min"] < $alert_low) + if ($row["max_value"] < $alert_low) $alert_low = $row["dis_min"]; } } @@ -427,8 +427,8 @@ function grafico_modulo_sparse ($id_agente_modulo, $periodo, $show_event, $alert_low = false; // If we want to show alerts limits - $alert_high = get_db_value ('MAX(dis_max)', 'talerta_agente_modulo', 'id_agente_modulo', (int) $id_agente_modulo); - $alert_low = get_db_value ('MIN(dis_min)', 'talerta_agente_modulo', 'id_agente_modulo', (int) $id_agente_modulo); + $alert_high = get_db_value ('MAX(max_value)', 'talert_template_modules', 'id_agent_module', (int) $id_agente_modulo); + $alert_low = get_db_value ('MIN(max_value)', 'talert_template_modules', 'id_agent_module', (int) $id_agente_modulo); // if no valid alert defined to render limits, disable it if (($alert_low === false) && ($alert_high === false)) { @@ -1714,7 +1714,7 @@ function grafico_modulo_boolean ( $id_agente_modulo, $periodo, $show_event, $alert_high = 0; $alert_low = 10000000; // If we want to show alerts limits - $sql1 = "SELECT MAX(dis_max), MIN(dis_min) FROM talerta_agente_modulo WHERE id_agente_modulo = ".$id_agente_modulo; + $sql1 = "SELECT MAX(max_value), MIN(min_value) FROM talert_template_modules WHERE id_agente_modulo = ".$id_agente_modulo; $result = get_db_row_sql ($sql1); if ($result !== false) { $alert_high = $result["max"];