2009-01-19 Esteban Sanchez <estebans@artica.es>

* 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
This commit is contained in:
Esteban Sanchez 2009-01-19 15:31:56 +00:00
parent 95a423e4e6
commit ae5d805e08
9 changed files with 49 additions and 129 deletions

View File

@ -1,3 +1,19 @@
2009-01-19 Esteban Sanchez <estebans@artica.es>
* 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 <estebans@artica.es>
* godmode/agentes/configurar_agente.php: Removed references to old

View File

@ -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;
});;

View File

@ -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);

View File

@ -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 .= "<td class='$tdcolor'><b><i>".__('Disabled')."</b></i>";
} elseif ($id_tipo_modulo != 0) {
$string .= "<td class='$tdcolor'><img src='images/".show_icon_type($id_tipo_modulo)."' border=0>";
} else {
$string .= "<td class='$tdcolor'>--";
}
if (isset($row2["operation"])){
$string = $string."<td class=$tdcolor>".$row2["operation"];
} else {
$string = $string."<td class=$tdcolor>".get_db_sql("SELECT nombre FROM talerta WHERE id_alerta = ".$row2["id_alerta"]);
}
$string = $string."<td class='$tdcolor'>".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."<td colspan=2 class='$tdcolor'>".__('Text')."</td>";
} else {
$string = $string."<td class='$tdcolor'>".$mymin."</td>";
$string = $string."<td class='$tdcolor'>".$mymax."</td>";
}
// Alert times
$string = $string."<td class='$tdcolor'>";
$string .= get_alert_times ($row2);
// Description
$string = $string."</td><td class='$tdcolor'>".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."<td class='$tdcolor'>";
$string.= "<a href=# class=info><img class='top'
src='images/eye.png' alt=''>";
// Add float info table
$string.= "
<span>
<table cellspacing='2' cellpadding='0'
style='margin-left:2px;'>
<tr><th colspan='2' width='91'>".__('Recovery')."</th></tr>
<tr><td colspan='2' class='datos' align='center'><b>$recovery_notify</b></td></tr>
<tr><th colspan='2' width='91'>".__('Priority')."</th></tr>
<tr><td colspan='2' class='datos' align='center'><b>$priority</b></td></tr>
<tr><th colspan='2' width='91'>".__('Alert Ctrl.')."</th></tr>
<tr><td colspan='2' class='datos' align='center'><b>".$firing_cond."</b></td></tr>
<tr><th colspan='2' width='91'>".__('Firing days')."</th></tr>
<tr><td colspan='2' class='datos' align='center'><b>".$firing_days."</b></td></tr>
</table></span></a>";
return $string;
}
/**
* Get report types in an array.
*

View File

@ -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);
}

View File

@ -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!='<?php echo $pandora_name; ?>']").cluetip ({
arrows: true,
attribute: 'title',
cluetipClass: 'default',
fx: { open: 'fadeIn', openSpeed: 'slow' },
cluetipClass: 'default'
});
});
</script>

View File

@ -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 '<strong>'.__('Alerts fired').':</strong>';
echo "<ul>";

View File

@ -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);

View File

@ -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"];