2007-04-18 Sancho Lerena <slerena@artica.es>
* include/styles/pandora.css: Added frame and changed basic form input styles (fixed the old problem with radio and checkboxes). * include/functions_db.php: Finished function agent_add_address(). Added functions: agent_delete_address(), give_agent_address() and give_agent_address_from_list(). * include/languages/language_en.php: More strings ! * include/functions.php: Added numeric render for graph Y scale and for numeric data output in screen: format_for_graph(). * pandoradb.sql: Several small fixes and cleanup (deleted drop check). * operation/agentes/estado_alertas.php: Fixed old bug with visualization of alerts (min/max) vs (max/min). Now alert is a real value, not integer. * operation/agentes/datos_agente.php: Better render for numeric (float) data. * operation/agentes/estado_ultimopaquete.php: Better render for numeric (float) data and fixed a small costemic bug. * operation/agentes/estado_generalagente.php: Fixed a small costemic bug, list of ip's have some white space before and this have better visualization for user due to combo style stripping some space. * reporting/fgraph.php: Graph improvement: graphs now could show alerts associated to an agent and draw alert limits. Preprocessor function is now used to render axis label with (M,K) symbols and decimal commas. Title and subtitle has been improved. * reporting/stat_win.php: Graph menu improvement. Fully completed work. This should work for final version without more changes. * godmode/agentes/agent_template.php: Template/Wizard module assigment form for agent. * godmode/agentes/alert_manager.php: Several fixes (links) and alert max/min render. * godmode/agentes/configurar_agente.php: Fixed several navitation bugs. Added agent ip addition/deletion code. * godmode/agentes/agent_manager.php: Address list management code. * godmode/modules/module_list.php: Deleted link to "module type editor" and create button: This has no sense since there is no moduletype editor yet :-) git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@425 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
09dee71b65
commit
660665348c
|
@ -1,3 +1,57 @@
|
|||
2007-04-18 Sancho Lerena <slerena@artica.es>
|
||||
|
||||
* include/styles/pandora.css: Added frame and changed basic form input
|
||||
styles (fixed the old problem with radio and checkboxes).
|
||||
|
||||
* include/functions_db.php: Finished function
|
||||
agent_add_address(). Added functions: agent_delete_address(),
|
||||
give_agent_address() and give_agent_address_from_list().
|
||||
|
||||
* include/languages/language_en.php: More strings !
|
||||
|
||||
* include/functions.php: Added numeric render for graph Y scale
|
||||
and for numeric data output in screen: format_for_graph().
|
||||
|
||||
* pandoradb.sql: Several small fixes and cleanup (deleted drop check).
|
||||
|
||||
* operation/agentes/estado_alertas.php: Fixed old bug with
|
||||
visualization of alerts (min/max) vs (max/min). Now alert is a
|
||||
real value, not integer.
|
||||
|
||||
* operation/agentes/datos_agente.php: Better render for numeric
|
||||
(float) data.
|
||||
|
||||
* operation/agentes/estado_ultimopaquete.php: Better render for numeric
|
||||
(float) data and fixed a small costemic bug.
|
||||
|
||||
* operation/agentes/estado_generalagente.php: Fixed a small
|
||||
costemic bug, list of ip's have some white space before and this
|
||||
have better visualization for user due to combo style stripping
|
||||
some space.
|
||||
|
||||
* reporting/fgraph.php: Graph improvement: graphs now could show
|
||||
alerts associated to an agent and draw alert limits. Preprocessor
|
||||
function is now used to render axis label with (M,K) symbols and
|
||||
decimal commas. Title and subtitle has been improved.
|
||||
|
||||
* reporting/stat_win.php: Graph menu improvement. Fully completed
|
||||
work. This should work for final version without more changes.
|
||||
|
||||
* godmode/agentes/agent_template.php: Template/Wizard module
|
||||
assigment form for agent.
|
||||
|
||||
* godmode/agentes/alert_manager.php: Several fixes (links) and
|
||||
alert max/min render.
|
||||
|
||||
* godmode/agentes/configurar_agente.php: Fixed several navitation
|
||||
bugs. Added agent ip addition/deletion code.
|
||||
|
||||
* godmode/agentes/agent_manager.php: Address list management code.
|
||||
|
||||
* godmode/modules/module_list.php: Deleted link to "module type
|
||||
editor" and create button: This has no sense since there is no
|
||||
moduletype editor yet :-)
|
||||
|
||||
2007-04-16 Manuel Arostegui <marostegui@artica.es>
|
||||
|
||||
* pandora_console.spec: Small changes to adapt the RPM to the
|
||||
|
|
|
@ -71,15 +71,27 @@ if (isset($_GET["creacion"])){
|
|||
sec2=operation/agentes/ver_agente&id_agente=".$id_agente."'>
|
||||
<img src='images/lupa.gif' border='0' align='middle'></a>";
|
||||
}
|
||||
?>
|
||||
<tr><td class="datos2"><b><?php echo $lang_label["ip_address"]?></b>
|
||||
<td class="datos2">
|
||||
<input type="text" name="direccion" size="30" value="
|
||||
<?php echo $direccion_agente ?>"></td>
|
||||
<!-- Combo for group -->
|
||||
<tr><td class="datos"><b><?php echo $lang_label["group"]?></b>
|
||||
<td class="datos"><select name="grupo" class="w130">
|
||||
<?php
|
||||
|
||||
echo '<tr><td class="datos2">';
|
||||
echo '<b>'.$lang_label["ip_address"].'</b>';
|
||||
echo '<td class="datos2">';
|
||||
echo '<input type="text" name="direccion" size="12" value="'.$direccion_agente.'">';
|
||||
echo " ";
|
||||
|
||||
echo '<select name="address_list">';
|
||||
$sql1 = "SELECT * FROM taddress, taddress_agent
|
||||
WHERE taddress.id_a = taddress_agent.id_a
|
||||
AND taddress_agent.id_agent = $id_agente";
|
||||
if ($result=mysql_query($sql1))
|
||||
while ($row=mysql_fetch_array($result)){
|
||||
echo "<option value='".salida_limpia($row["ip"])."'>".salida_limpia($row["ip"])." ";
|
||||
}
|
||||
echo "<input name='delete_ip' type=checkbox value='1'> ".$lang_label["delete_sel"];
|
||||
echo "</td>";
|
||||
|
||||
echo '<tr><td class="datos"><b>'.$lang_label["group"].'</b>';
|
||||
echo '<td class="datos"><select name="grupo" class="w130">';
|
||||
|
||||
if (isset($grupo)){
|
||||
echo "<option value='".$grupo."'>".dame_grupo($grupo);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,171 @@
|
|||
<?PHP
|
||||
|
||||
// Pandora FMS - the Free monitoring system
|
||||
// ========================================
|
||||
// Copyright (c) 2004-2007 Sancho Lerena, slerena@gmail.com
|
||||
// Main PHP/SQL code development and project architecture and management
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; version 2
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
|
||||
|
||||
// Load global vars
|
||||
require("include/config.php");
|
||||
|
||||
// Access control
|
||||
if (give_acl($id_user, 0, "AW")!=1) {
|
||||
audit_db($id_usuario,$REMOTE_ADDR, "ACL Violation","Trying to access agent manager");
|
||||
require ("general/noaccess.php");
|
||||
exit;
|
||||
};
|
||||
|
||||
// ==========================
|
||||
// TEMPLATE ASSIGMENT LOGIC
|
||||
// ==========================
|
||||
if (isset($_POST["template_id"])){
|
||||
// Take agent data
|
||||
$sql1='SELECT * FROM tagente WHERE id_agente = '.$id_agente;
|
||||
$result=mysql_query($sql1);
|
||||
if ($row=mysql_fetch_array($result)){
|
||||
$intervalo = $row["intervalo"];
|
||||
$nombre_agente = $row["nombre"];
|
||||
$direccion_agente =$row["direccion"];
|
||||
$ultima_act = $row["ultimo_contacto"];
|
||||
$ultima_act_remota =$row["ultimo_contacto_remoto"];
|
||||
$comentarios = $row["comentarios"];
|
||||
$id_grupo = $row["id_grupo"];
|
||||
$id_os= $row["id_os"];
|
||||
$os_version = $row["os_version"];
|
||||
$agent_version = $row["agent_version"];
|
||||
$disabled= $row["disabled"];
|
||||
$agent_type= $row["agent_type"];
|
||||
$server = $row["id_server"];
|
||||
}
|
||||
|
||||
$id_np = $_POST["template_id"];
|
||||
$sql1 = "SELECT * FROM tnetwork_profile_component
|
||||
WHERE id_np = $id_np";
|
||||
$result=mysql_query($sql1);
|
||||
while ($row=mysql_fetch_array($result)){
|
||||
$sql2 = "SELECT * FROM tnetwork_component
|
||||
WHERE id_nc = ".$row["id_nc"];
|
||||
$result2=mysql_query($sql2);
|
||||
while ($row2=mysql_fetch_array($result2)){
|
||||
// Insert each module from tnetwork_component into agent
|
||||
$module_sql = "INSERT INTO tagente_modulo
|
||||
(id_agente, id_tipo_modulo, descripcion, nombre, max, min, module_interval, tcp_port, tcp_send, tcp_rcv, snmp_community, snmp_oid, ip_target, id_module_group)
|
||||
VALUES ( $id_agente,
|
||||
'".$row2["type"]."',
|
||||
'".$row2["description"]."',
|
||||
'".$row2["name"]."',
|
||||
'".$row2["max"]."',
|
||||
'".$row2["min"]."',
|
||||
'".$row2["module_interval"]."',
|
||||
'".$row2["tcp_port"]."',
|
||||
'".$row2["tcp_send"]."',
|
||||
'".$row2["tcp_rcv"]."',
|
||||
'".$row2["snmp_community"]."',
|
||||
'".$row2["snmp_oid"]."',
|
||||
'$direccion_agente',
|
||||
'".$row2["id_module_group"]."'
|
||||
)";
|
||||
mysql_query ($module_sql);
|
||||
}
|
||||
}
|
||||
echo "<div class='suc'>";
|
||||
echo "Modules added successfully";
|
||||
echo "</div>";
|
||||
}
|
||||
|
||||
// Main header
|
||||
|
||||
echo "<h2>".$lang_label["agent_conf"]." > ".$lang_label["network_templates"];
|
||||
echo "</h2>";
|
||||
|
||||
// ==========================
|
||||
// TEMPLATE ASSIGMENT FORM
|
||||
// ==========================
|
||||
|
||||
echo "<h3>".$lang_label["available_templates"]."</h3>";
|
||||
echo "<table width=300 border=0>";
|
||||
echo "<tr><td><br>";
|
||||
|
||||
echo "<form method=post action='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=template&id_agente=$id_agente'>";
|
||||
echo "<select name='template_id'>";
|
||||
$sql1='SELECT * FROM tnetwork_profile ORDER BY name';
|
||||
$result=mysql_query($sql1);
|
||||
if (mysql_num_rows($result))
|
||||
while ($row=mysql_fetch_array($result))
|
||||
echo "<option value='".$row["id_np"]."'>".$row["name"];
|
||||
echo "</select>";
|
||||
|
||||
echo "<td>";
|
||||
echo "<input type='submit' class='sub next' name='crt' value='".$lang_label["assign"]."'>";
|
||||
echo "</table>";
|
||||
echo "</form>";
|
||||
|
||||
// ==========================
|
||||
// MODULE VISUALIZATION TABLE
|
||||
// ==========================
|
||||
echo "<h3>".$lang_label["assigned_modules"]."</h3>";
|
||||
|
||||
$sql1='SELECT * FROM tagente_modulo WHERE id_agente = "'.$id_agente.'"
|
||||
ORDER BY id_module_group, nombre ';
|
||||
$result=mysql_query($sql1);
|
||||
if ($row=mysql_num_rows($result)){
|
||||
echo '<table width="700" cellpadding="3" cellspacing="3" class="fon">';
|
||||
echo '<tr>';
|
||||
echo "<th>".$lang_label["module_name"];
|
||||
echo "<th>".$lang_label["type"];
|
||||
echo "<th>".$lang_label["description"];
|
||||
echo "<th width=50>".$lang_label["action"];
|
||||
$color=1;$last_modulegroup = "0";
|
||||
while ($row=mysql_fetch_array($result)){
|
||||
if ($color == 1){
|
||||
$tdcolor="datos";
|
||||
$color =0;
|
||||
} else {
|
||||
$tdcolor="datos2";
|
||||
$color =1;
|
||||
}
|
||||
$id_tipo = $row["id_tipo_modulo"];
|
||||
$nombre_modulo =$row["nombre"];
|
||||
$descripcion = $row["descripcion"];
|
||||
echo "<tr><td class='".$tdcolor."_id'>".$nombre_modulo;
|
||||
echo "<td class='".$tdcolor."f9'>";
|
||||
if ($id_tipo > 0) {
|
||||
echo "<img src='images/".show_icon_type($id_tipo)."' border=0>";
|
||||
}
|
||||
echo "<td class='$tdcolor' title='$descripcion'>".substr($descripcion,0,30)."</td>";
|
||||
echo "<td class='$tdcolor'>";
|
||||
if ($id_tipo != -1)
|
||||
echo "<a href='index.php?sec=gagente&
|
||||
tab=module&
|
||||
sec2=godmode/agentes/configurar_agente&tab=template&
|
||||
id_agente=".$id_agente."&
|
||||
delete_module=".$row["id_agente_modulo"]."'>
|
||||
<img src='images/cross.png' border=0 alt='".$lang_label["delete"]."'>
|
||||
</b></a> ";
|
||||
echo "<a href='index.php?sec=gagente&
|
||||
sec2=godmode/agentes/configurar_agente&
|
||||
id_agente=".$id_agente."&
|
||||
tab=module&
|
||||
update_module=".$row["id_agente_modulo"]."#modules'>
|
||||
<img src='images/config.gif' border=0 alt='".$lang_label["update"]."' onLoad='type_change()'></b></a>";
|
||||
}
|
||||
echo "<tr><td colspan='7'><div class='raya'></div></td></tr>";
|
||||
echo "</table>";
|
||||
} else
|
||||
echo "<div class='nf'>No modules</div>";
|
||||
|
||||
|
||||
?>
|
|
@ -65,17 +65,32 @@ $result=mysql_query($sql1);
|
|||
$string = $string."<tr><td class='$tdcolor'>".$nombre_modulo."/".$tipo_modulo;
|
||||
$string = $string."<td class=$tdcolor>".$nombre_alerta;
|
||||
$string = $string."<td class='$tdcolor'>".$row3["time_threshold"];
|
||||
$string = $string."<td class='$tdcolor'>".$row3["dis_min"]."/".$row3["dis_max"];
|
||||
|
||||
$mytempdata = fmod($row3["dis_min"], 1);
|
||||
if ($mytempdata == 0)
|
||||
$mymin = intval($row3["dis_min"]);
|
||||
else
|
||||
$mymin = $row3["dis_min"];
|
||||
$mymin = format_for_graph($mymin );
|
||||
|
||||
$mytempdata = fmod($row3["dis_max"], 1);
|
||||
if ($mytempdata == 0)
|
||||
$mymax = intval($row3["dis_max"]);
|
||||
else
|
||||
$mymax = $row3["dis_max"];
|
||||
$mymax = format_for_graph($mymax );
|
||||
|
||||
$string = $string."<td class='$tdcolor'>".$mymin." / ".$mymax;
|
||||
$string = $string."<td class='$tdcolor'>".salida_limpia($row3["descripcion"]);
|
||||
$string = $string."<td class='$tdcolor'>";
|
||||
$id_grupo = dame_id_grupo($id_agente);
|
||||
if (give_acl($id_user, $id_grupo, "LW")==1){
|
||||
$string = $string."<a href='index.php?sec=gagente&
|
||||
sec2=godmode/agentes/configurar_agente&
|
||||
sec2=godmode/agentes/configurar_agente&tab=alert&
|
||||
id_agente=".$id_agente."&delete_alert=".$row3["id_aam"]."'>
|
||||
<img src='images/cross.png' border=0 alt='".$lang_label["delete"]."'></a> ";
|
||||
$string = $string."<a href='index.php?sec=gagente&
|
||||
sec2=godmode/agentes/configurar_agente&
|
||||
sec2=godmode/agentes/configurar_agente&tab=alert&
|
||||
id_agente=".$id_agente."&update_alert=".$row3["id_aam"]."#alerts'>
|
||||
<img src='images/config.gif' border=0 alt='".$lang_label["update"]."'></a>";
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
// Pandora FMS - the Free monitoring system
|
||||
// ========================================
|
||||
|
||||
// Copyright (c) 2004-2007 Sancho Lerena, slerena@gmail.com
|
||||
// Main PHP/SQL code development and project architecture and management
|
||||
// Copyright (c) 2004-2007 Raul Mateos Martin, raulofpandora@gmail.com
|
||||
|
@ -32,8 +33,12 @@ if (give_acl($id_user, 0, "AW")!=1) {
|
|||
|
||||
if (isset($_GET["id_agente"]))
|
||||
$id_agente = $_GET["id_agente"];
|
||||
else
|
||||
else {
|
||||
$id_agente = -1;
|
||||
if (isset($_POST["update_agent"])) { // if modified some agent paramenter
|
||||
$id_agente = entrada_limpia($_POST["id_agente"]);
|
||||
}
|
||||
}
|
||||
|
||||
// Init vars
|
||||
$descripcion = "";
|
||||
|
@ -149,7 +154,7 @@ echo "<a href='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=
|
|||
echo "</li>";
|
||||
|
||||
echo "<li class='nomn'>";
|
||||
echo "<a href='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=templatet&id_agente=$id_agente'><img src='images/network.gif' width='16' class='top' border=0> NC Templates</a>";
|
||||
echo "<a href='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=template&id_agente=$id_agente'><img src='images/network.gif' width='16' class='top' border=0> NC Templates</a>";
|
||||
echo "</li>";
|
||||
|
||||
echo "</ul>";
|
||||
|
@ -183,13 +188,6 @@ if (isset($_GET["delete_alert"])){ // if modified some parameter
|
|||
|
||||
}
|
||||
|
||||
// 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
|
||||
|
@ -259,6 +257,7 @@ if (isset($_POST["update_agent"])) { // if modified some agent paramenter
|
|||
$id_agente = entrada_limpia($_POST["id_agente"]);
|
||||
$nombre_agente = entrada_limpia($_POST["agente"]);
|
||||
$direccion_agente = entrada_limpia($_POST["direccion"]);
|
||||
$old_agent_address = give_agent_address ($id_agente);
|
||||
$grupo = entrada_limpia($_POST["grupo"]);
|
||||
$intervalo = entrada_limpia($_POST["intervalo"]);
|
||||
$comentarios = entrada_limpia($_POST["comentarios"]);
|
||||
|
@ -266,6 +265,10 @@ if (isset($_POST["update_agent"])) { // if modified some agent paramenter
|
|||
$id_os = entrada_limpia($_POST["id_os"]);
|
||||
$disabled = entrada_limpia($_POST["disabled"]);
|
||||
$id_server = entrada_limpia($_POST["id_server"]);
|
||||
|
||||
if ($direccion_agente != $old_agent_address){
|
||||
agent_add_address ($id_agente, $direccion_agente);
|
||||
}
|
||||
if ($id_server != ""){
|
||||
$sql_update ="UPDATE tagente
|
||||
SET disabled = ".$disabled." , id_os = ".$id_os." , modo = ".$modo." , nombre = '".$nombre_agente."', direccion = '".$direccion_agente."', id_grupo = '".$grupo."', intervalo = '".$intervalo."', comentarios = '".$comentarios."', id_server = '".$id_server."'
|
||||
|
@ -275,6 +278,13 @@ if (isset($_POST["update_agent"])) { // if modified some agent paramenter
|
|||
SET disabled = ".$disabled." , id_os = ".$id_os." , modo = ".$modo." , nombre = '".$nombre_agente."', direccion = '".$direccion_agente."', id_grupo = '".$grupo."', intervalo = '".$intervalo."', comentarios = '".$comentarios."'
|
||||
WHERE id_agente = '".$id_agente."'";
|
||||
}
|
||||
|
||||
// Delete one of associateds IP's ?
|
||||
if (isset($_POST["delete_ip"])) {
|
||||
$delete_ip = $_POST["address_list"];
|
||||
agent_delete_address ($id_agente, $delete_ip);
|
||||
}
|
||||
|
||||
$result=mysql_query($sql_update);
|
||||
if (! $result) {
|
||||
echo "<h3 class='error'>".$lang_label["update_agent_no"]."</h3>";
|
||||
|
@ -618,6 +628,8 @@ case "module": require "module_manager.php";
|
|||
break;
|
||||
case "alert": require "alert_manager.php";
|
||||
break;
|
||||
case "template":require "agent_template.php";
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -83,9 +83,7 @@ if (give_acl($id_user, 0, "PM")==1) {
|
|||
border='0'>
|
||||
</td>
|
||||
<td class='$tdcolor'>
|
||||
<b><a href='index.php?sec=gmodules&
|
||||
sec2=godmode/modules/manage_modules&
|
||||
id_module=".$row["id_tipo"]."'>".$row["nombre"]."</a>
|
||||
<b>".$row["nombre"]."
|
||||
</b></td>
|
||||
<td class='$tdcolor'>
|
||||
".give_modulecategory_name ($row["categoria"])."
|
||||
|
@ -100,7 +98,9 @@ if (give_acl($id_user, 0, "PM")==1) {
|
|||
echo "<tr><td colspan='4' align='right'>";
|
||||
echo "<form method=post action='index.php?sec=gmodules&
|
||||
sec2=godmode/modules/manage_modules&create=1'>";
|
||||
/* not used yet
|
||||
echo "<input type='submit' class='sub next' name='crt' value='".$lang_label["create_module"]."'>";
|
||||
*/
|
||||
echo "</form></td></tr></table>";
|
||||
|
||||
} // Fin pagina
|
||||
|
|
|
@ -363,7 +363,9 @@ function pagination ($count, $url, $offset ) {
|
|||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Render data in a fashion way :-)
|
||||
// ---------------------------------------------------------------
|
||||
function format_numeric ( $number, $decimals=2, $dec_point=".", $thousands_sep=",") {
|
||||
if ($number == 0)
|
||||
return 0;
|
||||
|
@ -374,4 +376,16 @@ function format_numeric ( $number, $decimals=2, $dec_point=".", $thousands_sep="
|
|||
return number_format ($number, 0, $dec_point, $thousands_sep);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Render numeric data in a easy way to the user
|
||||
// ---------------------------------------------------------------
|
||||
function format_for_graph ( $number ) {
|
||||
if ($number > "1000000")
|
||||
return number_format ($number/1000000, 1, ".", ",")." M";
|
||||
if ($number > "1000")
|
||||
return number_format ($number/1000, 1, ".", ",")." K";
|
||||
return $number;
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
|
|
@ -923,32 +923,119 @@ function give_network_profile_name ($id_np){
|
|||
|
||||
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)
|
||||
$id_address =-1;
|
||||
$address_attached = 0;
|
||||
|
||||
// Check if already is attached to agent
|
||||
$query1="SELECT * FROM taddress_agent, taddress
|
||||
WHERE taddress_agent.id_a = taddress.id_a
|
||||
AND ip = '$ip_address'
|
||||
AND id_agent = $id_agent";
|
||||
if ($resq1=mysql_query($query1)){
|
||||
if ($rowdup=mysql_fetch_array($resq1)){
|
||||
$address_attached = 1;
|
||||
}
|
||||
}
|
||||
if ($address_attached == 1)
|
||||
return;
|
||||
// Look for a record with this IP Address
|
||||
$query1="SELECT * FROM taddress WHERE ip = '$ip_address'";
|
||||
if ($resq1=mysql_query($query1)){
|
||||
if ($rowdup=mysql_fetch_array($resq1)){
|
||||
$id_address = $rowdup["id_a"];
|
||||
$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]);
|
||||
if ($address_exist == 0){
|
||||
// Create IP address in tadress table
|
||||
$query = "INSERT INTO taddress
|
||||
(ip) VALUES
|
||||
('$ip_address')";
|
||||
$res = mysql_query ($query);
|
||||
$id_address = mysql_insert_id ();
|
||||
}
|
||||
// Add address to agent
|
||||
$query = "INSERT INTO taddress_agent
|
||||
(id_a, id_agent) VALUES
|
||||
($id_address,$id_agent)";
|
||||
$res = mysql_query ($query);
|
||||
|
||||
// Change main address in agent to whis one
|
||||
/* Not needed, configurar_agente does automatically on every update
|
||||
$query = "UPDATE tagente
|
||||
(direccion) VALUES
|
||||
($ip_address)
|
||||
WHERE id_agente = $id_agent ";
|
||||
$res = mysql_query ($query);
|
||||
*/
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// De-associate IP address to an agent (delete)
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
function agent_delete_address ($id_agent, $ip_address) {
|
||||
require("config.php");
|
||||
$address_exist = 0;
|
||||
$id_address =-1;
|
||||
$query1="SELECT * FROM taddress_agent, taddress
|
||||
WHERE taddress_agent.id_a = taddress.id_a
|
||||
AND ip = '$ip_address'
|
||||
AND id_agent = $id_agent";
|
||||
if ($resq1=mysql_query($query1)){
|
||||
$rowdup=mysql_fetch_array($resq1);
|
||||
$id_ag = $rowdup["id_ag"];
|
||||
$id_a = $rowdup["id_a"];
|
||||
$sql_3="DELETE FROM taddress_agent
|
||||
WHERE id_ag = $id_ag";
|
||||
$result_3=mysql_query($sql_3);
|
||||
}
|
||||
// Need to change main address ?
|
||||
if (give_agent_address ($id_agent) == $ip_address){
|
||||
$new_ip = give_agent_address_from_list ($id_agent);
|
||||
// Change main address in agent to whis one
|
||||
$query = "UPDATE tagente
|
||||
(direccion) VALUES
|
||||
($new_ip)
|
||||
WHERE id_agente = $id_agent ";
|
||||
$res = mysql_query ($query);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Returns (main) agent address given id
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
function give_agent_address ($id_agent){
|
||||
require("config.php");
|
||||
$query1="SELECT * FROM tagente WHERE id_agente = $id_agent";
|
||||
$resq1=mysql_query($query1);
|
||||
if ($rowdup=mysql_fetch_array($resq1))
|
||||
$pro=$rowdup["direccion"];
|
||||
else
|
||||
$pro = "";
|
||||
return $pro;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Returns the first agent address given id taken from associated addresses
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
function give_agent_address_from_list ($id_agent){
|
||||
require("config.php");
|
||||
$query1="SELECT * FROM taddress_agent, taddress
|
||||
WHERE taddress_agent.id_a = taddress.id_a
|
||||
AND id_agent = $id_agent";
|
||||
if ($resq1=mysql_query($query1)){
|
||||
$rowdup=mysql_fetch_array($resq1);
|
||||
$pro=$rowdup["ip"];
|
||||
}
|
||||
else
|
||||
$pro = "";
|
||||
return $pro;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
|
|
|
@ -750,6 +750,9 @@ $lang_label["no_netprofiles"]="There are no defined network profiles";
|
|||
$lang_label["site_news"]="Site news";
|
||||
$lang_label["at"]="At";
|
||||
$lang_label["says"]="says";
|
||||
$lang_label["delete_sel"]="Delete selected";
|
||||
$lang_label["available_templates"]="Available templates";
|
||||
$lang_label["assign"]="Assign";
|
||||
global $lang_label;
|
||||
global $help_label;
|
||||
?>
|
|
@ -32,21 +32,38 @@
|
|||
font-family: Verdana, sans-serif, Arial, Helvetica;
|
||||
font-size: 11px;
|
||||
}
|
||||
select, textarea, input {
|
||||
font-size: 12px;
|
||||
|
||||
input {
|
||||
padding: 4px;
|
||||
border:1px solid #eee;
|
||||
font: normal 1em/1.5em Verdana, sans-serif;
|
||||
}
|
||||
textarea {
|
||||
border: 1px solid #c0c0c0;
|
||||
padding: 5px;
|
||||
padding:4px;
|
||||
font: normal 1em/1.5em Verdana, sans-serif;
|
||||
border:1px solid #eee;
|
||||
height:100px;
|
||||
}
|
||||
input {
|
||||
border: 1px solid #c0c0c0;
|
||||
padding: 2px 3px 4px 3px;
|
||||
height: 23px;
|
||||
input.button {
|
||||
margin: 0;
|
||||
font: bold 1em Arial, Sans-serif;
|
||||
border: 1px solid #CCC;
|
||||
background: #FFF;
|
||||
padding: 2px 3px;
|
||||
margin: 10px 15px;
|
||||
}
|
||||
option {
|
||||
height: 16px;
|
||||
select {
|
||||
padding: 2px;
|
||||
border:1px solid #eee;
|
||||
font: normal 1em/1.5em Verdana, sans-serif;
|
||||
}
|
||||
checkbox {
|
||||
padding: 4px;
|
||||
border:1px solid #eee;
|
||||
font: normal 1em/1.5em Verdana, sans-serif;
|
||||
}
|
||||
|
||||
|
||||
h1, h2 {
|
||||
color: #103a3a;
|
||||
padding-bottom: 15px;
|
||||
|
@ -584,4 +601,23 @@ span.users, span.agents, span.data, span.alerts, span.time {
|
|||
padding-top: 25px;
|
||||
text-align: center;
|
||||
clear: both;
|
||||
}
|
||||
|
||||
/* New styles for data box */
|
||||
|
||||
.databox_color {
|
||||
margin: 10px 15px;
|
||||
border: 1px solid #f2f2f2;
|
||||
border-left: 3px solid #EC981F;
|
||||
}
|
||||
|
||||
.databox {
|
||||
margin: 10px 15px;
|
||||
border: 1px solid #f2f2f2;
|
||||
background-color: #FAFAFA;
|
||||
}
|
||||
|
||||
.databox_frame {
|
||||
margin: 10px 15px;
|
||||
border: 1px solid #f2f2f2;
|
||||
}
|
|
@ -79,20 +79,13 @@ function datos_raw($id_agente_modulo, $periodo){
|
|||
echo "<tr>";
|
||||
echo "<td class='".$tdcolor."' style='width:150px'>".$row["timestamp"];
|
||||
echo "<td class='".$tdcolor."'>";
|
||||
if (($row["datos"] != 0) AND (is_numeric($row["datos"]))) {
|
||||
$mytempdata = fmod($row["datos"], $row["datos"]);
|
||||
if ($mytempdata == 0)
|
||||
$myvalue = intval($row["datos"]);
|
||||
else
|
||||
$myvalue = $row["datos"];
|
||||
if ($myvalue > 1000000) { // Add sufix "M" for millions
|
||||
$mytempdata = $myvalue / 1000000;
|
||||
echo $mytempdata." M";
|
||||
} elseif ( $myvalue > 1000){ // Add sufix "K" for thousands
|
||||
$mytempdata = $myvalue / 1000;
|
||||
echo $mytempdata." K";
|
||||
} else
|
||||
echo substr($myvalue,0,12);
|
||||
if (is_numeric($row["datos"])) {
|
||||
$mytempdata = fmod($row["datos"], 1);
|
||||
if ($mytempdata == 0)
|
||||
$myvalue = intval($row["datos"]);
|
||||
else
|
||||
$myvalue = $row["datos"];
|
||||
echo format_for_graph($myvalue );
|
||||
} else
|
||||
echo substr($row["datos"],0,12);
|
||||
}
|
||||
|
|
|
@ -42,7 +42,22 @@ if (comprueba_login() == 0) {
|
|||
echo "<td class='".$tdcolor."'>".dame_nombre_alerta($data["id_alerta"]);
|
||||
echo "<td class='".$tdcolor."'>".$data["nombre"];
|
||||
echo "<td class='".$tdcolor."'>".$data["descripcion"];
|
||||
echo "<td class='".$tdcolor."'>".$data["dis_max"]."/".$data["dis_min"];
|
||||
|
||||
$mytempdata = fmod($data["dis_min"], 1);
|
||||
if ($mytempdata == 0)
|
||||
$mymin = intval($data["dis_min"]);
|
||||
else
|
||||
$mymin = $data["dis_min"];
|
||||
$mymin = format_for_graph($mymin );
|
||||
|
||||
$mytempdata = fmod($data["dis_max"], 1);
|
||||
if ($mytempdata == 0)
|
||||
$mymax = intval($data["dis_max"]);
|
||||
else
|
||||
$mymax = $data["dis_max"];
|
||||
$mymax = format_for_graph($mymax );
|
||||
|
||||
echo "<td class='".$tdcolor."'>".$mymin." / ".$mymax;
|
||||
echo "<td class='".$tdcolor."'>".$data["time_threshold"];
|
||||
if ($data["last_fired"] == "0000-00-00 00:00:00") {
|
||||
echo "<td class='".$tdcolor."f9'>".$lang_label["never"];
|
||||
|
|
|
@ -78,7 +78,7 @@ if (comprueba_login() == 0) {
|
|||
|
||||
|
||||
// Show all address for this agent, show first the main IP (taken from tagente table)
|
||||
echo "<select name='notused' size=1>";
|
||||
echo "<select style='padding:0px' 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);
|
||||
|
@ -87,13 +87,11 @@ if (comprueba_login() == 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 "<option value='".salida_limpia($row3[0])."'>".salida_limpia($row3[0])." ";
|
||||
}
|
||||
echo "</select>";
|
||||
|
||||
|
||||
|
||||
|
||||
if ($agent_type == 0) {
|
||||
echo '<tr>
|
||||
<td class="datos"><b>'.$lang_label["os"].'</b></td>
|
||||
|
@ -120,7 +118,7 @@ if (comprueba_login() == 0) {
|
|||
echo '<tr>
|
||||
<td class="datos2"><b>'.salida_limpia($lang_label["group"]).'</b></td>
|
||||
<td class="datos2" colspan="2">
|
||||
<img class="bot" src="images/groups_small/'.show_icon_group($row["id_grupo"]).'.png" > '.dame_grupo($id_grupo).'<br>'.dame_grupo($id_grupo).'</td></tr>';
|
||||
<img class="bot" src="images/groups_small/'.show_icon_group($id_grupo).'.png" > '.dame_grupo($id_grupo).'</td></tr>';
|
||||
if ($agent_type == 0) {
|
||||
echo '<tr><td class="datos"><b>'.$lang_label["agentversion"].'</b>
|
||||
<td class="datos" colspan=2>'.salida_limpia($agent_version).'</td>';
|
||||
|
|
|
@ -157,30 +157,23 @@ if (comprueba_login() == 0) {
|
|||
AND ($row3["id_tipo_modulo"] != 10)
|
||||
AND ($row3["id_tipo_modulo"] != 17)){
|
||||
echo "<td class=".$tdcolor.">";
|
||||
if (($row3["datos"] != 0) AND (is_numeric($row3["datos"]))) {
|
||||
if (is_numeric($row3["datos"])) {
|
||||
$mytempdata = fmod($row3["datos"], 1);
|
||||
if ($mytempdata == "0")
|
||||
if ($mytempdata == 0)
|
||||
$myvalue = intval($row3["datos"]);
|
||||
else
|
||||
$myvalue = $row3["datos"];
|
||||
if ($myvalue > 1000000) { // Add sufix "M" for millions
|
||||
$mytempdata = $myvalue / 1000000;
|
||||
echo format_numeric($mytempdata)." M";
|
||||
} elseif ( $myvalue > 1000){ // Add sufix "K" for thousands
|
||||
$mytempdata = $myvalue / 1000;
|
||||
echo format_numeric ($mytempdata)." K";
|
||||
} else
|
||||
echo substr($myvalue,0,12);
|
||||
} elseif ($row3["datos"] == 0)
|
||||
echo "0";
|
||||
else
|
||||
echo substr($row3["datos"],0,12);
|
||||
echo format_for_graph($myvalue );
|
||||
} else
|
||||
echo substr($row["datos"],0,12);
|
||||
|
||||
|
||||
|
||||
$handle = "stat".$nombre_tipo_modulo."_".$row3["id_agente_modulo"];
|
||||
$url = 'reporting/procesos.php?agente='.$row3["id_agente_modulo"];
|
||||
$win_handle=dechex(crc32($row3["id_agente_modulo"].$row3["nombre"]));
|
||||
echo "<td class=".$tdcolor." width='78'>";
|
||||
$graph_label = entrada_limpia($row3["nombre"]." - ".$row3["id_agente_modulo"]);
|
||||
$graph_label = entrada_limpia($row3["nombre"]);
|
||||
|
||||
echo "<a href='javascript:winopeng(\"reporting/stat_win.php?period=2419200&id=".$row3["id_agente_modulo"]."&label=".$graph_label."refresh=180000\", \"month_".$win_handle."\")'><img src='images/grafica_m.gif' border=0></a> ";
|
||||
|
||||
|
|
|
@ -1,8 +1,13 @@
|
|||
--
|
||||
-- Table structure for table `estado_consola`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `estado_consola`;
|
||||
-- Pandora FMS tables for active console (not officially included )
|
||||
|
||||
CREATE TABLE `vistas_consola` (
|
||||
`idVista` int(5) NOT NULL auto_increment,
|
||||
`nombre` varchar(50) NOT NULL,
|
||||
`descripcion` varchar(250) NOT NULL,
|
||||
PRIMARY KEY (`idVista`)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
CREATE TABLE `estado_consola` (
|
||||
`id_usuario` varchar(50) NOT NULL,
|
||||
`idPerfilActivo` int(5) NOT NULL,
|
||||
|
@ -12,11 +17,7 @@ CREATE TABLE `estado_consola` (
|
|||
PRIMARY KEY (`id_usuario`)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
--
|
||||
-- Table structure for table `objeto_consola`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `objeto_consola`;
|
||||
CREATE TABLE `objeto_consola` (
|
||||
`id_objeto` int(5) NOT NULL auto_increment,
|
||||
`nom_img` varchar(50) NOT NULL,
|
||||
|
@ -26,25 +27,17 @@ CREATE TABLE `objeto_consola` (
|
|||
`id_tipo` varchar(20) NOT NULL,
|
||||
`idVista` int(5) NOT NULL,
|
||||
PRIMARY KEY (`id_objeto`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=37;
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
--
|
||||
-- Table structure for table `perfil`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `perfil`;
|
||||
CREATE TABLE `perfil` (
|
||||
`idPerfil` int(5) NOT NULL auto_increment,
|
||||
`Nombre` varchar(50) NOT NULL,
|
||||
`Descripcion` varchar(250) NOT NULL,
|
||||
PRIMARY KEY (`idPerfil`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=3;
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
--
|
||||
-- Table structure for table `perfil_vista`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `perfil_vista`;
|
||||
CREATE TABLE `perfil_vista` (
|
||||
`idPerfil` int(5) NOT NULL,
|
||||
`idVista` int(5) NOT NULL,
|
||||
|
@ -52,33 +45,22 @@ CREATE TABLE `perfil_vista` (
|
|||
PRIMARY KEY (`idPerfil`,`idVista`)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
--
|
||||
-- Table structure for table `relacion_estado`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `relacion_estado`;
|
||||
CREATE TABLE `relacion_estado` (
|
||||
`id_objeto` int(5) NOT NULL,
|
||||
`relacion` varchar(50) NOT NULL,
|
||||
PRIMARY KEY (`id_objeto`)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
--
|
||||
-- Table structure for table `relacion_objetos`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `relacion_objetos`;
|
||||
CREATE TABLE `relacion_objetos` (
|
||||
`idObjeto1` int(5) NOT NULL,
|
||||
`idObjeto2` int(5) NOT NULL,
|
||||
PRIMARY KEY (`idObjeto1`,`idObjeto2`)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
--
|
||||
-- Table structure for table `taddress`
|
||||
--
|
||||
-- Pandora FMS official tables
|
||||
|
||||
DROP TABLE IF EXISTS `taddress`;
|
||||
CREATE TABLE `taddress` (
|
||||
`id_a` bigint(20) unsigned NOT NULL auto_increment,
|
||||
`ip` varchar(15) NOT NULL default '',
|
||||
|
@ -86,11 +68,7 @@ CREATE TABLE `taddress` (
|
|||
PRIMARY KEY (`id_a`)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
--
|
||||
-- Table structure for table `taddress_agent`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `taddress_agent`;
|
||||
CREATE TABLE `taddress_agent` (
|
||||
`id_ag` bigint(20) unsigned NOT NULL auto_increment,
|
||||
`id_a` bigint(20) unsigned NOT NULL default '0',
|
||||
|
@ -98,26 +76,17 @@ CREATE TABLE `taddress_agent` (
|
|||
PRIMARY KEY (`id_ag`)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
--
|
||||
-- Table structure for table `tagent_access`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `tagent_access`;
|
||||
CREATE TABLE `tagent_access` (
|
||||
`id_ac` bigint(20) unsigned NOT NULL auto_increment,
|
||||
`id_agent` int(11) NOT NULL default '0',
|
||||
`timestamp` datetime NOT NULL default '0000-00-00 00:00:00',
|
||||
`utimestamp` bigint(20) NOT NULL default '0',
|
||||
PRIMARY KEY (`id_ac`),
|
||||
KEY `agent_index` (`id_agent`),
|
||||
UNIQUE (`id_agent`)
|
||||
KEY `agent_index` (`id_agent`)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
--
|
||||
-- Table structure for table `tagente`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `tagente`;
|
||||
CREATE TABLE `tagente` (
|
||||
`id_agente` mediumint(8) unsigned NOT NULL auto_increment,
|
||||
`nombre` varchar(100) NOT NULL default '',
|
||||
|
@ -137,11 +106,7 @@ CREATE TABLE `tagente` (
|
|||
PRIMARY KEY (`id_agente`)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
--
|
||||
-- Table structure for table `tagente_datos`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `tagente_datos`;
|
||||
CREATE TABLE `tagente_datos` (
|
||||
`id_agente_datos` bigint(10) unsigned NOT NULL auto_increment,
|
||||
`id_agente_modulo` mediumint(8) unsigned NOT NULL default '0',
|
||||
|
@ -153,11 +118,7 @@ CREATE TABLE `tagente_datos` (
|
|||
KEY `data_index2` (`id_agente`,`id_agente_modulo`)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
--
|
||||
-- Table structure for table `tagente_datos_inc`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `tagente_datos_inc`;
|
||||
CREATE TABLE `tagente_datos_inc` (
|
||||
`id_adi` bigint(20) unsigned NOT NULL auto_increment,
|
||||
`id_agente_modulo` bigint(20) NOT NULL default '0',
|
||||
|
@ -167,11 +128,7 @@ CREATE TABLE `tagente_datos_inc` (
|
|||
KEY `data_inc_index_1` (`id_agente_modulo`)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
--
|
||||
-- Table structure for table `tagente_datos_string`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `tagente_datos_string`;
|
||||
CREATE TABLE `tagente_datos_string` (
|
||||
`id_tagente_datos_string` bigint(20) unsigned NOT NULL auto_increment,
|
||||
`id_agente_modulo` int(11) NOT NULL default '0',
|
||||
|
@ -184,11 +141,7 @@ CREATE TABLE `tagente_datos_string` (
|
|||
KEY `data_string_index_2` (`id_agente`)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
--
|
||||
-- Table structure for table `tagente_estado`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `tagente_estado`;
|
||||
CREATE TABLE `tagente_estado` (
|
||||
`id_agente_estado` int(10) unsigned NOT NULL auto_increment,
|
||||
`id_agente_modulo` int(20) NOT NULL default '0',
|
||||
|
@ -206,22 +159,14 @@ CREATE TABLE `tagente_estado` (
|
|||
KEY `status_index_2` (`id_agente_modulo`,`estado`)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
# Database: pandora
|
||||
# Table: 'tmodule'
|
||||
#
|
||||
|
||||
CREATE TABLE `tmodule` (
|
||||
`id_module` int(11) unsigned NOT NULL auto_increment,
|
||||
`name` varchar(100) NOT NULL default '',
|
||||
PRIMARY KEY (`id_module`),
|
||||
UNIQUE (name)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
|
||||
--
|
||||
-- Table structure for table `tagente_modulo`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `tagente_modulo`;
|
||||
CREATE TABLE `tagente_modulo` (
|
||||
`id_agente_modulo` bigint(100) unsigned NOT NULL auto_increment,
|
||||
`id_agente` int(11) NOT NULL default '0',
|
||||
|
@ -244,11 +189,7 @@ CREATE TABLE `tagente_modulo` (
|
|||
KEY `tam_agente` (`id_agente`)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
--
|
||||
-- Table structure for table `talert_snmp`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `talert_snmp`;
|
||||
CREATE TABLE `talert_snmp` (
|
||||
`id_as` int(10) unsigned NOT NULL auto_increment,
|
||||
`id_alert` int(10) unsigned NOT NULL default '0',
|
||||
|
@ -269,11 +210,7 @@ CREATE TABLE `talert_snmp` (
|
|||
PRIMARY KEY (`id_as`)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
--
|
||||
-- Table structure for table `talerta`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `talerta`;
|
||||
CREATE TABLE `talerta` (
|
||||
`id_alerta` int(10) unsigned NOT NULL auto_increment,
|
||||
`nombre` varchar(100) NOT NULL default '',
|
||||
|
@ -282,11 +219,7 @@ CREATE TABLE `talerta` (
|
|||
PRIMARY KEY (`id_alerta`)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
--
|
||||
-- Table structure for table `talerta_agente_modulo`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `talerta_agente_modulo`;
|
||||
CREATE TABLE `talerta_agente_modulo` (
|
||||
`id_aam` int(11) unsigned NOT NULL auto_increment,
|
||||
`id_agente_modulo` int(11) NOT NULL default '0',
|
||||
|
@ -295,8 +228,8 @@ CREATE TABLE `talerta_agente_modulo` (
|
|||
`al_campo2` varchar(255) default '',
|
||||
`al_campo3` mediumtext default '',
|
||||
`descripcion` varchar(255) default '',
|
||||
`dis_max` bigint(12) default NULL,
|
||||
`dis_min` bigint(12) default NULL,
|
||||
`dis_max` double(18,2) default NULL,
|
||||
`dis_min` double(18,2) default NULL,
|
||||
`time_threshold` int(11) NOT NULL default '0',
|
||||
`last_fired` datetime NOT NULL default '2004-01-01 00:00:00',
|
||||
`max_alerts` int(4) NOT NULL default '1',
|
||||
|
@ -307,11 +240,7 @@ CREATE TABLE `talerta_agente_modulo` (
|
|||
PRIMARY KEY (`id_aam`)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
--
|
||||
-- Table structure for table `tattachment`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `tattachment`;
|
||||
CREATE TABLE `tattachment` (
|
||||
`id_attachment` bigint(20) unsigned NOT NULL auto_increment,
|
||||
`id_incidencia` bigint(20) NOT NULL default '0',
|
||||
|
@ -322,11 +251,7 @@ CREATE TABLE `tattachment` (
|
|||
PRIMARY KEY (`id_attachment`)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
--
|
||||
-- Table structure for table `tconfig`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `tconfig`;
|
||||
CREATE TABLE `tconfig` (
|
||||
`id_config` int(10) unsigned NOT NULL auto_increment,
|
||||
`token` varchar(100) NOT NULL default '',
|
||||
|
@ -334,11 +259,7 @@ CREATE TABLE `tconfig` (
|
|||
PRIMARY KEY (`id_config`)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
--
|
||||
-- Table structure for table `tconfig_os`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `tconfig_os`;
|
||||
CREATE TABLE `tconfig_os` (
|
||||
`id_os` int(10) unsigned NOT NULL auto_increment,
|
||||
`name` varchar(100) NOT NULL default '',
|
||||
|
@ -347,11 +268,7 @@ CREATE TABLE `tconfig_os` (
|
|||
PRIMARY KEY (`id_os`)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
--
|
||||
-- Table structure for table `tevento`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `tevento`;
|
||||
CREATE TABLE `tevento` (
|
||||
`id_evento` bigint(20) unsigned NOT NULL auto_increment,
|
||||
`id_agente` bigint(20) NOT NULL default '0',
|
||||
|
@ -366,11 +283,7 @@ CREATE TABLE `tevento` (
|
|||
KEY `indice_2` (`timestamp`,`id_evento`)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
--
|
||||
-- Table structure for table `tgrupo`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `tgrupo`;
|
||||
CREATE TABLE `tgrupo` (
|
||||
`id_grupo` mediumint(8) unsigned NOT NULL auto_increment,
|
||||
`nombre` varchar(100) NOT NULL default '',
|
||||
|
@ -379,11 +292,7 @@ CREATE TABLE `tgrupo` (
|
|||
PRIMARY KEY (`id_grupo`)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
--
|
||||
-- Table structure for table `tincidencia`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `tincidencia`;
|
||||
CREATE TABLE `tincidencia` (
|
||||
`id_incidencia` bigint(20) unsigned NOT NULL auto_increment,
|
||||
`inicio` datetime NOT NULL default '0000-00-00 00:00:00',
|
||||
|
@ -402,22 +311,14 @@ CREATE TABLE `tincidencia` (
|
|||
KEY `incident_index_1` (`id_usuario`,`id_incidencia`)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
--
|
||||
-- Table structure for table `tlanguage`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `tlanguage`;
|
||||
CREATE TABLE `tlanguage` (
|
||||
`id_language` varchar(6) NOT NULL default '',
|
||||
`name` varchar(100) NOT NULL default '',
|
||||
PRIMARY KEY (`id_language`)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
--
|
||||
-- Table structure for table `tlink`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `tlink`;
|
||||
CREATE TABLE `tlink` (
|
||||
`id_link` int(10) unsigned zerofill NOT NULL auto_increment,
|
||||
`name` varchar(100) NOT NULL default '',
|
||||
|
@ -425,11 +326,7 @@ CREATE TABLE `tlink` (
|
|||
PRIMARY KEY (`id_link`)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
--
|
||||
-- Table structure for table `tmensajes`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `tmensajes`;
|
||||
CREATE TABLE `tmensajes` (
|
||||
`id_mensaje` bigint(20) unsigned NOT NULL auto_increment,
|
||||
`id_usuario_origen` varchar(100) NOT NULL default '',
|
||||
|
@ -441,22 +338,14 @@ CREATE TABLE `tmensajes` (
|
|||
PRIMARY KEY (`id_mensaje`)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
--
|
||||
-- Table structure for table `tmodule_group`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `tmodule_group`;
|
||||
CREATE TABLE `tmodule_group` (
|
||||
`id_mg` bigint(20) unsigned NOT NULL auto_increment,
|
||||
`name` varchar(150) NOT NULL default '',
|
||||
PRIMARY KEY (`id_mg`)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
--
|
||||
-- Table structure for table `tnetwork_component`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `tnetwork_component`;
|
||||
CREATE TABLE `tnetwork_component` (
|
||||
`id_nc` mediumint(12) unsigned NOT NULL auto_increment,
|
||||
`name` varchar(50) NOT NULL,
|
||||
|
@ -475,11 +364,7 @@ CREATE TABLE `tnetwork_component` (
|
|||
PRIMARY KEY (`id_nc`)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
--
|
||||
-- Table structure for table `tnetwork_component_group`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `tnetwork_component_group`;
|
||||
CREATE TABLE `tnetwork_component_group` (
|
||||
`id_sg` mediumint(8) unsigned NOT NULL auto_increment,
|
||||
`name` varchar(200) NOT NULL default '',
|
||||
|
@ -487,11 +372,7 @@ CREATE TABLE `tnetwork_component_group` (
|
|||
PRIMARY KEY (`id_sg`)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
--
|
||||
-- Table structure for table `tnetwork_profile`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `tnetwork_profile`;
|
||||
CREATE TABLE `tnetwork_profile` (
|
||||
`id_np` mediumint(8) unsigned NOT NULL auto_increment,
|
||||
`name` varchar(100) NOT NULL default '',
|
||||
|
@ -499,11 +380,7 @@ CREATE TABLE `tnetwork_profile` (
|
|||
PRIMARY KEY (`id_np`)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
--
|
||||
-- Table structure for table `tnetwork_profile_component`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `tnetwork_profile_component`;
|
||||
CREATE TABLE `tnetwork_profile_component` (
|
||||
`id_npc` mediumint(8) unsigned NOT NULL auto_increment,
|
||||
`id_nc` mediumint(8) unsigned NOT NULL default '0',
|
||||
|
@ -511,11 +388,7 @@ CREATE TABLE `tnetwork_profile_component` (
|
|||
PRIMARY KEY (`id_npc`)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
--
|
||||
-- Table structure for table `tnota`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `tnota`;
|
||||
CREATE TABLE `tnota` (
|
||||
`id_nota` mediumint(8) unsigned NOT NULL auto_increment,
|
||||
`id_usuario` varchar(100) NOT NULL default '0',
|
||||
|
@ -524,11 +397,7 @@ CREATE TABLE `tnota` (
|
|||
PRIMARY KEY (`id_nota`)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
--
|
||||
-- Table structure for table `tnota_inc`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `tnota_inc`;
|
||||
CREATE TABLE `tnota_inc` (
|
||||
`id_nota_inc` mediumint(8) unsigned NOT NULL auto_increment,
|
||||
`id_incidencia` mediumint(9) NOT NULL default '0',
|
||||
|
@ -536,20 +405,12 @@ CREATE TABLE `tnota_inc` (
|
|||
PRIMARY KEY (`id_nota_inc`)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
--
|
||||
-- Table structure for table `torigen`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `torigen`;
|
||||
CREATE TABLE `torigen` (
|
||||
`origen` varchar(100) NOT NULL default ''
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
--
|
||||
-- Table structure for table `tperfil`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `tperfil`;
|
||||
CREATE TABLE `tperfil` (
|
||||
`id_perfil` int(10) unsigned NOT NULL auto_increment,
|
||||
`name` varchar(60) NOT NULL default '',
|
||||
|
@ -566,11 +427,7 @@ CREATE TABLE `tperfil` (
|
|||
PRIMARY KEY (`id_perfil`)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
--
|
||||
-- Table structure for table `trecon_task`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `trecon_task`;
|
||||
CREATE TABLE `trecon_task` (
|
||||
`id_rt` int(10) unsigned NOT NULL auto_increment,
|
||||
`name` varchar(100) NOT NULL default '',
|
||||
|
@ -588,11 +445,7 @@ CREATE TABLE `trecon_task` (
|
|||
PRIMARY KEY (`id_rt`)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
--
|
||||
-- Table structure for table `tserver`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `tserver`;
|
||||
CREATE TABLE `tserver` (
|
||||
`id_server` int(10) unsigned NOT NULL auto_increment,
|
||||
`name` varchar(100) NOT NULL default '',
|
||||
|
@ -611,11 +464,7 @@ CREATE TABLE `tserver` (
|
|||
PRIMARY KEY (`id_server`)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
--
|
||||
-- Table structure for table `tsesion`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `tsesion`;
|
||||
CREATE TABLE `tsesion` (
|
||||
`ID_sesion` bigint(4) unsigned NOT NULL auto_increment,
|
||||
`ID_usuario` varchar(60) NOT NULL default '0',
|
||||
|
@ -627,11 +476,7 @@ CREATE TABLE `tsesion` (
|
|||
PRIMARY KEY (`ID_sesion`)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
--
|
||||
-- Table structure for table `ttipo_modulo`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `ttipo_modulo`;
|
||||
CREATE TABLE `ttipo_modulo` (
|
||||
`id_tipo` smallint(5) unsigned NOT NULL auto_increment,
|
||||
`nombre` varchar(100) NOT NULL default '',
|
||||
|
@ -641,11 +486,7 @@ CREATE TABLE `ttipo_modulo` (
|
|||
PRIMARY KEY (`id_tipo`)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
--
|
||||
-- Table structure for table `ttrap`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `ttrap`;
|
||||
CREATE TABLE `ttrap` (
|
||||
`id_trap` bigint(20) unsigned NOT NULL auto_increment,
|
||||
`source` varchar(50) NOT NULL default '',
|
||||
|
@ -660,13 +501,9 @@ CREATE TABLE `ttrap` (
|
|||
`id_usuario` varchar(150) default '',
|
||||
`timestamp` datetime NOT NULL default '0000-00-00 00:00:00',
|
||||
PRIMARY KEY (`id_trap`)
|
||||
) ENGINE=InnoDB COMMENT='SNMP Trap table';
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
--
|
||||
-- Table structure for table `tusuario`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `tusuario`;
|
||||
CREATE TABLE `tusuario` (
|
||||
`id_usuario` varchar(60) NOT NULL default '0',
|
||||
`nombre_real` varchar(125) NOT NULL default '',
|
||||
|
@ -678,11 +515,7 @@ CREATE TABLE `tusuario` (
|
|||
`nivel` tinyint(1) NOT NULL default '0'
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
--
|
||||
-- Table structure for table `tusuario_perfil`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `tusuario_perfil`;
|
||||
CREATE TABLE `tusuario_perfil` (
|
||||
`id_up` bigint(20) unsigned NOT NULL auto_increment,
|
||||
`id_usuario` varchar(100) NOT NULL default '',
|
||||
|
@ -692,18 +525,6 @@ CREATE TABLE `tusuario_perfil` (
|
|||
PRIMARY KEY (`id_up`)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
--
|
||||
-- Table structure for table `vistas_consola`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `vistas_consola`;
|
||||
CREATE TABLE `vistas_consola` (
|
||||
`idVista` int(5) NOT NULL auto_increment,
|
||||
`nombre` varchar(50) NOT NULL,
|
||||
`descripcion` varchar(250) NOT NULL,
|
||||
PRIMARY KEY (`idVista`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=7;
|
||||
|
||||
|
||||
CREATE TABLE `tnews` (
|
||||
`id_news` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
|
@ -712,5 +533,4 @@ CREATE TABLE `tnews` (
|
|||
`text` TEXT NOT NULL DEFAULT '',
|
||||
`utimestamp` DATETIME NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY(`id_news`)
|
||||
)
|
||||
ENGINE = InnoDB;
|
||||
) ENGINE = InnoDB;
|
|
@ -72,7 +72,7 @@ function dame_fecha_grafico_timestamp ($timestamp) {
|
|||
return date('d/m H:i', $timestamp);
|
||||
}
|
||||
|
||||
function graphic_combined_module ($module_list, $weight_list, $periodo, $width, $height , $title, $unit_name, $show_event=0, $show_alert=0 ) {
|
||||
function graphic_combined_module ($module_list, $weight_list, $periodo, $width, $height, $title, $unit_name, $show_event=0, $show_alert=0 ) {
|
||||
include ("../include/config.php");
|
||||
require ("../include/languages/language_".$language_code.".php");
|
||||
require_once 'Image/Graph.php';
|
||||
|
@ -121,7 +121,6 @@ function graphic_combined_module ($module_list, $weight_list, $periodo, $width,
|
|||
$valores[$x][6] = 0; // Event
|
||||
}
|
||||
// Init other general variables
|
||||
|
||||
if ($show_event == 1){
|
||||
// If we want to show events in graphs
|
||||
$sql1="SELECT utimestamp FROM tevento WHERE id_agente = $id_agente AND utimestamp > $fechatope";
|
||||
|
@ -136,7 +135,7 @@ function graphic_combined_module ($module_list, $weight_list, $periodo, $width,
|
|||
}
|
||||
}
|
||||
$alert_high = 0;
|
||||
$alert_low = 0;
|
||||
$alert_low = 10000000;
|
||||
if ($show_alert == 1){
|
||||
// If we want to show alerts limits
|
||||
$sql1="SELECT * FROM talerta_agente_modulo where id_agente_modulo = ".$id_agente_modulo;
|
||||
|
@ -144,9 +143,8 @@ function graphic_combined_module ($module_list, $weight_list, $periodo, $width,
|
|||
while ($row=mysql_fetch_array($result)){
|
||||
if ($row["dis_max"] > $alert_high)
|
||||
$alert_high = $row["dis_max"];
|
||||
if ($row["dis_max"] > $alert_high)
|
||||
$min = $row["dis_min"];
|
||||
|
||||
if ($row["dis_min"] < $alert_low)
|
||||
$alert_low = $row["dis_min"];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -224,11 +222,11 @@ function graphic_combined_module ($module_list, $weight_list, $periodo, $width,
|
|||
$title_period = "Last month";
|
||||
else
|
||||
$title_period = "Last ".format_numeric(($periodo / (3600*24)),2)." days";
|
||||
|
||||
|
||||
$Graph->add(
|
||||
Image_Graph::vertical(
|
||||
Image_Graph::vertical(
|
||||
$Title = Image_Graph::factory('title', array(' Pandora FMS Graph - '.$title_period, 10)),
|
||||
$Title = Image_Graph::factory('title', array(' Pandora FMS Graph - '. $title_period, 10)),
|
||||
$Subtitle = Image_Graph::factory('title', array(' '.$title, 7)),
|
||||
90
|
||||
),
|
||||
|
@ -321,8 +319,8 @@ function graphic_combined_module ($module_list, $weight_list, $periodo, $width,
|
|||
graphic_error ();
|
||||
}
|
||||
|
||||
function grafico_modulo_sparse ( $id_agente_modulo, $periodo, $draw_events,
|
||||
$width, $height , $title, $unit_name ) {
|
||||
function grafico_modulo_sparse ( $id_agente_modulo, $periodo, $show_event,
|
||||
$width, $height , $title, $unit_name, $show_alert ) {
|
||||
|
||||
include ("../include/config.php");
|
||||
require ("../include/languages/language_".$language_code.".php");
|
||||
|
@ -337,8 +335,29 @@ function grafico_modulo_sparse ( $id_agente_modulo, $periodo, $draw_events,
|
|||
$id_agente = dame_agente_id($nombre_agente);
|
||||
$nombre_modulo = dame_nombre_modulo_agentemodulo($id_agente_modulo);
|
||||
|
||||
// intervalo - This is the number of "rows" we are divided the time to fill data.
|
||||
// more interval, more resolution, and slower.
|
||||
if ($show_event == 1)
|
||||
$real_event = array();
|
||||
|
||||
if ($show_alert == 1){
|
||||
$alert_high = 0;
|
||||
$alert_low = 10000000;
|
||||
// If we want to show alerts limits
|
||||
$sql1="SELECT * FROM talerta_agente_modulo where id_agente_modulo = ".$id_agente_modulo;
|
||||
$result=mysql_query($sql1);
|
||||
while ($row=mysql_fetch_array($result)){
|
||||
if ($row["dis_max"] > $alert_high)
|
||||
$alert_high = $row["dis_max"];
|
||||
if ($row["dis_min"] < $alert_low)
|
||||
$alert_low = $row["dis_min"];
|
||||
}
|
||||
// if no valid alert defined to render limits, disable it
|
||||
if (($alert_low == 10000000) && ($alert_high == 0)){
|
||||
$show_alert = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// intervalo - This is the number of "rows" we are divided the time
|
||||
// to fill data. more interval, more resolution, and slower.
|
||||
// periodo - Gap of time, in seconds. This is now to (now-periodo) secs
|
||||
|
||||
// Init tables
|
||||
|
@ -349,6 +368,22 @@ function grafico_modulo_sparse ( $id_agente_modulo, $periodo, $draw_events,
|
|||
$valores[$x][3] = $fechatope + ($horasint*($x+1)); // [3] Botom limit
|
||||
$valores[$x][4] = 0; // MIN
|
||||
$valores[$x][5] = 0; // MAX
|
||||
$valores[$x][6] = 0; // Event
|
||||
|
||||
}
|
||||
// Init other general variables
|
||||
if ($show_event == 1){
|
||||
// If we want to show events in graphs
|
||||
$sql1="SELECT utimestamp FROM tevento WHERE id_agente = $id_agente AND utimestamp > $fechatope";
|
||||
$result=mysql_query($sql1);
|
||||
while ($row = mysql_fetch_array($result)){
|
||||
$utimestamp = $row[0];
|
||||
for ($i=0; $i <= $resolution; $i++) {
|
||||
if ( ($utimestamp <= $valores[$i][3]) && ($utimestamp >= $valores[$i][2]) ){
|
||||
$real_event[$i]=1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Init other general variables
|
||||
$max_value = 0;
|
||||
|
@ -436,7 +471,7 @@ function grafico_modulo_sparse ( $id_agente_modulo, $periodo, $draw_events,
|
|||
$Graph->add(
|
||||
Image_Graph::vertical(
|
||||
Image_Graph::vertical(
|
||||
$Title = Image_Graph::factory('title', array(' Pandora FMS Graph - '.$title_period, 10)),
|
||||
$Title = Image_Graph::factory('title', array(' Pandora FMS Graph - '.strtoupper($nombre_agente)." - ".$title_period, 10)),
|
||||
$Subtitle = Image_Graph::factory('title', array(' '.$title, 7)),
|
||||
90
|
||||
),
|
||||
|
@ -459,24 +494,42 @@ function grafico_modulo_sparse ( $id_agente_modulo, $periodo, $draw_events,
|
|||
$dataset[1]->setName("Avg.");
|
||||
$dataset[2] = Image_Graph::factory('dataset');
|
||||
$dataset[2]->setName("Min.");
|
||||
|
||||
|
||||
// Event dataset creation
|
||||
if ($show_event == 1){
|
||||
$dataset_event = Image_Graph::factory('dataset');
|
||||
$dataset_event -> setName("Event Fired");
|
||||
}
|
||||
// ... and populated with data ...
|
||||
for ($cc=0; $cc <= $resolution; $cc++) {
|
||||
$tdate = date('d/m', $valores[$cc][2])."\n".date('H:i', $valores[$cc][2]);
|
||||
$dataset[1]->addPoint($tdate, $valores[$cc][0]);
|
||||
$dataset[0]->addPoint($tdate, $valores[$cc][5]);
|
||||
$dataset[2]->addPoint($tdate, $valores[$cc][4]);
|
||||
//echo "$cc -- $tdate - ".$valores[$cc][0]." -- ".$valores[$cc][4]."--".$valores[$cc][5]."<br>";
|
||||
|
||||
if (($show_event == 1) AND (isset($real_event[$cc]))) {
|
||||
$dataset_event->addPoint($tdate, $valores[$cc][5]);
|
||||
}
|
||||
}
|
||||
|
||||
if ($max_value > 0){
|
||||
|
||||
|
||||
// Show alert limits
|
||||
if ($show_alert == 1){
|
||||
$Plot =& $Plotarea->addNew('Image_Graph_Axis_Marker_Area', IMAGE_GRAPH_AXIS_Y);
|
||||
$Plot->setFillColor( 'blue@0.1' );
|
||||
$Plot->setLowerBound( $alert_low);
|
||||
$Plot->setUpperBound( $alert_high );
|
||||
}
|
||||
|
||||
// create the 1st plot as smoothed area chart using the 1st dataset
|
||||
$Plot =& $Plotarea->addNew('area', array(&$dataset));
|
||||
$Plot->setLineColor('yellow@0.1');
|
||||
$AxisX =& $Plotarea->getAxis(IMAGE_GRAPH_AXIS_X);
|
||||
// $AxisX->Hide();
|
||||
|
||||
$AxisY =& $Plotarea->getAxis(IMAGE_GRAPH_AXIS_Y);
|
||||
$AxisY->setDataPreprocessor(Image_Graph::factory('Image_Graph_DataPreprocessor_Function', 'format_for_graph'));
|
||||
$AxisY->setLabelOption("showtext",true);
|
||||
$AxisY->setLabelInterval(ceil($max_value / 5));
|
||||
$AxisY->showLabel(IMAGE_GRAPH_LABEL_ZERO);
|
||||
|
@ -498,12 +551,19 @@ function grafico_modulo_sparse ( $id_agente_modulo, $periodo, $draw_events,
|
|||
$FillArray->addColor('blue@0.7');
|
||||
$FillArray->addColor('green@0.7');
|
||||
$FillArray->addColor('black@0.7');
|
||||
|
||||
$AxisY_Weather =& $Plotarea->getAxis(IMAGE_GRAPH_AXIS_Y);
|
||||
|
||||
// Show events !
|
||||
if ($show_event == 1){
|
||||
$Plot =& $Plotarea->addNew('Plot_Impulse', array($dataset_event));
|
||||
$Plot->setLineColor( 'red' );
|
||||
$Marker_event =& Image_Graph::factory('Image_Graph_Marker_Cross');
|
||||
$Plot->setMarker($Marker_event);
|
||||
$Marker_event->setFillColor( 'red' );
|
||||
$Marker_event->setLineColor( 'red' );
|
||||
$Marker_event->setSize ( 5 );
|
||||
}
|
||||
|
||||
|
||||
|
||||
$Graph->done();
|
||||
} else
|
||||
graphic_error ();
|
||||
|
@ -1701,10 +1761,16 @@ else
|
|||
|
||||
|
||||
// Draw Events ?
|
||||
if ( isset($_GET["draw_events"]) and $_GET["draw_events"]==0 )
|
||||
$draw_events = 0;
|
||||
else
|
||||
$draw_events = 1;
|
||||
if ( isset($_GET["draw_events"]))
|
||||
$draw_events = $_GET["draw_events"];
|
||||
else
|
||||
$draw_events = 0;
|
||||
|
||||
// Draw alert limits ?
|
||||
if ( isset($_GET["draw_alerts"]))
|
||||
$draw_alerts = $_GET["draw_alerts"];
|
||||
else
|
||||
$draw_alerts = 0;
|
||||
|
||||
// Image handler
|
||||
// *****************
|
||||
|
@ -1712,7 +1778,7 @@ if ( isset($_GET["draw_events"]) and $_GET["draw_events"]==0 )
|
|||
|
||||
if (isset($_GET["tipo"])){
|
||||
if ($_GET["tipo"] == "sparse"){
|
||||
grafico_modulo_sparse($id, $period, $draw_events, $width, $height , $label, $unit_name);
|
||||
grafico_modulo_sparse($id, $period, $draw_events, $width, $height , $label, $unit_name, $draw_alerts);
|
||||
}
|
||||
elseif ($_GET["tipo"] =="estado_incidente")
|
||||
grafico_incidente_estados();
|
||||
|
|
|
@ -2,10 +2,15 @@
|
|||
// Pandora - the Free monitoring system
|
||||
// ====================================
|
||||
// Copyright (c) 2004-2006 Sancho Lerena, slerena@gmail.com
|
||||
// Copyright (c) 2005-2006 Artica Soluciones Tecnol<6F>icas S.L, info@artica.es
|
||||
// Copyright (c) 2005-2006 Artica Soluciones Tecnologicas S.L, info@artica.es
|
||||
// Copyright (c) 2006-2007 Jonathan Barajas, jonathan.barajas[AT]gmail[DOT]com
|
||||
// Javascript Active Console code.
|
||||
// Copyright (c) 2006 Jose Navarro <contacto@indiseg.net>
|
||||
// Additions to Pandora FMS 1.2 graph code and new XML reporting template management
|
||||
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// as published by the Free Software Foundation; version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
|
@ -15,76 +20,111 @@
|
|||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
// Cargamos variables globales
|
||||
session_start();
|
||||
// Global & session management
|
||||
include ("../include/config.php");
|
||||
session_start();
|
||||
|
||||
include ("../include/functions.php");
|
||||
include("../include/functions_db.php");
|
||||
include("../include/languages/language_".$language_code.".php");
|
||||
|
||||
if (comprueba_login() == 0) {
|
||||
// Has access to this page ???
|
||||
// Access control
|
||||
if (comprueba_login() != 0) {
|
||||
$REMOTE_ADDR = getenv ("REMOTE_ADDR");
|
||||
audit_db("Unknown",$REMOTE_ADDR, "ACL Violation","Trying to access graph window without auth");
|
||||
require ("general/noaccess.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
// Parsing the refresh before sending any header
|
||||
if (isset($_GET['refresh']) and is_numeric($_GET['refresh']) and $_GET['refresh']>0) {
|
||||
header( 'refresh: ' . $_GET['refresh'] );
|
||||
}
|
||||
|
||||
// CSS
|
||||
echo '<style>';
|
||||
include("../include/styles/pandora.css");
|
||||
echo '</style>';
|
||||
|
||||
// Get input parameters
|
||||
if (!isset($_GET["period"]) OR (!isset($_GET["id"]))) {
|
||||
echo "<h3 class='error'>".$lang_label["graf_error"]."</h3>";
|
||||
exit;
|
||||
// Parsing the refresh before sending any header
|
||||
if (isset($_GET['refresh']) and is_numeric($_GET['refresh']) and $_GET['refresh']>0) {
|
||||
header( 'refresh: ' . $_GET['refresh'] );
|
||||
}
|
||||
// Read styles
|
||||
echo '<style>';
|
||||
include("../include/styles/pandora.css");
|
||||
echo '</style>';
|
||||
|
||||
// Get input parameters
|
||||
|
||||
if (isset($_GET["label"]))
|
||||
$label = entrada_limpia($_GET["label"]);
|
||||
|
||||
if (isset($_GET["event"]))
|
||||
$draw_events = entrada_limpia($_GET["event"]);
|
||||
else
|
||||
$draw_events = 0;
|
||||
if (isset($_GET["refresh"]))
|
||||
$refresh = entrada_limpia($_GET["refresh"]);
|
||||
else
|
||||
$refresh = 0;
|
||||
|
||||
if (isset($_GET["period"]))
|
||||
$period = entrada_limpia($_GET["period"]);
|
||||
else
|
||||
$period = 86400; // 1 day default period
|
||||
if (!isset($_GET["period"]) OR (!isset($_GET["id"]))) {
|
||||
echo "<h3 class='error'>".$lang_label["graf_error"]."</h3>";
|
||||
exit;
|
||||
}
|
||||
if (isset($_GET["draw_events"]))
|
||||
$draw_events = entrada_limpia($_GET["draw_events"]);
|
||||
else
|
||||
$draw_events = 0;
|
||||
|
||||
if (isset($_GET["id"]))
|
||||
$id = entrada_limpia($_GET["id"]);
|
||||
else
|
||||
$id = 0;
|
||||
|
||||
if (isset($_GET["width"]))
|
||||
$width = entrada_limpia($_GET["width"]);
|
||||
else
|
||||
$width = 525;
|
||||
if (isset($_GET["period"]))
|
||||
$period = entrada_limpia($_GET["period"]);
|
||||
else
|
||||
$period = 3600; // 1 hour (the most fast query possible)
|
||||
|
||||
if (isset($_GET["height"]))
|
||||
$height = entrada_limpia ($_GET["height"]);
|
||||
else
|
||||
$height = 200;
|
||||
switch ($period) {
|
||||
case 3600: $period_label = "Hour";
|
||||
break;
|
||||
case 21600: $period_label = "6 Hours";
|
||||
break;
|
||||
case 43200: $period_label = "12 Hous";
|
||||
break;
|
||||
case 86400: $period_label = "Day";
|
||||
break;
|
||||
case 604800: $period_label = "Last Week";
|
||||
break;
|
||||
case 1296000: $period_label = "15 Days";
|
||||
break;
|
||||
case 2592000: $period_label = "Last Month";
|
||||
break;
|
||||
case 5184000: $period_label = "Two Month";
|
||||
break;
|
||||
case 15552000: $period_label = "Six Months";
|
||||
break;
|
||||
default: $period_label = "--";
|
||||
}
|
||||
|
||||
if (isset($_GET["draw_alerts"]))
|
||||
$draw_alerts = entrada_limpia($_GET["draw_alerts"]);
|
||||
else
|
||||
$draw_alerts = 0;
|
||||
if (isset($_GET["refresh"]))
|
||||
$refresh = entrada_limpia($_GET["refresh"]);
|
||||
else
|
||||
$refresh = 0;
|
||||
if (isset($_GET["period"]))
|
||||
$period = entrada_limpia($_GET["period"]);
|
||||
else
|
||||
$period = 86400; // 1 day default period
|
||||
if (isset($_GET["id"]))
|
||||
$id = entrada_limpia($_GET["id"]);
|
||||
else
|
||||
$id = 0;
|
||||
if (isset($_GET["width"]))
|
||||
$width = entrada_limpia($_GET["width"]);
|
||||
else
|
||||
$width = 525;
|
||||
if (isset($_GET["height"]))
|
||||
$height = entrada_limpia ($_GET["height"]);
|
||||
else
|
||||
$height = 220;
|
||||
|
||||
if (isset($_GET["label"]))
|
||||
$label = entrada_limpia ($_GET["label"]);
|
||||
else
|
||||
$label = "";
|
||||
if (isset($_GET["label"]))
|
||||
$label = entrada_limpia ($_GET["label"]);
|
||||
else
|
||||
$label = "";
|
||||
|
||||
if (isset($_GET["zoom"])){
|
||||
$zoom = entrada_limpia ($_GET["zoom"]);
|
||||
$height=$height*$zoom;
|
||||
$width=$width*$zoom;
|
||||
}
|
||||
else
|
||||
$zoom = "1";
|
||||
if (isset($_GET["zoom"])){
|
||||
$zoom = entrada_limpia ($_GET["zoom"]);
|
||||
$height=$height*$zoom;
|
||||
$width=$width*$zoom;
|
||||
}
|
||||
else
|
||||
$zoom = "1";
|
||||
|
||||
echo "<img src='fgraph.php?tipo=sparse&id=$id&zoom=$zoom&label=$label&height=$height&width=$width&period=$period' border=0 alt=''>";
|
||||
}
|
||||
echo "<img src='fgraph.php?tipo=sparse&draw_alerts=$draw_alerts&draw_events=$draw_events&id=$id&zoom=$zoom&label=$label&height=$height&width=$width&period=$period' border=0 alt=''>";
|
||||
|
||||
?>
|
||||
|
||||
|
@ -94,19 +134,17 @@ if (comprueba_login() == 0) {
|
|||
<style type='text/css'><!--
|
||||
|
||||
.menu {
|
||||
color:#000; background:#ccc; margin:2px; padding:2px;
|
||||
font-family:verdana,arial,sans-serif,helvetica; font-size:10px;
|
||||
color:#000; background:#ccc;
|
||||
margin-left: 10px;
|
||||
padding-left: 10px; padding-top: 10px;
|
||||
font-family:arial,sans-serif,verdana; font-size:10px;
|
||||
border:1px solid #000;
|
||||
position:absolute;
|
||||
margin:0; width:550px; height:220px;
|
||||
margin:0; width:325px; height:220px;
|
||||
visibility:hidden;
|
||||
filter:alpha(opacity=95);
|
||||
-moz-opacity: 0.95;
|
||||
opacity: 0.95;
|
||||
margin-left: 0px;
|
||||
margin-top: 0px;
|
||||
margin-right: 0px;
|
||||
margin-bottom: 0px;
|
||||
}
|
||||
|
||||
--></style>
|
||||
|
@ -116,8 +154,8 @@ if (comprueba_login() == 0) {
|
|||
var defOffset = 2;
|
||||
var defSlideTime = 200;
|
||||
var tnActive = 0;
|
||||
var visibleMargin = 5;
|
||||
var menuW = 550;
|
||||
var visibleMargin = 3;
|
||||
var menuW = 325;
|
||||
var menuH = 220;
|
||||
window.onload = function() {
|
||||
var d;
|
||||
|
@ -159,32 +197,68 @@ if (comprueba_login() == 0) {
|
|||
<body>
|
||||
|
||||
<div id='divmenu' class='menu'>
|
||||
<b>Configuration Menu</b><br>Please, make your changes and apply with <i>Reload</i> button<BR><BR>
|
||||
<b>Pandora FMS Graph configuration menu</b><br>Please, make your changes and apply with <i>Reload</i> button
|
||||
|
||||
<form method='get' action='stat_win.php'>
|
||||
<table>
|
||||
<tr><td><B>Actual configuration</B> <BR></td>
|
||||
<td><B>Configurable parameters</B> <BR></td>
|
||||
</tr>
|
||||
<tr><td>
|
||||
<?php
|
||||
|
||||
echo "<input type='hidden' name='id' value='$id'>";
|
||||
echo "<input type='hidden' name='refresh' value='$refresh'>";
|
||||
echo "<input type='hidden' name='zoom' value='$zoom'>";
|
||||
echo "<input type='hidden' name='event' value='$draw_events'>";
|
||||
|
||||
?>
|
||||
<?php
|
||||
echo "<input type='hidden' name='id' value='$id'>";
|
||||
echo "<input type='hidden' name='label' value='$label'>";
|
||||
?>
|
||||
<TABLE class='databox_frame' cellspacing=5>
|
||||
</td><td>
|
||||
<?php
|
||||
echo "Refresh <input type='text' name='refresh' value='" . $refresh . "'> seconds <br>";
|
||||
echo "Zoom <input type='text' name='zoom' value='" . $zoom . "'> % <br>";
|
||||
echo "Show events <input type='text' name='draw_events' value='" . $draw_events . "'> ( 1 or 0 ) <br>";
|
||||
echo "<tr><td>";
|
||||
echo "Refresh time (sec)";
|
||||
echo "<td>";
|
||||
echo "<input type='text' size=5 name='refresh' value='" . $refresh . "'>";
|
||||
echo "<tr><td>";
|
||||
echo "Zoom factor (1x)";
|
||||
echo "<td>";
|
||||
echo "<select name=zoom>";
|
||||
echo "<option value='$zoom'>"."x".$zoom;
|
||||
echo "<option value='1'>"."x1";
|
||||
echo "<option value='2'>"."x2";
|
||||
echo "<option value='3'>"."x3";
|
||||
echo "<option value='4'>"."x4";
|
||||
echo "</select>";
|
||||
|
||||
echo "<tr><td>";
|
||||
echo "Range of time";
|
||||
echo "<td>";
|
||||
echo "<select name='period'>";
|
||||
echo "<option value=$period>".$period_label;
|
||||
echo "<option value=3600>"."Hour";
|
||||
echo "<option value=21600>"."6 Hours";
|
||||
echo "<option value=43200>"."12 Hours";
|
||||
echo "<option value=86400>"."Last day";
|
||||
echo "<option value=604800>"."Last Week";
|
||||
echo "<option value=1296000>"."15 days";
|
||||
echo "<option value=2592000>"."Last Month";
|
||||
echo "<option value=5184000>"."Two Month";
|
||||
echo "<option value=15552000>"."Six Months";
|
||||
echo "</select>";
|
||||
|
||||
echo "<tr><td>";
|
||||
echo "Show events ";
|
||||
echo "<td>";
|
||||
if ($draw_events == 1)
|
||||
echo "<input type='checkbox' name='draw_events' CHECKED value=1>";
|
||||
else
|
||||
echo "<input type='checkbox' name='draw_events' value=1>";
|
||||
|
||||
echo "<tr><td>";
|
||||
echo "Show alert ";
|
||||
echo "<td>";
|
||||
if ($draw_alerts == 1)
|
||||
echo "<input type='checkbox' name='draw_alerts' value=1 CHECKED>";
|
||||
else
|
||||
echo "<input type='checkbox' name='draw_alerts' value=1>";
|
||||
|
||||
echo "<td>";
|
||||
echo "<input type='submit' class='sub next' value='GO'>";
|
||||
?>
|
||||
</td></tr>
|
||||
</table>
|
||||
|
||||
<input type="submit" value="reload">
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue