2007-04-13 Sancho Lerena <slerena@artica.es>

* include/functions_db.php: Added function add_address() not finished!.
	
	* pandoradb.sql: Added field "notify_email" in tincidencia. More
	changes are coming in incident management coming from FRITS
	project. Added tnews
	
	* index.php: VERY IMPORTANT: Added Session locking concurrency
        speedup, taken from
        http://es2.php.net/manual/en/ref.session.php#64525. This solve GUI
        lookups when one page it's processing huge data and one user
        cannot access to other pages. This is a common PHP issue for
        bad-susing SESSION functions.
	

	* operation/agentes/estado_grupo.php: Added checks for timeout in
	agents. Now render gray icons/boxes if agent is completely timeout
	(with no modules in time).
	
	* operation/agentes/estado_generalagente.php: Show IP address in
	combo. More changes are coming to agent address management
	(multiaddress).
	
	* general/logoff.php: Fixed, "babel" string :-)
	
	* general/logon_ok.php: Added news display in main logon screen.
	
	* godmode/agentes/configurar_agente.php: Delete address code, not
	finished.
	


git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@422 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
slerena 2007-04-13 18:47:58 +00:00
parent 87561c03d0
commit 825d9cfd30
10 changed files with 157 additions and 24 deletions

View File

@ -1,3 +1,34 @@
2007-04-13 Sancho Lerena <slerena@artica.es>
* include/functions_db.php: Added function add_address() not finished!.
* pandoradb.sql: Added field "notify_email" in tincidencia. More
changes are coming in incident management coming from FRITS
project. Added tnews
* index.php: VERY IMPORTANT: Added Session locking concurrency
speedup, taken from
http://es2.php.net/manual/en/ref.session.php#64525. This solve GUI
lookups when one page it's processing huge data and one user
cannot access to other pages. This is a common PHP issue for
bad-susing SESSION functions.
* operation/agentes/estado_grupo.php: Added checks for timeout in
agents. Now render gray icons/boxes if agent is completely timeout
(with no modules in time).
* operation/agentes/estado_generalagente.php: Show IP address in
combo. More changes are coming to agent address management
(multiaddress).
* general/logoff.php: Fixed, "babel" string :-)
* general/logon_ok.php: Added news display in main logon screen.
* godmode/agentes/configurar_agente.php: Delete address code, not
finished.
2007-04-11 Manuel Arostegui <marostegui@artica.es>
* install.php: Text corrections.

View File

@ -25,7 +25,7 @@
</div>
<div id="logo_box">
<a href="index.php"><img src="images/logo_menu.gif" border="0" alt="logo"></a><br>
<?php echo $babel_version; ?>
<?php echo $pandora_version; ?>
</div>
<div id="ip"><?php echo 'IP: <b class="f10">'.$REMOTE_ADDR.'</b>'; ?></div>
</div>

View File

@ -86,25 +86,23 @@
// Site news !
echo '<h2>' . $lang_label["site_news"] . '</h2>';
echo '<table cellpadding="3" cellspacing="3" width="720"><tr>';
$sql_news = "SELECT * FROM tnews ORDER by utimestamp LIMIT 3";
$result_news = mysql_query ($sql_news);
while ($row = mysql_fetch_array ($result_news)) {
echo '<tr><th align="left">';
echo $lang_label["at"]. " <i>". $row["utimestamp"] ."</i> ".$lang_label["user"]. " <b>". $row["author"]."</b> ".$lang_label["says"].": \"<b>".$row["subject"]."\"</b>";
echo '<tr><td class=datos>';
echo clean_output_breaks($row["text"]);
echo '<td><td class=datos3">';
if ($result_news = mysql_query ($sql_news)){
echo '<table cellpadding="3" cellspacing="3" width="720"><tr>';
while ($row = mysql_fetch_array ($result_news)) {
echo '<tr><th align="left">';
echo $lang_label["at"]. " <i>". $row["utimestamp"] ."</i> ".$lang_label["user"]. " <b>". $row["author"]."</b> ".$lang_label["says"].": \"<b>".$row["subject"]."\"</b>";
echo '<tr><td class=datos>';
echo clean_output_breaks($row["text"]);
echo '<td><td class=datos3">';
}
echo "</table>";
}
echo "</table>";
// Site stats
echo '<h2 class="mgb25">' . $lang_label["stat_title"] . '</h2>';
echo '<table cellpadding="3" cellspacing="3" width="500"><tr>';
$query1 = "SELECT COUNT(id_usuario) FROM tusuario";
$result = mysql_query ($query1);

View File

@ -182,6 +182,14 @@ if (isset($_GET["delete_alert"])){ // if modified some parameter
echo "<h3 class='suc'>".$lang_label["delete_alert_ok"]."</h3>";
}
// Delete IP address
if (isset($_POST["delete_ip"])){
echo "DELETING IP ADDRESS ".$_POST["delete_ip"];
echo "<br>";
}
// Create alert
// =============
if (isset($_POST["insert_alert"])){ // if created alert

View File

@ -1,8 +1,8 @@
<?PHP
// Begin of automatic config file
$dbname="pandora"; // MySQL DataBase name
$dbuser="pandora"; // DB User
$dbpassword="xviyvunu"; // DB Password
$dbuser="root";
$dbpassword="none";
$dbhost="localhost"; // DB Host
$config_homedir="/var/www/pandora_console/"; // Config homedir
$BASE_URL="http://localhost/pandora_console"; // Base URL
@ -105,4 +105,4 @@ if ($language_code == 'ast_es') {
$help_code='ast';
}
else $help_code = substr($language_code,0,2);
?>
?>

View File

@ -917,6 +917,40 @@ function give_network_profile_name ($id_np){
return $pro;
}
// ---------------------------------------------------------------
// Associate IP address to an agent
// ---------------------------------------------------------------
function agent_add_address ($id_agent, $ip_address) {
require("config.php");
$query1="SELECT * FROM taddress_agent WHERE id_agent= $id_agent";
$resq1=mysql_query($query1);
$address_exist = 0;
while ($rowdup=mysql_fetch_array($resq1)){
$sql_3='SELECT ip FROM taddress WHERE id_a = '.$rowdup["id_a"];
$result_3=mysql_query($sql_3);
$row3=mysql_fetch_array($result_3);
if ($row3[0] == $ip_address)
$address_exist = 1;
}
if ($address_exist == 1){
// Add address
}
$sql_2='SELECT id_a FROM taddress_agent WHERE id_agent = '.$id_agent;
$result_t=mysql_query($sql_2);
while ($row=mysql_fetch_array($result_t)){
$sql_3='SELECT ip FROM taddress WHERE id_a = '.$row[0];
$result_3=mysql_query($sql_3);
$row3=mysql_fetch_array($result_3);
if ($direccion_agente != $row3[0])
echo "<option>".salida_limpia($row3[0]);
}
}
// ---------------------------------------------------------------
// Returns agent id given name of agent
// ---------------------------------------------------------------

View File

@ -184,6 +184,9 @@ if (isset ($_GET["refr"])){
}
else
$sec = "";
// http://es2.php.net/manual/en/ref.session.php#64525
// Session locking concurrency speedup!
session_write_close();
?>
<div id="page">
<div id="menu"><?php require ("general/main_menu.php"); ?></div>

View File

@ -74,7 +74,26 @@ if (comprueba_login() == 0) {
echo '</tr>';
echo '<tr>
<td class="datos2"><b>'.$lang_label["ip_address"].'</b></td>
<td class="datos2" colspan=2>'.salida_limpia($direccion_agente);
<td class="datos2" colspan=2>';
// Show all address for this agent, show first the main IP (taken from tagente table)
echo "<select name='notused' size=1>";
echo "<option>".salida_limpia($direccion_agente);
$sql_2='SELECT id_a FROM taddress_agent WHERE id_agent = '.$id_agente;
$result_t=mysql_query($sql_2);
while ($row=mysql_fetch_array($result_t)){
$sql_3='SELECT ip FROM taddress WHERE id_a = '.$row[0];
$result_3=mysql_query($sql_3);
$row3=mysql_fetch_array($result_3);
if ($direccion_agente != $row3[0])
echo "<option>".salida_limpia($row3[0]);
}
echo "</select>";
if ($agent_type == 0) {
echo '<tr>
<td class="datos"><b>'.$lang_label["os"].'</b></td>

View File

@ -70,6 +70,7 @@
$grupo[$array_index]["ok"] = 0;
$grupo[$array_index]["bad"] = 0;
$grupo[$array_index]["alerts"] = 0;
$grupo[$array_index]["down"] = 0;
$grupo[$array_index]["icon"] = dame_grupo_icono ($migrupo);
$grupo[$array_index]["id_grupo"] = $migrupo;
$grupo[$array_index]["group"] = dame_nombre_grupo ($migrupo);
@ -82,8 +83,20 @@
if ($row0[0] > 0)
$existen_agentes = 1;
// Get timestamp status (down or not for each agent)
$sql1 = "SELECT intervalo, ultimo_contacto FROM tagente where id_grupo = $migrupo";
if ($result1 = mysql_query ($sql1))
while ($row1 = mysql_fetch_array ($result1)) {
// Check unknown contact status for whole agent
$ultimo_contacto = $row1[1];
$agent_interval = $row1[0];
$ahora=date("Y/m/d H:i:s");
$seconds = strtotime($ahora) - strtotime($ultimo_contacto);
if ($seconds >= ($agent_interval*2))
$grupo[$array_index]["down"]++;
}
// SQL Join to get monitor status for agents belong this group
$sql1 = "SELECT tagente.id_agente, tagente_estado.estado, tagente_estado.datos FROM tagente, tagente_estado WHERE tagente.disabled = 0 AND tagente.id_grupo = $migrupo AND tagente.id_agente = tagente_estado.id_agente AND tagente_estado.estado != 100";
$sql1 = "SELECT tagente.id_agente, tagente_estado.estado, tagente_estado.datos FROM tagente, tagente_estado WHERE tagente.disabled = 0 AND tagente.id_grupo = $migrupo AND tagente.id_agente = tagente_estado.id_agente AND tagente_estado.estado != 100";
if ($result1 = mysql_query ($sql1)){
while ($row1 = mysql_fetch_array ($result1)) {
$id_agente = $row1[0];
@ -140,10 +153,20 @@
$icono_type=$icono_type."
<img src='images/dot_yellow.gif' alt=''>";
}
// Bu default green border
$celda = "<td class='top' style='border: 3px solid #AEFF21;' width='100'>";
// Show grey light if there are agent down for this group
if ($grupo[$real_count]["down"] > 0 ){
$icono_type=$icono_type."
<img src='images/dot_white.gif' alt=''>";
}
// By default green border
$celda = "<td class='top' style='border: 3px solid #AEFF21;' width='100'>";
// Grey border if agent down
if ($grupo[$real_count]["down"] > 0)
$celda = "<td class='top' style='border: 3px solid #AABBAA;' width='100'>";
// Yellow border if agents with alerts
if ($grupo[$real_count]["alerts"] > 0)
$celda = "<td class='top' style='border: 3px solid #FFEA00;' width='100'>";
@ -155,6 +178,7 @@
// Orange if alerts and down modules
if (($grupo[$real_count]["bad"] > 0) && ($grupo[$real_count]["alerts"] > 0))
$celda = "<td class='top' style='border: 3px solid #FFBB00;' width='100'>";
$celda .= "<a href='index.php?sec=estado&amp;
sec2=operation/agentes/estado_agente&amp;
@ -196,8 +220,14 @@
".$lang_label["fail"].": </td>
<td class='datos'><font class='redb'>".
$grupo[$real_count]["bad"]."</font></td>
</tr>
<tr>
<td class='datos'>
<img src='images/b_white.gif' align='top' alt=''>
".$lang_label["down"].": </td>
<td class='datos'><font class='redb'>".
$grupo[$real_count]["down"]."</font></td>
</tr>";
if ($config_show_lastalerts == 1)
$celda .= "<tr>
<td class='datos'>

View File

@ -397,6 +397,7 @@ CREATE TABLE `tincidencia` (
`id_grupo` mediumint(9) NOT NULL default '0',
`actualizacion` datetime NOT NULL default '0000-00-00 00:00:00',
`id_creator` varchar(60) default NULL,
`notify_email` TINYINT UNSIGNED NOT NULL DEFAULT 0,
PRIMARY KEY (`id_incidencia`),
KEY `incident_index_1` (`id_usuario`,`id_incidencia`)
) ENGINE=InnoDB;
@ -701,6 +702,15 @@ CREATE TABLE `vistas_consola` (
`nombre` varchar(50) NOT NULL,
`descripcion` varchar(250) NOT NULL,
PRIMARY KEY (`idVista`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1;
) ENGINE=InnoDB AUTO_INCREMENT=7;
CREATE TABLE `tnews` (
`id_news` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
`author` varchar(255) NOT NULL DEFAULT '',
`subject` varchar(255) NOT NULL DEFAULT '',
`text` TEXT NOT NULL DEFAULT '',
`utimestamp` DATETIME NOT NULL DEFAULT 0,
PRIMARY KEY(`id_news`)
)
ENGINE = InnoDB;