2007-06-12 Sancho Lerena <slerena@artica.es>

* include/languages/language_en.php: New text

        * include/functions.php: Now all functions to render timeframes
        are using lang_label variable, some small adjustements and fixes.

        * operation/agentes/status_monitor.php,
        operation/agentes/estado_alertas.php,
        operation/agentes/estado_ultimopaquete.php: A lot of many small
        fixes and improvements on render output for all timestamp fields.

        * operation/agentes/exportdata.php: Now predefine last 24
        hours. Fixed a bad combo (too small).

        * operation/agentes/estado_monitores.php
        operation/reporting/reporting_viewer.php
        operation/reporting/graph_viewer.php reporting/stat_win.php
        general/logon_ok.php godmode/agentes/alert_manager.php
        godmode/reporting/reporting_builder.php
        godmode/reporting/graph_builder.php: A lot of many small fixes and
        improvements on render output for all timestamp fields and in
        MIN/MAX, small icons for module types, and things like that.




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@504 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
slerena 2007-06-12 11:57:03 +00:00
parent c66a856e60
commit f694d14d12
15 changed files with 268 additions and 137 deletions

View File

@ -1,12 +1,41 @@
2007-06-12 Sancho Lerena <slerena@artica.es>
* include/languages/language_en.php: New text
* include/functions.php: Now all functions to render timeframes
are using lang_label variable, some small adjustements and fixes.
* operation/agentes/status_monitor.php,
operation/agentes/estado_alertas.php,
operation/agentes/estado_ultimopaquete.php: A lot of many small
fixes and improvements on render output for all timestamp fields.
* operation/agentes/exportdata.php: Now predefine last 24
hours. Fixed a bad combo (too small).
* operation/agentes/estado_monitores.php
operation/reporting/reporting_viewer.php
operation/reporting/graph_viewer.php reporting/stat_win.php
general/logon_ok.php godmode/agentes/alert_manager.php
godmode/reporting/reporting_builder.php
godmode/reporting/graph_builder.php: A lot of many small fixes and
improvements on render output for all timestamp fields and in
MIN/MAX, small icons for module types, and things like that.
2007-06-09 Sancho Lerena <slerena@artica.es> 2007-06-09 Sancho Lerena <slerena@artica.es>
* include/functions.php: Solved decimals problem in format_numeric() function * include/functions.php: Solved decimals problem in
format_numeric() function
* operation/agentes/tactical.php: General indicator formula improvement. * operation/agentes/tactical.php: General indicator formula
improvement.
* general/logon_ok.php: Tactical ODO graph update (the same that above). * general/logon_ok.php: Tactical ODO graph update (the same that
above).
* godmode/agentes/manage_config.php: Select list too small, bad render fixed. * godmode/agentes/manage_config.php: Select list too small, bad
render fixed.
2007-06-08 Sancho Lerena <slerena@artica.es> 2007-06-08 Sancho Lerena <slerena@artica.es>

View File

@ -39,10 +39,7 @@ $result=mysql_query($sql1);
$string=''; $string='';
while ($row=mysql_fetch_array($result)){ // All modules of this agent while ($row=mysql_fetch_array($result)){ // All modules of this agent
$id_tipo = $row["id_tipo_modulo"]; $id_tipo = $row["id_tipo_modulo"];
$nombre_modulo =$row["nombre"]; $nombre_modulo = substr($row["nombre"],0,21);
$sql2='SELECT * FROM ttipo_modulo WHERE id_tipo = "'.$id_tipo.'"';
$result2=mysql_query($sql2);
$row2=mysql_fetch_array($result2);
//module type modulo is $row2["nombre"]; //module type modulo is $row2["nombre"];
$sql3='SELECT * $sql3='SELECT *
@ -62,11 +59,15 @@ $result=mysql_query($sql1);
$result4=mysql_query($sql4); $result4=mysql_query($sql4);
$row4=mysql_fetch_array($result4); $row4=mysql_fetch_array($result4);
// Alert name defined by $row4["nombre"]; // Alert name defined by $row4["nombre"];
$tipo_modulo = $row2["nombre"];
$nombre_alerta = $row4["nombre"]; $nombre_alerta = $row4["nombre"];
$string = $string."<tr><td class='$tdcolor'>".$nombre_modulo."/".$tipo_modulo; $string = $string."<tr><td class='$tdcolor'>".$nombre_modulo;
if ($id_tipo > 0) {
$string .= "<td class='$tdcolor'><img src='images/".show_icon_type($id_tipo)."' border=0>";
}
$string = $string."<td class=$tdcolor>".$nombre_alerta; $string = $string."<td class=$tdcolor>".$nombre_alerta;
$string = $string."<td class='$tdcolor'>".$row3["time_threshold"]; $string = $string."<td class='$tdcolor'>".human_time_description($row3["time_threshold"]);
$mytempdata = fmod($row3["dis_min"], 1); $mytempdata = fmod($row3["dis_min"], 1);
if ($mytempdata == 0) if ($mytempdata == 0)
@ -83,9 +84,11 @@ $result=mysql_query($sql1);
$mymax = format_for_graph($mymax ); $mymax = format_for_graph($mymax );
// We have alert text ? // We have alert text ?
if ($row3["alert_text"] != "") if ($row3["alert_text"] != "")
$string = $string."<td class='$tdcolor'>".$lang_label["text"]; $string = $string."<td colspan=2 class='$tdcolor'>".$lang_label["text"];
else else {
$string = $string."<td class='$tdcolor'>".$mymin." / ".$mymax; $string = $string."<td class='$tdcolor'>".$mymin;
$string = $string."<td class='$tdcolor'>".$mymax;
}
$string = $string."<td class='$tdcolor'>".salida_limpia($row3["descripcion"]); $string = $string."<td class='$tdcolor'>".salida_limpia($row3["descripcion"]);
$string = $string."<td class='$tdcolor'>"; $string = $string."<td class='$tdcolor'>";
$id_grupo = dame_id_grupo($id_agente); $id_grupo = dame_id_grupo($id_agente);
@ -104,10 +107,12 @@ $result=mysql_query($sql1);
} }
if (isset($string) & $string!='') { if (isset($string) & $string!='') {
echo "<table cellpadding='4' cellspacing='4' width='720' class='databox'> echo "<table cellpadding='4' cellspacing='4' width='720' class='databox'>
<tr><th>".$lang_label["name_type"]."</th> <tr><th>".$lang_label["name"]."</th>
<th>".$lang_label["type"]."</th>
<th>".$lang_label["alert"]."</th> <th>".$lang_label["alert"]."</th>
<th>".$lang_label["threshold"]."</th> <th>".$lang_label["threshold"]."</th>
<th>".$lang_label["min_max"]."</th> <th>".$lang_label["min."]."</th>
<th>".$lang_label["max."]."</th>
<th>".$lang_label["description"]."</th> <th>".$lang_label["description"]."</th>
<th width='50'>".$lang_label["action"]."</th></tr>"; <th width='50'>".$lang_label["action"]."</th></tr>";
echo $string; echo $string;

View File

@ -37,6 +37,12 @@ if (comprueba_login() != 0) {
exit; exit;
} }
if ((give_acl($id_user,0,"AW") != 1 ) AND (dame_admin($id_user)!=1)) {
audit_db($id_usuario,$REMOTE_ADDR, "ACL Violation","Trying to access graph builder");
include ("general/noaccess.php");
exit;
}
if (isset($_GET["store_graph"])){ if (isset($_GET["store_graph"])){
$name = entrada_limpia($_POST["name"]); $name = entrada_limpia($_POST["name"]);
$description = entrada_limpia($_POST["description"]); $description = entrada_limpia($_POST["description"]);

View File

@ -27,6 +27,13 @@ if (comprueba_login() != 0) {
exit; exit;
} }
if ((give_acl($id_user,0,"AW") != 1 ) AND (dame_admin($id_user)!=1)) {
audit_db($id_usuario,$REMOTE_ADDR, "ACL Violation","Trying to access graph builder");
include ("general/noaccess.php");
exit;
}
$form_report_name = ""; $form_report_name = "";
$form_report_private=0; $form_report_private=0;
$form_report_description = ""; $form_report_description = "";

View File

@ -422,10 +422,25 @@ function give_parameter_post ( $name, $default = "" ){
} }
function human_time_comparation ( $timestamp ){ function human_time_comparation ( $timestamp ){
global $config; global $lang_label;
require ("include/languages/language_".$config["language_code"].".php");
$ahora=date("Y/m/d H:i:s"); $ahora=date("Y/m/d H:i:s");
$seconds = strtotime($ahora) - strtotime($timestamp); $seconds = strtotime($ahora) - strtotime($timestamp);
if ($seconds < 3600)
$render = format_numeric($seconds/60,1)." ".$lang_label["minutes"];
elseif (($seconds >= 3600) and ($seconds < 86400))
$render = format_numeric ($seconds/3600,1)." ".$lang_label["hours"];
elseif (($seconds >= 86400) and ($seconds < 2592000))
$render = format_numeric ($seconds/86400,1)." ".$lang_label["days"];
elseif (($seconds >= 2592000) and ($seconds < 15552000))
$render = format_numeric ($seconds/2592000,1)." ".$lang_label["months"];
elseif ($seconds >= 15552000)
$render = " +6 ".$lang_label["months"];
return $render;
}
function human_time_description_raw ($seconds){
global $lang_label;
if ($seconds < 3600) if ($seconds < 3600)
$render = format_numeric($seconds/60,2)." ".$lang_label["minutes"]; $render = format_numeric($seconds/60,2)." ".$lang_label["minutes"];
elseif (($seconds >= 3600) and ($seconds < 86400)) elseif (($seconds >= 3600) and ($seconds < 86400))
@ -436,36 +451,33 @@ function human_time_comparation ( $timestamp ){
} }
function human_time_description ($period){ function human_time_description ($period){
global $lang_label;
switch ($period) { switch ($period) {
case 3600: $period_label = "Hour"; case 3600: $period_label = $lang_label["hour"];
break; break;
case 7200: $period_label = "2 Hours"; case 7200: $period_label = $lang_label["2_hours"];
break; break;
case 10800: $period_label = "3 Hours"; case 21600: $period_label = $lang_label["6_hours"];
break; break;
case 21600: $period_label = "6 Hours"; case 43200: $period_label = $lang_label["12_hours"];
break; break;
case 43200: $period_label = "12 Hours"; case 86400: $period_label = $lang_label["last_day"];
break; break;
case 86400: $period_label = "Day"; case 172800: $period_label = $lang_label["two_days"];
break; break;
case 172800: $period_label = "Two days"; case 432000: $period_label = $lang_label["five_days"];
break; break;
case 345600: $period_label = "Four days"; case 604800: $period_label = $lang_label["last_week"];
break; break;
case 604800: $period_label = "Last Week"; case 1296000: $period_label = $lang_label["15_days"];
break; break;
case 1296000: $period_label = "15 Days"; case 2592000: $period_label = $lang_label["last_month"];
break; break;
case 2592000: $period_label = "Last Month"; case 5184000: $period_label = $lang_label["two_month"];
break; break;
case 5184000: $period_label = "Two Month"; case 15552000: $period_label = $lang_label["six_months"];
break; break;
case 15552000: $period_label = "Six Months"; default: $period_label = human_time_description_raw ($period);
break;
case 31104000: $period_label = "One year";
break;
default: $period_label = "Day";
} }
return $period_label; return $period_label;
} }

View File

@ -710,7 +710,7 @@ $lang_label["day"]="day";
$lang_label["week"]="week"; $lang_label["week"]="week";
$lang_label["weeks"]="weeks"; $lang_label["weeks"]="weeks";
$lang_label["month"]="month"; $lang_label["month"]="month";
$lang_label["months"]="monts"; $lang_label["months"]="months";
$lang_label["hours"]="hours"; $lang_label["hours"]="hours";
$lang_label["hour"]="hour"; $lang_label["hour"]="hour";
$lang_label['network_profile']="Network profile"; $lang_label['network_profile']="Network profile";
@ -837,6 +837,20 @@ $lang_label["create_reporting_no"]="There was a problem creating reporting";
$lang_label["delete_reporting_ok"]="Reporting successfully deleted"; $lang_label["delete_reporting_ok"]="Reporting successfully deleted";
$lang_label["delete_reporting_no"]="There was a problem deleting reporting"; $lang_label["delete_reporting_no"]="There was a problem deleting reporting";
$lang_label["hour"]="One hour";
$lang_label["2_hours"]="Two hours";
$lang_label["6_hours"]="Six hours";
$lang_label["12_hours"]="12 hours";
$lang_label["last_day"]="One day";
$lang_label["two_days"]="Two days";
$lang_label["five_days"]="Five days";
$lang_label["last_week"]="One week";
$lang_label["15_days"]="15 days";
$lang_label["last_month"]="One month";
$lang_label["two_month"]="Two monts";
$lang_label["six_months"]="Six months";
$lang_label["min."]="Min.";
$lang_label["max."]="Max.";
global $lang_label; global $lang_label;
global $help_label; global $help_label;
?> ?>

View File

@ -58,7 +58,8 @@ if (isset($_GET["id_agente"])){
echo "<tr> echo "<tr>
<th>".$lang_label["type"]."<th>".$lang_label["name"]."</th> <th>".$lang_label["type"]."<th>".$lang_label["name"]."</th>
<th>".$lang_label["description"]."</th> <th>".$lang_label["description"]."</th>
<th>".$lang_label["min_max"]."</th> <th>".$lang_label["min."]."</th>
<th>".$lang_label["max."]."</th>
<th>".$lang_label["time_threshold"]."</th> <th>".$lang_label["time_threshold"]."</th>
<th>".$lang_label["last_fired"]."</th> <th>".$lang_label["last_fired"]."</th>
<th>".$lang_label["times_fired"]."</th> <th>".$lang_label["times_fired"]."</th>
@ -75,7 +76,7 @@ if (isset($_GET["id_agente"])){
} }
echo "<tr>"; echo "<tr>";
echo "<td class='".$tdcolor."'>".dame_nombre_alerta($data["id_alerta"])."</td>"; echo "<td class='".$tdcolor."'>".dame_nombre_alerta($data["id_alerta"])."</td>";
echo "<td class='".$tdcolor."'>".$data["nombre"]."</td>"; echo "<td class='".$tdcolor."'>".substr($data["nombre"],0,21)."</td>";
echo "<td class='".$tdcolor."'>".$data["descripcion"]."</td>"; echo "<td class='".$tdcolor."'>".$data["descripcion"]."</td>";
$mytempdata = fmod($data["dis_min"], 1); $mytempdata = fmod($data["dis_min"], 1);
@ -93,17 +94,21 @@ if (isset($_GET["id_agente"])){
$mymax = format_for_graph($mymax ); $mymax = format_for_graph($mymax );
// Text alert ? // Text alert ?
if ($data["alert_text"] != "") if ($data["alert_text"] != "")
echo "<td class='".$tdcolor."'>".$lang_label["text"]."</td>"; echo "<td class='".$tdcolor."' colspan=2>".$lang_label["text"]."</td>";
else else {
echo "<td class='".$tdcolor."'>".$mymin." / ".$mymax."</td>"; echo "<td class='".$tdcolor."'>".$mymin."</td>";
echo "<td class='".$tdcolor."'>".$data["time_threshold"]; echo "<td class='".$tdcolor."'>".$mymax."</td>";
}
echo "<td align='center' class='".$tdcolor."'>".human_time_comparation($data["time_threshold"]);
if ($data["last_fired"] == "0000-00-00 00:00:00") { if ($data["last_fired"] == "0000-00-00 00:00:00") {
echo "<td class='".$tdcolor."f9'>".$lang_label["never"]."</td>"; echo "<td align='center' class='".$tdcolor."f9'>".$lang_label["never"]."</td>";
} }
else { else {
echo "<td class='".$tdcolor."f9'>".$data["last_fired"]."</td>"; echo "<td align='center' class='".$tdcolor."f9'>".human_time_comparation ($data["last_fired"])."</td>";
} }
echo "<td class='".$tdcolor."'>".$data["times_fired"]."</td>"; echo "<td align='center' class='".$tdcolor."'>".$data["times_fired"]."</td>";
if ($data["times_fired"] <> 0) if ($data["times_fired"] <> 0)
echo "<td class='".$tdcolor."' align='center'><img src='images/dot_red.gif'></td>"; echo "<td class='".$tdcolor."' align='center'><img src='images/dot_red.gif'></td>";
else else
@ -193,21 +198,6 @@ if (isset($_GET["id_agente"])){
sec2=operation/agentes/ver_agente& sec2=operation/agentes/ver_agente&
id_agente=".$id_agente."'> id_agente=".$id_agente."'>
<b>".$nombre_agente."</b>"; <b>".$nombre_agente."</b>";
$string = $string."<td class='".$tdcolor."'>"
.dame_nombre_alerta($data["id_alerta"])."</td>";
$string=$string."<td class='".$tdcolor."'>".
$data["descripcion"]."</td>";
if ($data["last_fired"] == "0000-00-00 00:00:00") {
$string=$string."<td class='".$tdcolor."'>".
$lang_label["never"]."</td>";
}
else {
$string=$string."<td class='".$tdcolor."'>".
$data["last_fired"]."</td>";
}
$string=$string."<td class='".$tdcolor."'>".
$data["times_fired"]."</td>";
if ($data["times_fired"] <> 0) if ($data["times_fired"] <> 0)
$string=$string."<td class='".$tdcolor."' $string=$string."<td class='".$tdcolor."'
align='center'> align='center'>
@ -216,6 +206,22 @@ if (isset($_GET["id_agente"])){
$string=$string."<td class='".$tdcolor."' $string=$string."<td class='".$tdcolor."'
align='center'> align='center'>
<img src='images/dot_green.gif'></td>"; <img src='images/dot_green.gif'></td>";
$string = $string."<td class='".$tdcolor."'>"
.dame_nombre_alerta($data["id_alerta"])."</td>";
$string=$string."<td class='".$tdcolor."'>".
$data["descripcion"]."</td>";
if ($data["last_fired"] == "0000-00-00 00:00:00") {
$string=$string."<td class='".$tdcolor."'>".
$lang_label["never"]."</td>";
} else {
$string=$string."<td class='".$tdcolor."'>".
human_time_comparation($data["last_fired"])."</td>";
}
$string=$string."<td class='".$tdcolor."'>".
$data["times_fired"]."</td>";
} }
} }
else if($ag_group>1) { else if($ag_group>1) {
@ -234,11 +240,12 @@ if (isset($_GET["id_agente"])){
echo "<table cellpadding='4' cellspacing='4' width='700' class='databox'>"; echo "<table cellpadding='4' cellspacing='4' width='700' class='databox'>";
echo "<tr> echo "<tr>
<th>".$lang_label["agent"]."</th> <th>".$lang_label["agent"]."</th>
<th>".$lang_label["status"]."</th>
<th>".$lang_label["type"]."</th> <th>".$lang_label["type"]."</th>
<th>".$lang_label["description"]."</th> <th>".$lang_label["description"]."</th>
<th>".$lang_label["last_fired"]."</th> <th>".$lang_label["last_fired"]."</th>
<th>".$lang_label["times_fired"]."</th> <th>".$lang_label["times_fired"]."</th>";
<th>".$lang_label["status"]."</th>";
echo $string; //built table of alerts echo $string; //built table of alerts
echo "</table>"; echo "</table>";
} }

View File

@ -72,7 +72,7 @@ if (comprueba_login() == 0) {
echo "<img src='images/".show_icon_type($row_t["id_tipo_modulo"])."' border=0>"; echo "<img src='images/".show_icon_type($row_t["id_tipo_modulo"])."' border=0>";
echo "<td class='".$tdcolor."'>".$est_modulo."</td>"; echo "<td class='".$tdcolor."'>".$est_modulo."</td>";
echo "<td class='".$tdcolor."f9'>" echo "<td class='".$tdcolor."f9'>"
.substr($est_description,0,32)."</td>"; .substr($est_description,0,35)."</td>";
// echo "<td class='datos'>".$row3["datos"]; // echo "<td class='datos'>".$row3["datos"];
if ($agent_down == 1) if ($agent_down == 1)
echo "<td class='".$tdcolor."' align='center'> echo "<td class='".$tdcolor."' align='center'>
@ -88,8 +88,11 @@ if (comprueba_login() == 0) {
else else
echo "<td class='".$tdcolor."' align='center'> echo "<td class='".$tdcolor."' align='center'>
<img src='images/b_green.gif'></td>"; <img src='images/b_green.gif'></td>";
echo "<td class='".$tdcolor."'>"; echo "<td align='center' class='".$tdcolor."'>";
if ($temp_interval != $intervalo)
echo $temp_interval."</td>"; echo $temp_interval."</td>";
else
echo "--";
echo "<td class='".$tdcolor."f9'>"; echo "<td class='".$tdcolor."f9'>";
if ($agent_down == 1) { // If agent down, it's shown red and bold if ($agent_down == 1) { // If agent down, it's shown red and bold
echo "<span class='redb'>"; echo "<span class='redb'>";
@ -100,7 +103,7 @@ if (comprueba_login() == 0) {
if ($row_t["timestamp"]=='0000-00-00 00:00:00') { if ($row_t["timestamp"]=='0000-00-00 00:00:00') {
echo $lang_label["never"]; echo $lang_label["never"];
} else { } else {
echo $row_t["timestamp"]; echo human_time_comparation($row_t["timestamp"]);
} }
echo "</span></td>"; echo "</span></td>";
} }

View File

@ -27,7 +27,7 @@
<script language="javascript1.2" type="text/javascript"> <script language="javascript1.2" type="text/javascript">
<!-- <!--
function winopeng(url,wid) { function winopeng(url,wid) {
nueva_ventana=open(url,wid,"width=580,height=250,status=no,toolbar=no,menubar=no"); nueva_ventana=open(url,wid,"width=530,height=275,status=no,toolbar=no,menubar=no");
// WARNING !! Internet Explorer DOESNT SUPPORT "-" CARACTERS IN WINDOW HANDLE VARIABLE // WARNING !! Internet Explorer DOESNT SUPPORT "-" CARACTERS IN WINDOW HANDLE VARIABLE
status =wid; status =wid;
} }
@ -201,10 +201,10 @@ if (comprueba_login() == 0) {
$ahora = time(); $ahora = time();
if ( ($ahora - $row3["utimestamp"]) > ($real_interval*2)) { if ( ($ahora - $row3["utimestamp"]) > ($real_interval*2)) {
echo "<font color='red'>"; echo "<font color='red'>";
echo $row3["timestamp"]; echo human_time_comparation($row3["timestamp"]);
echo "</font>"; echo "</font>";
} else } else
echo $row3["timestamp"]; echo human_time_comparation($row3["timestamp"]);
} }
echo "</td></tr>"; echo "</td></tr>";
//} //}

View File

@ -224,13 +224,15 @@ if ((isset($_POST["export"])) AND (! isset($_POST["update_agent"]))){
// Option B: Print Form // Option B: Print Form
// Form view // Form view
$ahora=date("Y/m/d H:i:s"); $ahora=date("Y/m/d H:i:s");
$ahora_s = date("U");
$ayer = date ("Y/m/d H:i:s", $ahora_s - 86400);
if (isset($_GET["date_from"])) if (isset($_GET["date_from"]))
$date_from=$_GET["date_from"]; $date_from=$_GET["date_from"];
else else
if (isset($_POST["from_date"])) if (isset($_POST["from_date"]))
$date_from = $_POST["from_date"]; $date_from = $_POST["from_date"];
else else
$date_from = $ahora; $date_from = $ayer;
if (isset($_GET["date_to"])) if (isset($_GET["date_to"]))
$date_to = $_GET["date_to"]; $date_to = $_GET["date_to"];
@ -287,8 +289,10 @@ if ((isset($_POST["export"])) AND (! isset($_POST["update_agent"]))){
while ($row=mysql_fetch_array($result)){ while ($row=mysql_fetch_array($result)){
echo "<option value=".$row["id_agente_modulo"].">".$row["nombre"]; echo "<option value=".$row["id_agente_modulo"].">".$row["nombre"];
} }
} else {
echo "<option value=-1>".$lang_label["N/A"];
} }
echo "</select>";
echo "<tr><td class='datos'>"; echo "<tr><td class='datos'>";
echo "<b>".$lang_label["begin_date"]."</b>"; echo "<b>".$lang_label["begin_date"]."</b>";

View File

@ -151,23 +151,28 @@ if (comprueba_login() == 0) {
$string=$string."<a href='index.php?sec=estado& $string=$string."<a href='index.php?sec=estado&
sec2=operation/agentes/ver_agente& sec2=operation/agentes/ver_agente&
id_agente=".$data["id_agente"]."'>". id_agente=".$data["id_agente"]."'>".
dame_nombre_agente($data["id_agente"])."</a></b></td>"; substr(dame_nombre_agente($data["id_agente"]),0,21)."</a></b></td>";
$string=$string."<td class='$tdcolor'>"; $string=$string."<td class='$tdcolor'>";
$string=$string." $string=$string."
<img src='images/".show_icon_type($data["id_tipo_modulo"])."' border=0> <img src='images/".show_icon_type($data["id_tipo_modulo"])."' border=0>
</td>"; </td>";
$string=$string."<td class='$tdcolor'>". $string=$string."<td class='$tdcolor'>".
$data["nombre"]."</td>"; substr($data["nombre"],0,21)."</td>";
$string=$string."<td class='".$tdcolor."f9'>". $string=$string."<td class='".$tdcolor."f9'>".
substr($data["descripcion"],0,30)."</td>"; substr($data["descripcion"],0,30)."</td>";
$string=$string."<td class='$tdcolor' width=25>". $string=$string."<td align='center' class='$tdcolor' width=25>";
if ($data["max"] == $data["min"])
$string .= "--";
else
$data["max"]."/".$data["min"]."</td>"; $data["max"]."/".$data["min"]."</td>";
$string=$string."<td class='$tdcolor' width=25>"; $string=$string."<td class='$tdcolor' align='center' width=25>";
if ($data["module_interval"] == 0){ if ($data["module_interval"] == 0){
$string=$string.give_agentinterval($data["id_agente"]); $my_interval = give_agentinterval($data["id_agente"]);
} else { } else {
$string=$string.$data["module_interval"]; $my_interval = $data["module_interval"];
} }
$string .= $my_interval;
$query_gen2='SELECT * FROM tagente_estado $query_gen2='SELECT * FROM tagente_estado
WHERE id_agente_modulo = '.$data["id_agente_modulo"]; WHERE id_agente_modulo = '.$data["id_agente_modulo"];
$result_gen2=mysql_query($query_gen2); $result_gen2=mysql_query($query_gen2);
@ -178,10 +183,15 @@ if (comprueba_login() == 0) {
} else { } else {
$string=$string."<img src='images/b_red.gif'>"; $string=$string."<img src='images/b_red.gif'>";
} }
$string=$string.
"<td class='".$tdcolor."f9'>". $string=$string."<td class='".$tdcolor."f9'>";
$data2["timestamp"]."</td> $seconds = time() - $data2["utimestamp"];
</tr>"; if ($seconds >= ($my_interval*2))
$string .= "<span class='redb'>";
else
$string .= "<span>";
$string .= human_time_comparation($data2["timestamp"])."</td></tr>";
} }
} }
else if($ag_group>1) {unset($string);} else if($ag_group>1) {unset($string);}

View File

@ -27,6 +27,23 @@ if (comprueba_login() != 0) {
exit; exit;
} }
// Delete module SQL code
if (isset($_GET["delete"])){
$id = $_GET["delete"];
$sql = "DELETE FROM tgraph_source WHERE id_graph = $id";
if ($res=mysql_query($sql))
$result = "<h3 class=suc>".$lang_label["delete_ok"]."</h3>";
else
$result = "<h3 class=error>".$lang_label["delete_no"]."</h3>";
$sql = "DELETE FROM tgraph WHERE id_graph = $id";
if ($res=mysql_query($sql))
$result = "<h3 class=suc>".$lang_label["delete_ok"]."</h3>";
else
$result = "<h3 class=error>".$lang_label["delete_no"]."</h3>";
echo $result;
}
if (isset($_GET["view_graph"])){ if (isset($_GET["view_graph"])){
$id_graph = $_GET["view_graph"]; $id_graph = $_GET["view_graph"];
$sql="SELECT * FROM tgraph WHERE id_graph = $id_graph"; $sql="SELECT * FROM tgraph WHERE id_graph = $id_graph";
@ -67,29 +84,32 @@ if (isset($_GET["view_graph"])){
echo "<tr><td>"; echo "<tr><td>";
echo "<img src='reporting/fgraph.php?tipo=combined&id=$modules&weight_l=$weights&label=$name&height=$height&width=$width&period=$period' border=1 alt=''>"; echo "<img src='reporting/fgraph.php?tipo=combined&id=$modules&weight_l=$weights&label=$name&height=$height&width=$width&period=$period' border=1 alt=''>";
echo "</td></tr></table>"; echo "</td></tr></table>";
switch ($period) { switch ($period) {
case 3600: $period_label = "Hour"; case 3600: $period_label = $lang_label["hour"];
break; break;
case 21600: $period_label = "6 Hours"; case 7200: $period_label = $lang_label["2_hours"];
break; break;
case 43200: $period_label = "12 Hours"; case 21600: $period_label = $lang_label["6_hours"];
break; break;
case 86400: $period_label = "Day"; case 43200: $period_label = $lang_label["12_Hours"];
break; break;
case 172800: $period_label = "Two days"; case 86400: $period_label = $lang_label["last_day"];
break; break;
case 604800: $period_label = "Last Week"; case 172800: $period_label = $lang_label["two_days"];
break; break;
case 1296000: $period_label = "15 Days"; case 432000: $period_label = $lang_label["five_days"];
break; break;
case 2592000: $period_label = "Last Month"; case 604800: $period_label = $lang_label["last_week"];
break; break;
case 5184000: $period_label = "Two Month"; case 1296000: $period_label = $lang_label["15_days"];
break; break;
case 15552000: $period_label = "Six Months"; case 2592000: $period_label = $lang_label["last_month"];
break; break;
default: $period_label = "Day"; case 5184000: $period_label = $lang_label["two_month"];
break;
case 15552000: $period_label = $lang_label["six_months"];
break;
default: $period_label = "--";
} }
echo "<form method='POST' action='index.php?sec=reporting&sec2=operation/reporting/graph_viewer&view_graph=$id_graph'>"; echo "<form method='POST' action='index.php?sec=reporting&sec2=operation/reporting/graph_viewer&view_graph=$id_graph'>";
echo "<table class='databox_frame'>"; echo "<table class='databox_frame'>";
@ -122,7 +142,7 @@ if (isset($_GET["view_graph"])){
echo "<h2>".$lang_label["reporting"]." &gt; "; echo "<h2>".$lang_label["reporting"]." &gt; ";
echo $lang_label["custom_graph_viewer"]."</h2>"; echo $lang_label["custom_graph_viewer"]."</h2>";
echo "<table width='500' cellpadding=4 cellpadding=4 class='databox_frame'>"; echo "<table width='500' cellpadding=4 cellpadding=4 class='databox_frame'>";
echo "<tr><th>".$lang_label["graph_name"]."<th>".$lang_label["description"]."<th>".$lang_label["view"]; echo "<tr><th>".$lang_label["graph_name"]."<th>".$lang_label["description"]."<th>".$lang_label["view"]."<th>";
$color=1; $color=1;
$sql="SELECT * FROM tgraph"; $sql="SELECT * FROM tgraph";
$res=mysql_query($sql); $res=mysql_query($sql);
@ -142,6 +162,9 @@ while ($row = mysql_fetch_array($res)){
echo "<td class='$tdcolor'>".$row["description"]; echo "<td class='$tdcolor'>".$row["description"];
$id_graph = $row["id_graph"]; $id_graph = $row["id_graph"];
echo "<td valign='middle' class='$tdcolor' align='center'><a href='index.php?sec=reporting&sec2=operation/reporting/graph_viewer&view_graph=$id_graph'><img src='images/images.png'></A>"; echo "<td valign='middle' class='$tdcolor' align='center'><a href='index.php?sec=reporting&sec2=operation/reporting/graph_viewer&view_graph=$id_graph'><img src='images/images.png'></A>";
echo "<td class='$tdcolor'><a href='index.php?sec=reporting&sec2=operation/reporting/graph_viewer&delete=$id_graph' ".'onClick="if (!confirm(\' '.$lang_label["are_you_sure"].'\')) return false;">';
echo "<img src='images/cross.png'></a></td>";
} }
} }
echo "</table>"; echo "</table>";

View File

@ -26,6 +26,14 @@ if (comprueba_login() != 0) {
include ("general/noaccess.php"); include ("general/noaccess.php");
exit; exit;
} }
if ((give_acl($id_user,0,"AW") != 1 ) AND (dame_admin($id_user)!=1)) {
audit_db($id_usuario,$REMOTE_ADDR, "ACL Violation","Trying to access graph builder");
include ("general/noaccess.php");
exit;
}
$id_report = give_parameter_get ( 'id', $default = ""); $id_report = give_parameter_get ( 'id', $default = "");
if ($id_report == ""){ if ($id_report == ""){
audit_db($id_user,$REMOTE_ADDR, "HACK Attempt","Trying to access graph viewer withoud ID"); audit_db($id_user,$REMOTE_ADDR, "HACK Attempt","Trying to access graph viewer withoud ID");
@ -47,7 +55,7 @@ echo "<td>".$report_description."</td>";
echo "</table>"; echo "</table>";
echo "<table width=750 cellpadding=4 cellspacing=4 class='databox'>"; echo "<table width=750 cellpadding=4 cellspacing=4 class='databox'>";
$sql = "SELECT * FROM treport_content WHERE id_report = $id_report ORDER by type desc"; $sql = "SELECT * FROM treport_content WHERE id_report = $id_report ORDER by type, id_agent_module DESC";
$res=mysql_query($sql); $res=mysql_query($sql);
while ($row = mysql_fetch_array($res)){ while ($row = mysql_fetch_array($res)){
$type = $row["type"]; $type = $row["type"];

View File

@ -65,29 +65,31 @@ else
$period = 3600; // 1 hour (the most fast query possible) $period = 3600; // 1 hour (the most fast query possible)
switch ($period) { switch ($period) {
case 3600: $period_label = "1 Hour"; case 3600: $period_label = $lang_label["hour"];
break; break;
case 7200: $period_label = "2 Hours"; case 7200: $period_label = $lang_label["2_hours"];
break; break;
case 21600: $period_label = "6 Hours"; case 21600: $period_label = $lang_label["6_hours"];
break; break;
case 43200: $period_label = "12 Hours"; case 43200: $period_label = $lang_label["12_hours"];
break; break;
case 86400: $period_label = "Day"; case 86400: $period_label = $lang_label["last_day"];
break; break;
case 172800: $period_label = "Two days"; case 172800: $period_label = $lang_label["two_days"];
break; break;
case 604800: $period_label = "Last Week"; case 432000: $period_label = $lang_label["five_days"];
break; break;
case 1296000: $period_label = "15 Days"; case 604800: $period_label = $lang_label["last_week"];
break; break;
case 2592000: $period_label = "Last Month"; case 1296000: $period_label = $lang_label["15_days"];
break; break;
case 5184000: $period_label = "Two Month"; case 2592000: $period_label = $lang_label["last_month"];
break; break;
case 15552000: $period_label = "Six Months"; case 5184000: $period_label = $lang_label["two_month"];
break; break;
default: $period_label = "--"; case 15552000: $period_label = $lang_label["six_months"];
break;
default: $period_label = human_time_description_raw ($period);
} }
if (isset($_GET["draw_alerts"])) if (isset($_GET["draw_alerts"]))
@ -233,17 +235,18 @@ echo "</table>";
echo "<td>"; echo "<td>";
echo "<select name='period'>"; echo "<select name='period'>";
echo "<option value=$period>".$period_label; echo "<option value=$period>".$period_label;
echo "<option value=3600>"."Hour"; echo "<option value=3600>".$lang_label["hour"];
echo "<option value=7200>"."2 Hours"; echo "<option value=7200>".$lang_label["2_hours"];
echo "<option value=21600>"."6 Hours"; echo "<option value=21600>".$lang_label["6_hours"];
echo "<option value=43200>"."12 Hours"; echo "<option value=43200>".$lang_label["12_hours"];
echo "<option value=86400>"."Last day"; echo "<option value=86400>".$lang_label["last_day"];
echo "<option value=172800>"."Two days"; echo "<option value=172800>".$lang_label["two_days"];
echo "<option value=604800>"."Last Week"; echo "<option value=432000>".$lang_label["five_days"];
echo "<option value=1296000>"."15 days"; echo "<option value=604800>".$lang_label["last_week"];
echo "<option value=2592000>"."Last Month"; echo "<option value=1296000>".$lang_label["15_days"];
echo "<option value=5184000>"."Two Month"; echo "<option value=2592000>".$lang_label["last_month"];
echo "<option value=15552000>"."Six Months"; echo "<option value=5184000>".$lang_label["two_month"];
echo "<option value=15552000>".$lang_label["six_months"];
echo "</select>"; echo "</select>";
echo "<tr><td>"; echo "<tr><td>";