2007-07-16 Sancho Lerena <slerena@gmail.com>

* include/functions_db.php: Bugfix; list_group and list_group2 funtions
        now include all group in result. All group recheck should be done inside code, not in
        this function.

        * operation/agentes/estado_grupo.php: Fixed bug with ALL group.

        * operation/agentes/estado_monitores.php: Bugfix, Now show only initialized modules.

        * operation/agentes/estado_agente.php: Bugfixed, "All" group problem,
        and agent names are truncated if > 18 chars.

        * operation/agentes/tactical.php: Bugfixed, now calculates LAG and module
        count properly.

        * operation/servers/view_server.php: Bugfixed, now calculates LAG and module
        count properly.

        * reporting/fgraph.php: Bugfix: Renamed static problem image.

        *  godmode/agentes/configurar_agente.php: Bugfix, agent address management
        in manual creation.

        * godmode/agentes/agent_manager.php: Bugfix, #1744913 (show icon in creation)



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@563 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
slerena 2007-07-16 18:47:39 +00:00
parent 73a1ebcf96
commit ddebc42585
10 changed files with 91 additions and 69 deletions

View File

@ -1,3 +1,29 @@
2007-07-16 Sancho Lerena <slerena@gmail.com>
* include/functions_db.php: Bugfix; list_group and list_group2 funtions
now include all group in result. All group recheck should be done inside code, not in
this function.
* operation/agentes/estado_grupo.php: Fixed bug with ALL group.
* operation/agentes/estado_monitores.php: Bugfix, Now show only initialized modules.
* operation/agentes/estado_agente.php: Bugfixed, "All" group problem,
and agent names are truncated if > 18 chars.
* operation/agentes/tactical.php: Bugfixed, now calculates LAG and module
count properly.
* operation/servers/view_server.php: Bugfixed, now calculates LAG and module
count properly.
* reporting/fgraph.php: Bugfix: Renamed static problem image.
* godmode/agentes/configurar_agente.php: Bugfix, agent address management
in manual creation.
* godmode/agentes/agent_manager.php: Bugfix, #1744913 (show icon in creation)
2007-07-13 Sancho Lerena <slerena@artica.es> 2007-07-13 Sancho Lerena <slerena@artica.es>
* img/so_other.png: Fixed image. * img/so_other.png: Fixed image.

View File

@ -63,9 +63,8 @@ echo "<tr>";
echo '<td class="datos"><b>'.$lang_label["agent_name"].'</b></td> echo '<td class="datos"><b>'.$lang_label["agent_name"].'</b></td>
<td class="datos"> <td class="datos">
<input type="text" name="agente" size=30 value="'.$nombre_agente.'">'; <input type="text" name="agente" size=30 value="'.$nombre_agente.'">';
if (isset($_GET["creacion"])){
echo "&nbsp;"; if (!isset($_GET["create_agent"])){
} else {
echo " echo "
<a href='index.php?sec=estado& <a href='index.php?sec=estado&
sec2=operation/agentes/ver_agente&id_agente=".$id_agente."'> sec2=operation/agentes/ver_agente&id_agente=".$id_agente."'>

View File

@ -772,7 +772,7 @@ function list_group ($id_user){
$sql='SELECT id_grupo FROM tgrupo'; $sql='SELECT id_grupo FROM tgrupo';
$result=mysql_query($sql); $result=mysql_query($sql);
while ($row=mysql_fetch_array($result)){ while ($row=mysql_fetch_array($result)){
if ($row["id_grupo"] != 1){ if ($row["id_grupo"] != 0){
if (give_acl($id_user,$row["id_grupo"], "AR") == 1){ if (give_acl($id_user,$row["id_grupo"], "AR") == 1){
array_push ($mis_grupos, $row["id_grupo"]); //Put in an array all the groups the user belongs array_push ($mis_grupos, $row["id_grupo"]); //Put in an array all the groups the user belongs
echo "<option value='".$row["id_grupo"]."'>". echo "<option value='".$row["id_grupo"]."'>".
@ -793,10 +793,8 @@ function list_group2 ($id_user){
$sql='SELECT id_grupo FROM tgrupo'; $sql='SELECT id_grupo FROM tgrupo';
$result=mysql_query($sql); $result=mysql_query($sql);
while ($row=mysql_fetch_array($result)){ while ($row=mysql_fetch_array($result)){
if ($row["id_grupo"] != 1){ if (give_acl($id_user,$row["id_grupo"], "AR") == 1){
if (give_acl($id_user,$row["id_grupo"], "AR") == 1){ $mis_grupos[]=$row["id_grupo"]; //Put in an array all the groups the user belongs
$mis_grupos[]=$row["id_grupo"]; //Put in an array all the groups the user belongs
}
} }
} }
return ($mis_grupos); return ($mis_grupos);

View File

@ -74,7 +74,6 @@ if (comprueba_login() == 0) {
echo "<option value='".$ag_group."'>".dame_nombre_grupo($ag_group). echo "<option value='".$ag_group."'>".dame_nombre_grupo($ag_group).
"</option>"; "</option>";
} }
echo "<option value=1>".dame_nombre_grupo(1)."</option>"; // Group all is always active
$mis_grupos=list_group ($id_user); //Print combo for groups and set an array with all groups $mis_grupos=list_group ($id_user); //Print combo for groups and set an array with all groups
echo "</select>"; echo "</select>";
@ -124,7 +123,7 @@ if (comprueba_login() == 0) {
while ($row=mysql_fetch_array($result)){ while ($row=mysql_fetch_array($result)){
$intervalo = $row["intervalo"]; // Interval in seconds $intervalo = $row["intervalo"]; // Interval in seconds
$id_agente = $row['id_agente']; $id_agente = $row['id_agente'];
$nombre_agente = strtoupper($row["nombre"]); $nombre_agente = substr(strtoupper($row["nombre"]),0,18);
$direccion_agente =$row["direccion"]; $direccion_agente =$row["direccion"];
$id_grupo=$row["id_grupo"]; $id_grupo=$row["id_grupo"];
$id_os = $row["id_os"]; $id_os = $row["id_os"];

View File

@ -174,7 +174,6 @@ if (comprueba_login() == 0) {
$ultima = strtotime($ultima_act); $ultima = strtotime($ultima_act);
$ahora = strtotime("now"); $ahora = strtotime("now");
$diferencia = $ahora - $ultima; $diferencia = $ahora - $ultima;
// Get higher interval set for the set of modules from this agent // Get higher interval set for the set of modules from this agent
$sql_maxi ="SELECT MAX(module_interval) FROM tagente_modulo WHERE id_agente = ".$id_agente; $sql_maxi ="SELECT MAX(module_interval) FROM tagente_modulo WHERE id_agente = ".$id_agente;
$result_maxi=mysql_query($sql_maxi); $result_maxi=mysql_query($sql_maxi);

View File

@ -65,7 +65,7 @@
// Prepare data to show // Prepare data to show
// For each valid group for this user, take data from agent and modules // For each valid group for this user, take data from agent and modules
foreach ($mis_grupos as $migrupo) { foreach ($mis_grupos as $migrupo) {
if ($migrupo != "") { if (($migrupo != "") && ($migrupo != 1)) {
$existen_agentes = 0; $existen_agentes = 0;
$grupo[$array_index]["agent"] = 0; $grupo[$array_index]["agent"] = 0;
$grupo[$array_index]["ok"] = 0; $grupo[$array_index]["ok"] = 0;
@ -262,4 +262,4 @@
} }
?> ?>

View File

@ -24,7 +24,7 @@ if (comprueba_login() == 0) {
$id_agente = $_GET["id_agente"]; $id_agente = $_GET["id_agente"];
} }
// Get all module from agent // Get all module from agent
$sql_t='SELECT * FROM tagente_estado, tagente_modulo WHERE tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND tagente_estado.utimestamp != 0 AND tagente_modulo.id_agente='.$id_agente.' AND tagente_estado.estado != 100 order by tagente_modulo.nombre'; $sql_t='SELECT * FROM tagente_estado, tagente_modulo WHERE tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND tagente_modulo.id_agente='.$id_agente.' and tagente_estado.estado != 100 AND tagente_estado.utimestamp != 0 order by tagente_modulo.nombre';
$result_t=mysql_query($sql_t); $result_t=mysql_query($sql_t);
if (mysql_num_rows ($result_t)) { if (mysql_num_rows ($result_t)) {
echo "<h3>".$lang_label["monitor_listing"]."<a href='help/".$help_code."/chap3.php#3323' target='_help' class='help'>&nbsp;<span>".$lang_label["help"]."</span></a></h3>"; echo "<h3>".$lang_label["monitor_listing"]."<a href='help/".$help_code."/chap3.php#3323' target='_help' class='help'>&nbsp;<span>".$lang_label["help"]."</span></a></h3>";

View File

@ -259,48 +259,49 @@
echo "-"; echo "-";
// LAG CHECK // LAG CHECK
echo "<td class='$tdcolor'>"; echo "<td class='$tdcolor'>";
// Calculate lag: get oldest module of any proc_type, for this server, // Calculate lag: get oldest module of any proc_type, for this server,
// and calculate difference in seconds // and calculate difference in seconds
// Get total modules defined for this server // Get total modules defined for this server
if (($network_server == 1) OR ($data_server == 1)){ if (($network_server == 1) OR ($data_server == 1)){
$sql1 = "SELECT utimestamp, current_interval FROM tagente_estado WHERE processed_by_server = '$name' AND estado < 100"; $sql1 = "SELECT MIN(utimestamp),current_interval FROM tagente_estado WHERE utimestamp > 0 AND running_by=$id_server GROUP BY current_interval ORDER BY 1";
$nowtime = time();
$nowtime = time(); $maxlag=0;
$maxlag=0; if ($result1=mysql_query($sql1))
if ($result1=mysql_query($sql1)) while ($row1=mysql_fetch_array($result1)){
while ($row1=mysql_fetch_array($result1)){ if (($row1[0] + $row1[1]) < $nowtime){
if (($row1["utimestamp"] + $row1["current_interval"]) < $nowtime) $maxlag2 = $nowtime - ($row1[0] + $row1[1]);
$maxlag2 = $nowtime - ($row1["utimestamp"] + $row1["current_interval"]); if ($maxlag2 > $maxlag)
if ($maxlag2 > $maxlag) $maxlag = $maxlag2;
$maxlag = $maxlag2; }
} }
if ($maxlag < 60) if ($maxlag < 60)
echo $maxlag." sec"; echo $maxlag." sec";
elseif ($maxlag < 86400) elseif ($maxlag < 86400)
echo format_numeric($maxlag/60) . " min"; echo format_numeric($maxlag/60) . " min";
elseif ($maxlag > 86400) elseif ($maxlag > 86400)
echo "+1 ".$lang_label["day"]; echo "+1 ".$lang_label["day"];
} elseif ($recon_server == 1) { } elseif ($recon_server == 1) {
$sql1 = "SELECT * FROM trecon_task WHERE id_network_server = $id_server"; $sql1 = "SELECT * FROM trecon_task WHERE id_network_server = $id_server";
$result1=mysql_query($sql1); $result1=mysql_query($sql1);
$nowtime = time(); $nowtime = time();
$maxlag=0;$maxlag2=0; $maxlag=0;$maxlag2=0;
while ($row1=mysql_fetch_array($result1)){ while ($row1=mysql_fetch_array($result1)){
if (($row1["utimestamp"] + $row1["interval_sweep"]) < $nowtime){ if (($row1["utimestamp"] + $row1["interval_sweep"]) < $nowtime){
$maxlag2 = $nowtime - ($row1["utimestamp"] + $row1["interval_sweep"]); $maxlag2 = $nowtime - ($row1["utimestamp"] + $row1["interval_sweep"]);
if ($maxlag2 > $maxlag) if ($maxlag2 > $maxlag)
$maxlag = $maxlag2; $maxlag = $maxlag2;
} }
} }
if ($maxlag < 60) if ($maxlag < 60)
echo $maxlag." sec"; echo $maxlag." sec";
elseif ($maxlag < 86400) elseif ($maxlag < 86400)
echo format_numeric($maxlag/60) . " min"; echo format_numeric($maxlag/60) . " min";
elseif ($maxlag > 86400) elseif ($maxlag > 86400)
echo "+1 ".$lang_label["day"]; echo "+1 ".$lang_label["day"];
} else } else
echo "--"; echo "--";
} }
} }
echo '</table>'; echo '</table>';

View File

@ -21,7 +21,7 @@
require("include/config.php"); require("include/config.php");
$modules_server = 0; $modules_server = 0;
$total_modules = 0; $total_modules_network = 0;
$total_modules_data = 0; $total_modules_data = 0;
if (comprueba_login() == 0) { if (comprueba_login() == 0) {
@ -36,10 +36,10 @@ if (comprueba_login() == 0) {
$sql1='SELECT COUNT(id_agente_modulo) FROM tagente_modulo WHERE id_tipo_modulo > 4'; $sql1='SELECT COUNT(id_agente_modulo) FROM tagente_modulo WHERE id_tipo_modulo > 4';
$result1=mysql_query($sql1); $result1=mysql_query($sql1);
$row1=mysql_fetch_array($result1); $row1=mysql_fetch_array($result1);
$total_modules = $row1[0]; $total_modules_network = $row1[0];
// Get total modules defined (data) // Get total modules defined (data)
$sql1='SELECT COUNT(processed_by_server) FROM tagente_estado WHERE processed_by_server LIKE "%_Data" '; $sql1='SELECT COUNT(id_agente_modulo) FROM tagente_modulo WHERE id_tipo_modulo < 5 AND id_tipo_modulo != -1';
if ($result1=mysql_query($sql1)){ if ($result1=mysql_query($sql1)){
$row1=mysql_fetch_array($result1); $row1=mysql_fetch_array($result1);
$total_modules_data = $row1[0]; $total_modules_data = $row1[0];
@ -88,7 +88,7 @@ if (comprueba_login() == 0) {
if (($network_server == 1) OR ($data_server == 1)) if (($network_server == 1) OR ($data_server == 1))
if ($network_server == 1){ if ($network_server == 1){
// Get total modules defined for this server (network modules) // Get total modules defined for this server (network modules)
$sql1='SELECT * FROM tagente where id_server = '.$row["id_server"]; $sql1='SELECT * FROM tagente WHERE id_server = '.$row["id_server"];
$result1=mysql_query($sql1); $result1=mysql_query($sql1);
while ($row1=mysql_fetch_array($result1)){ while ($row1=mysql_fetch_array($result1)){
$sql2='SELECT COUNT(id_agente_modulo) FROM tagente_modulo WHERE id_tipo_modulo > 4 AND id_agente = '.$row1["id_agente"]; $sql2='SELECT COUNT(id_agente_modulo) FROM tagente_modulo WHERE id_tipo_modulo > 4 AND id_agente = '.$row1["id_agente"];
@ -119,13 +119,13 @@ if (comprueba_login() == 0) {
if (($network_server == 1) OR ($data_server == 1)){ if (($network_server == 1) OR ($data_server == 1)){
// Progress bar calculations // Progress bar calculations
if ($network_server == 1){ if ($network_server == 1){
if ($total_modules == 0) if ($total_modules_network == 0)
$percentil = 0; $percentil = 0;
if ($total_modules > 0) if ($total_modules_network > 0)
$percentil = $modules_server / ($total_modules / 100); $percentil = $modules_server / ($total_modules_network / 100);
else else
$percentil = 0; $percentil = 0;
$total_modules_temp = $total_modules; $total_modules_temp = $total_modules_network;
} else { } else {
if ($total_modules_data == 0) if ($total_modules_data == 0)
$percentil = 0; $percentil = 0;
@ -170,16 +170,16 @@ if (comprueba_login() == 0) {
// and calculate difference in seconds // and calculate difference in seconds
// Get total modules defined for this server // Get total modules defined for this server
if (($network_server == 1) OR ($data_server == 1)){ if (($network_server == 1) OR ($data_server == 1)){
$sql1 = "SELECT utimestamp, current_interval FROM tagente_estado WHERE processed_by_server = '$name' AND estado < 100"; $sql1 = "SELECT MIN(utimestamp),current_interval FROM tagente_estado WHERE utimestamp > 0 AND running_by=$id_server GROUP BY current_interval ORDER BY 1";
$nowtime = time(); $nowtime = time();
$maxlag=0; $maxlag=0;
if ($result1=mysql_query($sql1)) if ($result1=mysql_query($sql1))
while ($row1=mysql_fetch_array($result1)){ while ($row1=mysql_fetch_array($result1)){
if (($row1["utimestamp"] + $row1["current_interval"]) < $nowtime) if (($row1[0] + $row1[1]) < $nowtime){
$maxlag2 = $nowtime - ($row1["utimestamp"] + $row1["current_interval"]); $maxlag2 = $nowtime - ($row1[0] + $row1[1]);
if ($maxlag2 > $maxlag) if ($maxlag2 > $maxlag)
$maxlag = $maxlag2; $maxlag = $maxlag2;
}
} }
if ($maxlag < 60) if ($maxlag < 60)
echo $maxlag." sec"; echo $maxlag." sec";

View File

@ -1392,7 +1392,7 @@ function progress_bar($progress,$width,$height) {
if ($progress > 100 || $progress < 0){ if ($progress > 100 || $progress < 0){
// HACK: This report a static image... will increase render in about 200% :-) useful for // HACK: This report a static image... will increase render in about 200% :-) useful for
// high number of realtime statusbar images creation (in main all agents view, for example // high number of realtime statusbar images creation (in main all agents view, for example
$imgPng = imageCreateFromPng("../images/outlimits.png"); $imgPng = imageCreateFromPng("../images/outof.png");
imageAlphaBlending($imgPng, true); imageAlphaBlending($imgPng, true);
imageSaveAlpha($imgPng, true); imageSaveAlpha($imgPng, true);
imagePng($imgPng); imagePng($imgPng);