".$lang_label["view_servers"]." > "; echo $lang_label["server_detail"]."  ".$lang_label["help"].""; // Get total modules defined (network) $sql1='SELECT COUNT(id_agente_modulo) FROM tagente_modulo WHERE id_tipo_modulo > 4'; $result1=mysql_query($sql1); $row1=mysql_fetch_array($result1); $total_modules = $row1[0]; // Get total modules defined (data) $sql1='SELECT COUNT(processed_by_server) FROM tagente_estado WHERE processed_by_server LIKE "%_Data" '; if ($result1=mysql_query($sql1)){ $row1=mysql_fetch_array($result1); $total_modules_data = $row1[0]; } else $total_modules_data = 0; // Connect DataBase $result=mysql_query($sql); if (mysql_num_rows($result)){ echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; // echo ""; //echo ""; //echo ""; echo ""; echo ""; $color=1; while ($row=mysql_fetch_array($result)){ if ($color == 1){ $tdcolor = "datos"; $color = 0; } else { $tdcolor = "datos2"; $color = 1; } $id_server = $row["id_server"]; $name = $row["name"]; $address = $row["ip_address"]; $status = $row["status"]; $laststart = $row["laststart"]; $keepalive = $row["keepalive"]; $network_server = $row["network_server"]; $data_server = $row["data_server"]; $snmp_server = $row["snmp_server"]; $recon_server = $row["recon_server"]; $master = $row["master"]; $checksum = $row["checksum"]; $description = $row["description"]; $version = $row["version"]; $modules_server = 0; if (($network_server == 1) OR ($data_server == 1)) if ($network_server == 1){ // Get total modules defined for this server (network modules) $sql1='SELECT * FROM tagente where id_server = '.$row["id_server"]; $result1=mysql_query($sql1); 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"]; $result2=mysql_query($sql2); $row2=mysql_fetch_array($result2); $modules_server = $modules_server + $row2[0]; } } else { // Get total modules defined for this server (data modules) $sql2 = "SELECT COUNT(running_by) FROM tagente_estado WHERE running_by = $id_server"; $result2=mysql_query($sql2); $row2=mysql_fetch_array($result2); $modules_server = $row2[0]; } echo ""; echo ""; } echo '
".$lang_label["name"]."".$lang_label['status']."".$lang_label['load']."".$lang_label['modules']."".$lang_label['lag']."".$lang_label['description']."".$lang_label['type']."".$lang_label['master']."".$lang_label['checksum']."".$lang_label['laststart']."".$lang_label['version']."".$lang_label['lastupdate']."
"; if ($recon_server == 1) echo "$name "; else echo "$name"; echo ""; if ($status ==0){ echo ""; } else { echo ""; } echo ""; if (($network_server == 1) OR ($data_server == 1)){ // Progress bar calculations if ($network_server == 1){ if ($total_modules == 0) $percentil = 0; if ($total_modules > 0) $percentil = $modules_server / ($total_modules / 100); else $percentil = 0; $total_modules_temp = $total_modules; } else { if ($total_modules_data == 0) $percentil = 0; else $percentil = $modules_server / ($total_modules_data / 100); $total_modules_temp = $total_modules_data; } } elseif ($recon_server == 1){ $sql2 = "SELECT COUNT(id_rt) FROM trecon_task WHERE id_network_server = $id_server"; $result2=mysql_query($sql2); $row2=mysql_fetch_array($result2); $modules_server = $row2[0]; $sql2 = "SELECT COUNT(id_rt) FROM trecon_task"; $result2=mysql_query($sql2); $row2=mysql_fetch_array($result2); $total_modules = $row2[0]; if ($total_modules == 0) $percentil = 0; else $percentil = $modules_server / ($total_modules / 100); $total_modules_temp = $total_modules; } else echo "-"; if (($network_server == 1) OR ($data_server == 1) OR ($recon_server == 1)) // Progress bar render echo ''; // Number of modules echo ""; if (($recon_server ==1) OR ($network_server == 1) OR ($data_server == 1)) echo $modules_server . " / ". $total_modules_temp; else echo "-"; // LAG CHECK echo ""; // Calculate lag: get oldest module of any proc_type, for this server, // and calculate difference in seconds // Get total modules defined for this server if (($network_server == 1) OR ($data_server == 1)){ $sql1 = "SELECT utimestamp, current_interval FROM tagente_estado WHERE processed_by_server = '$name' AND estado < 100"; $nowtime = time(); $maxlag=0; if ($result1=mysql_query($sql1)) while ($row1=mysql_fetch_array($result1)){ if (($row1["utimestamp"] + $row1["current_interval"]) < $nowtime) $maxlag2 = $nowtime - ($row1["utimestamp"] + $row1["current_interval"]); if ($maxlag2 > $maxlag) $maxlag = $maxlag2; } if ($maxlag < 60) echo $maxlag." sec"; elseif ($maxlag < 86400) echo format_numeric($maxlag/60) . " min"; elseif ($maxlag > 86400) echo "+1 ".$lang_label["day"]; } elseif ($recon_server == 1) { $sql1 = "SELECT * FROM trecon_task WHERE id_network_server = $id_server"; $result1=mysql_query($sql1); $nowtime = time(); $maxlag=0;$maxlag2=0; while ($row1=mysql_fetch_array($result1)){ if (($row1["utimestamp"] + $row1["interval_sweep"]) < $nowtime){ $maxlag2 = $nowtime - ($row1["utimestamp"] + $row1["interval_sweep"]); if ($maxlag2 > $maxlag) $maxlag = $maxlag2; } } if ($maxlag < 60) echo $maxlag." sec"; elseif ($maxlag < 86400) echo format_numeric($maxlag/60) . " min"; elseif ($maxlag > 86400) echo "+1 ".$lang_label["day"]; } else echo "--"; echo "".substr($description,0,25); echo ""; if ($network_server == 1){ echo " "; } if ($data_server == 1){ echo "  "; } if ($snmp_server == 1){ echo "  "; } if ($recon_server == 1){ echo "  "; } if ($master == 1){ echo "  "; } if ($checksum == 1){ echo "  "; } //echo "" //.substr($laststart,0,25).""; echo $version; echo ""; // if ($status ==0) echo substr($keepalive,0,25)."
'; echo ""; echo " "; echo "
".$lang_label["network_server"]." ".$lang_label["master"]." ".$lang_label["data_server"]." ".$lang_label["md5_checksum"]." ".$lang_label["snmp_console"]." ".$lang_label["recon_server"]."
"; } else { echo "
".$lang_label["no_server"]."
"; } } else { audit_db($id_user,$REMOTE_ADDR, "ACL Violation","Trying to access Agent view"); require ("general/noaccess.php"); } } ?>