2007-10-03 Sancho Lerena <slerena@gmail.com>

* include/functions_db.php: Insert_event is now capable to store events already validated.

        * operation/events/events.php: Adjusted column width.

        * operation/agentes/estado_alertas.php: Added additional ACL check. Now user is able to validate
        (Cease) manually an alert (new feature).

        * operation/agentes/ver_agente.php. Now user is able to validate (Cease) manually an alert
        (new feature).

        * operation/agentes/estado_generalagente.php: Render interval in human time insted in seconds.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@666 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
slerena 2007-10-03 12:41:29 +00:00
parent 65b6276559
commit f09a8053aa
6 changed files with 54 additions and 13 deletions

View File

@ -1,3 +1,17 @@
2007-10-03 Sancho Lerena <slerena@gmail.com>
* include/functions_db.php: Insert_event is now capable to store events already validated.
* operation/events/events.php: Adjusted column width.
* operation/agentes/estado_alertas.php: Added additional ACL check. Now user is able to validate
(Cease) manually an alert (new feature).
* operation/agentes/ver_agente.php. Now user is able to validate (Cease) manually an alert
(new feature).
* operation/agentes/estado_generalagente.php: Render interval in human time insted in seconds.
2007-10-03 Sancho Lerena <slerena@gmail.com>
* functions_db.php: Fixed problem in visual maps, alerts was not used

View File

@ -704,13 +704,14 @@ function existe($id){
// event_insert - Insert event in eventable, using Id_grupo, Id_agente and Evento
// ---------------------------------------------------------------
function event_insert($evento, $id_grupo, $id_agente){
function event_insert($evento, $id_grupo, $id_agente, $status=0, $id_usuario=''){
require("config.php");
$today=date('Y-m-d H:i:s');
$utimestamp = time();
$sql1='INSERT INTO tevento (id_agente, id_grupo, evento, timestamp, estado, utimestamp) VALUES ('.$id_agente.','.$id_grupo.',"'.$evento.'","'.$today.'",0, $utimestamp)';
$sql1='INSERT INTO tevento (id_agente, id_grupo, evento, timestamp, estado, utimestamp, id_usuario) VALUES ('.$id_agente.','.$id_grupo.',"'.$evento.'","'.$today.'",'.$status.', '.$utimestamp.', "'.$id_usuario.'")';
$result=mysql_query($sql1);
}
// ---------------------------------------------------------------

View File

@ -41,12 +41,20 @@ if (comprueba_login() != 0) {
// Show alerts for specific agent
// -------------------------------
if (isset($_GET["id_agente"])){
$id_agente = $_GET["id_agente"];
$id_grupo_alerta = give_db_value ("id_grupo", "tagente", "id_agente", $id_agente);
if (give_acl($id_user, $id_grupo_alerta, "AR") == 0) {
audit_db($id_usuario,$REMOTE_ADDR, "ACL Violation","Trying to access alert view");
include ("general/noaccess.php");
exit;
}
if (isset($_GET["tab"])){
echo "<h2>".$lang_label["ag_title"]." &gt; ".$lang_label["alert_listing"]."<a href='help/".$help_code."/chap3.php#3324' target='_help' class='help'><span>".$lang_label["help"]."</span></a></h2>";
}
$id_agente = $_GET["id_agente"];
$query_gen='SELECT talerta_agente_modulo.alert_text, talerta_agente_modulo.id_alerta, talerta_agente_modulo.descripcion, talerta_agente_modulo.last_fired, talerta_agente_modulo.times_fired, tagente_modulo.nombre, talerta_agente_modulo.dis_max, talerta_agente_modulo.dis_min, talerta_agente_modulo.max_alerts, talerta_agente_modulo.time_threshold, talerta_agente_modulo.min_alerts, talerta_agente_modulo.id_agente_modulo, tagente_modulo.id_agente_modulo FROM tagente_modulo, talerta_agente_modulo WHERE tagente_modulo.id_agente = '.$id_agente.' AND tagente_modulo.id_agente_modulo = talerta_agente_modulo.id_agente_modulo AND talerta_agente_modulo.disable = 0 ORDER BY tagente_modulo.nombre';
$query_gen='SELECT talerta_agente_modulo.alert_text, talerta_agente_modulo.id_alerta, talerta_agente_modulo.descripcion, talerta_agente_modulo.last_fired, talerta_agente_modulo.times_fired, tagente_modulo.nombre, talerta_agente_modulo.dis_max, talerta_agente_modulo.dis_min, talerta_agente_modulo.max_alerts, talerta_agente_modulo.time_threshold, talerta_agente_modulo.min_alerts, talerta_agente_modulo.id_agente_modulo, tagente_modulo.id_agente_modulo, talerta_agente_modulo.id_aam FROM tagente_modulo, talerta_agente_modulo WHERE tagente_modulo.id_agente = '.$id_agente.' AND tagente_modulo.id_agente_modulo = talerta_agente_modulo.id_agente_modulo AND talerta_agente_modulo.disable = 0 ORDER BY tagente_modulo.nombre';
$result_gen=mysql_query($query_gen);
if (mysql_num_rows ($result_gen)) {
@ -63,7 +71,8 @@ if (isset($_GET["id_agente"])){
<th>".$lang_label["time_threshold"]."</th>
<th>".$lang_label["last_fired"]."</th>
<th>".$lang_label["times_fired"]."</th>
<th>".$lang_label["status"]."</th>";
<th>".$lang_label["status"]."</th>
<th>".$lang_label["validate"]."</th>";
$color=1;
while ($data=mysql_fetch_array($result_gen)){
if ($color == 1){
@ -109,9 +118,16 @@ if (isset($_GET["id_agente"])){
echo "<td align='center' class='".$tdcolor."f9'>".human_time_comparation ($data["last_fired"])."</td>";
}
echo "<td align='center' class='".$tdcolor."'>".$data["times_fired"]."</td>";
if ($data["times_fired"] <> 0)
echo "<td class='".$tdcolor."' align='center'><img width='20' height='9' src='images/pixel_red.png'></td>";
else
if ($data["times_fired"] <> 0){
echo "<td class='".$tdcolor."' align='center'><img width='20' height='9' src='images/pixel_red.png'>";
echo "</td>";
$id_grupo_alerta = give_db_value ("id_grupo", "tagente", "id_agente", $id_agente);
if (give_acl($id_user, $id_grupo_alerta, "AW") == 1) {
echo "<td align='center' class='".$tdcolor."'>";
echo "<a href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=$id_agente&validate_alert=".$data["id_aam"]."'><img src='images/ok.png'></A>";
echo "</td>";
}
} else
echo "<td class='".$tdcolor."' align='center'><img width='20' height='9' src='images/pixel_green.png'></td>";
}
echo '</table>';

View File

@ -111,7 +111,7 @@ if (comprueba_login() == 0) {
echo '</tr>';
echo '<tr>
<td class="datos2"><b>'.$lang_label["interval"].'</b></td>
<td class="datos2" colspan=2>'.$intervalo.'</td>';
<td class="datos2" colspan=2>'. human_time_description_raw($intervalo).'</td>';
echo '</tr>';
echo '<tr>
<td class="datos"><b>'.$lang_label["description"].'</b></td>

View File

@ -34,8 +34,18 @@ if (comprueba_login() == 0) {
$id_grupo = $row["id_grupo"];
$id_usuario=$_SESSION["id_usuario"];
if (give_acl($id_usuario, $id_grupo, "AR")==1){
// Get the user who makes this request
$id_usuario = $_SESSION["id_usuario"];
// Check for validate alert request
$validate_alert = give_parameter_get ("validate_alert");
if ($validate_alert != ""){
if (give_acl($id_usuario, $id_grupo, "AW")==1){
$alert_name = give_db_value ("descripcion", "talerta_agente_modulo", "id_aam", $validate_alert);
event_insert ("Manual validation of alert for '$alert_name'", $id_grupo, $id_agente, 1, $id_usuario);
$sql='UPDATE talerta_agente_modulo SET times_fired = 0, internal_counter = 0 WHERE id_aam = '.$validate_alert;
$result=mysql_query($sql);
}
}
// Check for Network FLAG change request
if (isset($_GET["flag"])){
if ($_GET["flag"]==1){

View File

@ -248,8 +248,8 @@ if ($total_events > 0){
echo "<th>".$lang_label["agent_name"]."</th>";
echo "<th>".$lang_label["group"]."</th>";
echo "<th>".$lang_label["id_user"]."</th>";
echo "<th>".$lang_label["timestamp"]."</th>";
echo "<th width='62'>".$lang_label["action"]."</th>";
echo "<th width='85'>".$lang_label["timestamp"]."</th>";
echo "<th width='80'>".$lang_label["action"]."</th>";
echo "<th class='p10'>";
echo "<label for='checkbox' class='p21'>".$lang_label["all"]." </label>";
echo '<input type="checkbox" class="chk" name="allbox" onclick="CheckAll();"></th>';