* ChangeLog: Create this file, prior to launch final 1.2 version. For the next

versions, will use it for every branch and subproject.

	* configurar_agente.php : Fixed Undefined index: combo_snmp_oid notice error.
	
	* estado_grupo.php: Detect old "OK" monitors, but doesnt check if they are down 
	in time, so for example, a old monitor with OK signal but from a week old, it is
	shown as GREEN (good) value, not as a DOWN (white with ? symbol). FIXED. 
	Now counts data modules for DOWN total account, and show grey button if ANY
	type of module is down, not only monitors. Improved SQL searches. 

	* estado_agente.php, estado_ultimopaquete.php: Same as estado_grupo with data_modules, 
	included in total account, more accurate accounting. A new value shown in grey for 
	DOWN modules, being monitors or single data modules, no matter type. Improved SQL 
	searches. Individual module intervals are used to determine if a module is down, 
	if there is no individual module interval, global agent interval is used. 
	Now it's possible to have a module with higher interval than Agent interval, so 
	we take now the more higest interval in modules to calculate if an agent is DOWN.

	* fgraph.php: updated progressbar function to show N/A when data is above 100 or below 0. 
	


git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@115 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
slerena 2006-07-09 20:29:44 +00:00
parent a505c9c2b3
commit 58820e1a7f
7 changed files with 213 additions and 171 deletions

23
pandora_console/CHANGELOG Normal file
View File

@ -0,0 +1,23 @@
2006-07-09 Sancho Lerena <slerena@artica.es>
* ChangeLog: Create this file, prior to launch final 1.2 version. For the next
versions, will use it for every branch and subproject.
* configurar_agente.php : Fixed Undefined index: combo_snmp_oid notice error.
* estado_grupo.php: Detect old "OK" monitors, but doesnt check if they are down
in time, so for example, a old monitor with OK signal but from a week old, it is
shown as GREEN (good) value, not as a DOWN (white with ? symbol). FIXED.
Now counts data modules for DOWN total account, and show grey button if ANY
type of module is down, not only monitors. Improved SQL searches.
* estado_agente.php, estado_ultimopaquete.php: Same as estado_grupo with data_modules,
included in total account, more accurate accounting. A new value shown in grey for
DOWN modules, being monitors or single data modules, no matter type. Improved SQL
searches. Individual module intervals are used to determine if a module is down,
if there is no individual module interval, global agent interval is used.
Now it's possible to have a module with higher interval than Agent interval, so
we take now the more higest interval in modules to calculate if an agent is DOWN.
* fgraph.php: updated progressbar function to show N/A when data is above 100 or below 0.

View File

@ -471,9 +471,11 @@ if (give_acl($id_user, 0, "AW")==1) {
// MODULE UPDATE // MODULE UPDATE
// ================= // =================
if ((isset($_POST["update_module"])) && (!isset($_POST["oid"]))){ // if modified something if ((isset($_POST["update_module"])) && (!isset($_POST["oid"]))){ // if modified something
$combo_snmp_oid = entrada_limpia($_POST["combo_snmp_oid"]); if (isset($_POST["combo_snmp_oid"])){
if ($snmp_oid == ""){ $combo_snmp_oid = entrada_limpia($_POST["combo_snmp_oid"]);
$snmp_oid = $combo_snmp_oid; if ($snmp_oid == ""){
$snmp_oid = $combo_snmp_oid;
}
} }
$sql_update = "UPDATE tagente_modulo SET max ='".$modulo_max."', min = '".$modulo_min."', nombre='".$nombre."', descripcion='".$descripcion."', tcp_send = '$tcp_send', tcp_rcv = '$tcp_rcv', tcp_port = '$tcp_port', ip_target = '$ip_target', snmp_oid = '$snmp_oid', snmp_community = '$snmp_community', id_module_group = '$id_module_group', module_interval = '$module_interval' WHERE id_agente_modulo = ".$id_agente_modulo; $sql_update = "UPDATE tagente_modulo SET max ='".$modulo_max."', min = '".$modulo_min."', nombre='".$nombre."', descripcion='".$descripcion."', tcp_send = '$tcp_send', tcp_rcv = '$tcp_rcv', tcp_port = '$tcp_port', ip_target = '$ip_target', snmp_oid = '$snmp_oid', snmp_community = '$snmp_community', id_module_group = '$id_module_group', module_interval = '$module_interval' WHERE id_agente_modulo = ".$id_agente_modulo;
$result=mysql_query($sql_update); $result=mysql_query($sql_update);

View File

@ -63,19 +63,18 @@ if (comprueba_login() == 0) {
// Show only selected groups // Show only selected groups
if ($ag_group > 1) if ($ag_group > 1)
$sql='SELECT * FROM tagente WHERE id_grupo='.$ag_group.' order by nombre'; $sql='SELECT * FROM tagente WHERE id_grupo='.$ag_group.' and disabled = 0 order by nombre';
else else
$sql='SELECT * FROM tagente order by id_grupo, nombre'; $sql='SELECT * FROM tagente where disabled = 0 order by id_grupo, nombre';
$result=mysql_query($sql); $result=mysql_query($sql);
if (mysql_num_rows($result)){ if (mysql_num_rows($result)){
// Load icon index from tgrupos // Load icon index from tgrupos
$iconindex_g[]=""; $iconindex_g[]="";
$sql_g='SELECT id_grupo, icon FROM tgrupo'; $sql_g='SELECT id_grupo, icon FROM tgrupo';
$result_g=mysql_query($sql_g); $result_g=mysql_query($sql_g);
while ($row_g=mysql_fetch_array($result_g)){ while ($row_g=mysql_fetch_array($result_g)){
$iconindex_g[$row_g["id_grupo"]] = $row_g["icon"]; $iconindex_g[$row_g["id_grupo"]] = $row_g["icon"];
} }
echo "<td class='f9l30'>"; echo "<td class='f9l30'>";
echo "<img src='images/dot_red.gif'> - ".$lang_label["fired"]; echo "<img src='images/dot_red.gif'> - ".$lang_label["fired"];
@ -93,127 +92,145 @@ if (comprueba_login() == 0) {
echo "<th>".$lang_label["status"]."</th>"; echo "<th>".$lang_label["status"]."</th>";
echo "<th>".$lang_label["alerts"]."</th>"; echo "<th>".$lang_label["alerts"]."</th>";
echo "<th>".$lang_label["last_contact"]."</th>"; echo "<th>".$lang_label["last_contact"]."</th>";
// For every agent deficed in the agent table // For every agent defined in the agent table
$color = 1; $color = 1;
while ($row=mysql_fetch_array($result)){ while ($row=mysql_fetch_array($result)){
if ($row["disabled"] == 0) { $intervalo = $row["intervalo"]; // Interval in seconds
$intervalo = $row["intervalo"]; // Interval in seconds $id_agente = $row['id_agente'];
$id_agente = $row['id_agente']; $nombre_agente = $row["nombre"];
$nombre_agente = $row["nombre"]; $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"]; $agent_type = $row["agent_type"];
$agent_type = $row["agent_type"]; $ultimo_contacto = $row["ultimo_contacto"];
$ultimo_contacto = $row["ultimo_contacto"]; $biginterval=$intervalo;
foreach ($mis_grupos as $migrupo){ //Verifiy if the group this agent begins is one of the user groups
foreach ($mis_grupos as $migrupo){ //Verifiy if the group this agent begins is one of the user groups if (($migrupo ==1) || ($id_grupo==$migrupo)){
if (($migrupo ==1) || ($id_grupo==$migrupo)){ $pertenece = 1;
$pertenece = 1; break;
break;
}
else
$pertenece = 0;
} }
if ($pertenece == 1) { // Si el agente pertenece a uno de los grupos que el usuario puede visualizar else
// Obtenemos la lista de todos los modulos de cada agente $pertenece = 0;
$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; }
$result_t=mysql_query($sql_t); if ($pertenece == 1) { // Si el agente pertenece a uno de los grupos que el usuario puede visualizar
$estado_general = 0; $numero_modulos = 0; $numero_monitor = 0; $est_timestamp = ""; $monitor_bad=0; // Obtenemos la lista de todos los modulos de cada agente
$estado_cambio=0; // Oops, I forgot initialize this fucking var... many problems due it $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;
while ($row_t=mysql_fetch_array($result_t)){ $result_t=mysql_query($sql_t);
$est_modulo = $row_t["estado"]; # Sumamos los estados los modulos de cada agente, si hay uno mal, resultado total malo $estado_general = 0; $numero_modulos = 0; $numero_monitor = 0; $est_timestamp = ""; $monitor_bad=0; $monitor_ok = 0; $monitor_down=0; $numero_datamodules=0;
if ($est_modulo <> 100) { $estado_cambio=0; // Oops, I forgot initialize this fucking var... many problems due it
$estado_general = $estado_general + $est_modulo; $ahora=date("Y/m/d H:i:s");
$estado_cambio = $estado_cambio + $row_t["cambio"]; // Calculate module/monitor totals for this agent
$numero_monitor ++; while ($row_t=mysql_fetch_array($result_t)){
if ($est_modulo <> 0) $est_modulo = $row_t["estado"];
$monitor_bad++; $ultimo_contacto_modulo = $row_t["timestamp"];
} $module_interval = $row_t["module_interval"];
$numero_modulos++; if ($module_interval > $biginterval)
} $biginterval = $module_interval;
if ($module_interval !=0)
# Defines if Agent is down (interval x 2) $intervalo_comp = $module_interval;
$ahora=date("Y/m/d H:i:s"); else
$intervalo_comp = $intervalo;
if ($ultimo_contacto <> "") if ($ultimo_contacto <> "")
$seconds = strtotime($ahora) - strtotime($ultimo_contacto); $seconds = strtotime($ahora) - strtotime($ultimo_contacto_modulo);
else else
$seconds = -100000; $seconds = -1;
# Defines if Agent is down (interval x 2 > time last contact # Defines if Agent is down (interval x 2 > time last contact
if ($seconds >= ($intervalo*2)) // If (intervalx2) secs. ago we don't get anything, show alert if ($seconds >= ($intervalo_comp*2)){ // If (intervalx2) secs. ago we don't get anything, show alert
$agent_down = 1; if ($est_modulo != 100)
else $numero_monitor++;
$agent_down = 0; $monitor_down++;
// Color change for each line (1.2 beta2)
if ($color == 1){
$tdcolor = "datos";
$color = 0;
} }
else { elseif ($est_modulo <> 100) { // estado=100 are data modules
$tdcolor = "datos2"; $estado_general = $estado_general + $est_modulo;
$color = 1; $estado_cambio = $estado_cambio + $row_t["cambio"];
} $numero_monitor ++;
echo "<tr>"; if ($est_modulo <> 0)
echo "<td class='$tdcolor'>"; $monitor_bad++;
$id_grupo=dame_id_grupo($id_agente); else
if (give_acl($id_user, $id_grupo, "AW")==1){ $monitor_ok++;
echo "<a href='index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente&amp;id_agente=".$id_agente."'><img src='images/setup.gif' border=0 width=15></a>"; } elseif ($est_modulo == 100){ // Data modules
} $numero_datamodules++;
echo "&nbsp;&nbsp;<a href='index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente=".$id_agente."'><b>".$nombre_agente."</b></a>";
if ( $agent_type == 0) {
// Show SO icon :)
echo "<td class='$tdcolor' align='center'><img border=0 src='images/".dame_so_icon($id_os)."' height=18 alt='".dame_so_name($id_os)."'>";
} elseif ($agent_type == 1) {
// Show network icon (for pandora 1.2)
echo "<td class='$tdcolor' align='center'><img border=0 src='images/network.gif' height=18 alt='Network Agent'>";
} }
$numero_modulos++;
}
// Color change for each line (1.2 beta2)
if ($color == 1){
$tdcolor = "datos";
$color = 0;
}
else {
$tdcolor = "datos2";
$color = 1;
}
echo "<tr>";
echo "<td class='$tdcolor'>";
$id_grupo=dame_id_grupo($id_agente);
if (give_acl($id_user, $id_grupo, "AW")==1){
echo "<a href='index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente&amp;id_agente=".$id_agente."'><img src='images/setup.gif' border=0 width=15></a>";
}
echo "&nbsp;&nbsp;<a href='index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente=".$id_agente."'><b>".$nombre_agente."</b></a>";
if ( $agent_type == 0) {
// Show SO icon :)
echo "<td class='$tdcolor' align='center'><img border=0 src='images/".dame_so_icon($id_os)."' height=18 alt='".dame_so_name($id_os)."'>";
} elseif ($agent_type == 1) {
// Show network icon (for pandora 1.2)
echo "<td class='$tdcolor' align='center'><img border=0 src='images/network.gif' height=18 alt='Network Agent'>";
}
// If there are a module interval bigger than agent interval
if ($biginterval > $intervalo)
echo "<td class='$tdcolor'><font color='green'>".$biginterval."</font>";
else
echo "<td class='$tdcolor'>".$intervalo; echo "<td class='$tdcolor'>".$intervalo;
echo '<td class="'.$tdcolor.'"><img src="images/g_'.$iconindex_g[$id_grupo].'.gif" border="0"> ( '.dame_grupo($id_grupo).' )'; echo '<td class="'.$tdcolor.'"><img src="images/g_'.$iconindex_g[$id_grupo].'.gif" border="0"> ( '.dame_grupo($id_grupo).' )';
echo "<td class='$tdcolor'> ".$numero_modulos." <b>/</b> ".$numero_monitor; echo "<td class='$tdcolor'> ".$numero_modulos." <b>/</b> ".$numero_monitor;
if ($monitor_bad <> 0) if ($monitor_bad <> 0)
echo " <b>/</b> <font class='red'>".$monitor_bad."</font>"; echo " <b>/</b> <font class='red'>".$monitor_bad."</font>";
if ($agent_down == 1) if ($monitor_down <> 0)
echo "<td class='$tdcolor' align='center'><img src='images/b_down.gif'>"; echo " <b>/</b> <font class='grey'>".$monitor_down."</font>";
else if ($numero_monitor <> 0){
if ($numero_monitor <> 0) if ($estado_general <> 0){
if ($estado_general <> 0) if ($estado_cambio == 0){
if ($estado_cambio == 0) echo "<td class='$tdcolor' align='center'><img src='images/b_red.gif'>";
echo "<td class='$tdcolor' align='center'><img src='images/b_red.gif'>"; } else {
else echo "<td class='$tdcolor' align='center'><img src='images/b_yellow.gif'>";
echo "<td class='$tdcolor' align='center'><img src='images/b_yellow.gif'>";
else
echo "<td class='$tdcolor' align='center'><img src='images/b_green.gif'>";
elseif ($numero_modulos <> 0)
echo "<td class='$tdcolor' align='center'><img src='images/b_white.gif'>";
else
echo "<td class='$tdcolor' align='center'><img src='images/b_blue.gif'>";
// checks if an alert was fired recently
echo "<td class='$tdcolor' align='center'>";
if (check_alert_fired($id_agente) == 1)
echo "<img src='images/dot_red.gif'>";
else
echo "<img src='images/dot_green.gif'>";
echo "<td class='$tdcolor'>";
if ($agent_down == 1) // if agent down, red and bold
echo "<b><font class='red'>";
if ( $ultimo_contacto == "0000-00-00 00:00:00")
echo $lang_label["never"];
else {
$ultima = strtotime($ultimo_contacto);
$ahora = strtotime("now");
$diferencia = $ahora - $ultima;
if ($intervalo > 0){
$percentil = round($diferencia/(($intervalo*2) / 100));
} else {
echo "N/A";
}
echo "<a href='#' class='info2'><img src='reporting/fgraph.php?tipo=progress&amp;percent=".$percentil."&amp;height=15&amp;width=80' border='0'>&nbsp;
<span>$ultimo_contacto</span></a>";
// echo $ultimo_contacto;
} }
} elseif ($monitor_ok > 0)
echo "<td class='$tdcolor' align='center'><img src='images/b_green.gif'>";
elseif ($numero_datamodules > 0)
echo "<td class='$tdcolor' align='center'><img src='images/b_white.gif'>";
elseif ($monitor_down > 0)
echo "<td class='$tdcolor' align='center'><img src='images/b_down.gif'>";
} else
echo "<td class='$tdcolor' align='center'><img src='images/b_blue.gif'>";
// checks if an alert was fired recently
echo "<td class='$tdcolor' align='center'>";
if (check_alert_fired($id_agente) == 1)
echo "<img src='images/dot_red.gif'>";
else
echo "<img src='images/dot_green.gif'>";
} // writing agent data echo "<td class='$tdcolor'>";
} // Disabled agent if ( $ultimo_contacto == "0000-00-00 00:00:00")
echo $lang_label["never"];
else {
$ultima = strtotime($ultimo_contacto);
$ahora = strtotime("now");
$diferencia = $ahora - $ultima;
if ($biginterval > 0){
$percentil = round($diferencia/(($biginterval*2) / 100));
} else {
echo "N/A";
}
echo "<a href='#' class='info2'><img src='reporting/fgraph.php?tipo=progress&amp;percent=".$percentil."&amp;height=15&amp;width=80' border='0'>&nbsp;
<span>$ultimo_contacto</span></a>";
// echo $ultimo_contacto;
}
} // If pertenece/belongs to group
} }
echo "<tr><td colspan='8'><div class='raya'></div></td></tr>"; echo "<tr><td colspan='8'><div class='raya'></div></td></tr>";
echo "</table><br>"; echo "</table><br>";

View File

@ -110,12 +110,21 @@ 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
$sql_maxi ="select MAX(module_interval) from tagente_modulo where id_agente = ".$id_agente;
$result_maxi=mysql_query($sql_maxi);
if ($row_maxi=mysql_fetch_array($result_maxi))
if ($row_maxi[0] > 0 )
$intervalo = $row_maxi[0];
if ($intervalo > 0){ if ($intervalo > 0){
$percentil = round($diferencia/(($intervalo*2) / 100)); $percentil = round($diferencia/(($intervalo*2) / 100));
} else { } else {
echo "N/A"; $percentil = -1;
} }
echo '<tr><td class="datos"><b>'.$lang_label["next_contact"].'</b> <td class="datos2">'; echo '<tr><td class="datos"><b>'.$lang_label["next_contact"].'</b> <td class="datos2">';
echo "<img src='reporting/fgraph.php?tipo=progress&percent=".$percentil."&height=20&width=200'>"; echo "<img src='reporting/fgraph.php?tipo=progress&percent=".$percentil."&height=20&width=200'>";
echo "</td></tr></table>"; echo "</td></tr></table>";

View File

@ -49,9 +49,6 @@ if (comprueba_login() == 0)
$contador_grupo = 0; $contador_grupo = 0;
$contador_agente=0; $contador_agente=0;
$array_index = 0; $array_index = 0;
$estado_grupo_ok =0;
$estado_grupo_down =0;
$estado_grupo_bad =0;
// Recorro cada grupo para ver el estado de todos los modulos // Recorro cada grupo para ver el estado de todos los modulos
foreach ($mis_grupos as $migrupo) foreach ($mis_grupos as $migrupo)
if ($migrupo != "") { if ($migrupo != "") {
@ -65,58 +62,51 @@ if (comprueba_login() == 0)
$grupo[$array_index]["id_grupo"]=$migrupo; $grupo[$array_index]["id_grupo"]=$migrupo;
$existen_agentes =0; $existen_agentes =0;
$sql1="SELECT * FROM tagente WHERE disabled=0 AND id_grupo =".$migrupo; $sql1="SELECT * FROM tagente WHERE disabled=0 AND id_grupo =".$migrupo;
if ($result1=mysql_query($sql1)) if ($result1=mysql_query($sql1)){
while ($row1 = mysql_fetch_array($result1)){ while ($row1 = mysql_fetch_array($result1)){
$existen_agentes =1; $existen_agentes =1;
$id_agente=$row1["id_agente"]; $id_agente=$row1["id_agente"];
$ultimo_contacto = $row1["ultimo_contacto"];
$intervalo = $row1["intervalo"];
$ahora=date("Y/m/d H:i:s");
if ($ultimo_contacto <> "")
$seconds = strtotime($ahora) - strtotime($ultimo_contacto);
else
$seconds = -100000;
# Defines if Agent is down (interval x 2 > time last contact)
$down=0;
if ($seconds >= ($intervalo*2)){ // if Agent is down an alert is shown
$grupo[$array_index]["down"]++; // Estado grupo, agent down
$estado_grupo_down++;
$down=1;
}
// Check for recent alerts // Check for recent alerts
if (check_alert_fired($id_agente) == 1){ if (check_alert_fired($id_agente) == 1){
$grupo[$array_index]["alerts"]++; $grupo[$array_index]["alerts"]++;
} }
$grupo[$array_index]["agent"]++; $grupo[$array_index]["agent"]++;
$grupo[$array_index]["group"]=dame_nombre_grupo($migrupo); $grupo[$array_index]["group"]=dame_nombre_grupo($migrupo);
$contador_agente++; // Estado grupo, agent $contador_agente++; // Estado grupo, agent
if ($down == 0){ $sql3="SELECT * FROM tagente_estado WHERE id_agente = ".$row1["id_agente"];
$sql3="SELECT * FROM tagente_estado WHERE estado != 100 and id_agente = ".$row1["id_agente"]; $result3=mysql_query($sql3);
$result3=mysql_query($sql3); while ($row3 = mysql_fetch_array($result3)){
while ($row3 = mysql_fetch_array($result3)){ $estado = $row3["estado"];
if ($row3["datos"] !=0){ // Get module interval
$estado_grupo_ok++; $ahora=date("Y/m/d H:i:s");
$grupo[$array_index]["ok"]++; // Estado grupo, agent ok $sql4="SELECT * FROM tagente_modulo WHERE id_agente_modulo = ".$row3["id_agente_modulo"];
} $result4=mysql_query($sql4);
else { if ($row4 = mysql_fetch_array($result4)){
$estado_grupo_bad++; $module_interval = $row4["module_interval"];
$grupo[$array_index]["bad"]++; // Estado grupo, agent BAD if ($module_interval !=0)
} $intervalo_comp = $module_interval;
else
$intervalo_comp = $intervalo;
} }
$sql2="SELECT * FROM tagente_estado WHERE estado = 100 and id_agente = ".$row1["id_agente"]; $ultimo_contacto_modulo = $row3["timestamp"];
$result2=mysql_query($sql2); # Defines if module is down (interval x 2 > time last contact)
while ($row2 = mysql_fetch_array($result2)){ if ($ultimo_contacto_modulo != "2000-00-00 00:00:00"){
$sql3="SELECT * FROM tagente_estado WHERE id_agente_modulo = ".$row2["id_agente_modulo"]; $seconds = strtotime($ahora) - strtotime($ultimo_contacto_modulo);
$result3=mysql_query($sql3); if ($seconds >= ($intervalo_comp*2)){
$row3 = mysql_fetch_array($result3); $grupo[$array_index]["down"]++;
if ($row3["datos"] !=0){
$estado_grupo_ok++;
$grupo[$array_index]["data"]++; // Data module
} }
elseif ($estado != 100) {
if ($row3["datos"] !=0)
$grupo[$array_index]["ok"]++;
else
$grupo[$array_index]["bad"]++;
} elseif ($estado == 100) // For data module, not monitors
$grupo[$array_index]["data"]++; // Data module
} }
} }
} }
}
if ($existen_agentes == 1){ if ($existen_agentes == 1){
$array_index++; $array_index++;
} }

View File

@ -43,7 +43,6 @@ if (comprueba_login() == 0) {
$est_datos = $row_t["datos"]; $est_datos = $row_t["datos"];
$est_cambio = $row_t["cambio"]; $est_cambio = $row_t["cambio"];
$est_interval = $row_t["module_interval"]; $est_interval = $row_t["module_interval"];
if (($est_interval != $intervalo) && ($est_interval > 0)) { if (($est_interval != $intervalo) && ($est_interval > 0)) {
$temp_interval = $est_interval; $temp_interval = $est_interval;
} else { } else {

View File

@ -1390,18 +1390,20 @@ function progress_bar($progress,$width,$height) {
$fill = ImageColorAllocate($image,44,81,150); $fill = ImageColorAllocate($image,44,81,150);
ImageFilledRectangle($image,0,0,$width-1,$height-1,$back); ImageFilledRectangle($image,0,0,$width-1,$height-1,$back);
if ($rating > 100)
ImageFilledRectangle($image,1,1,$ratingbar,$height-1,$red);
else
ImageFilledRectangle($image,1,1,$ratingbar,$height-1,$fill);
ImageRectangle($image,0,0,$width-1,$height-1,$border); ImageRectangle($image,0,0,$width-1,$height-1,$border);
if ($rating > 50)
if ($rating > 100)
ImageTTFText($image, 8, 0, ($width/3)-($width/10), ($height/2)+($height/5), $back, $config_fontpath,$lang_label["out_of_limits"]); if (($rating > 100) || ($rating < 0)){
else ImageFilledRectangle($image,1,1,$width-1,$height-1,$red);
ImageTTFText($image, 8, 0, ($width/2)-($width/10), ($height/2)+($height/5), $back, $config_fontpath, $rating."%"); ImageTTFText($image, 8, 0, ($width/3)-($width/10), ($height/2)+($height/5), $back, $config_fontpath,$lang_label["out_of_limits"]);
else }
ImageTTFText($image, 8, 0, ($width/2)-($width/10), ($height/2)+($height/5), $border, $config_fontpath, $rating."%"); else {
ImageFilledRectangle($image,1,1,$ratingbar,$height-1,$fill);
if ($rating > 50)
ImageTTFText($image, 8, 0, ($width/2)-($width/10), ($height/2)+($height/5), $back, $config_fontpath, $rating."%");
else
ImageTTFText($image, 8, 0, ($width/2)-($width/10), ($height/2)+($height/5), $border, $config_fontpath, $rating."%");
}
imagePNG($image); imagePNG($image);
imagedestroy($image); imagedestroy($image);
} }