2008-06-16 Sancho Lerena <slerena@gmail.com>

* pandoradb_data.sql: Updated some new config tokens (graph colors), 
	updated group default names and icons, 

	* manage_config_remote.php, godmode/menu.php: Added new config to 
	manage/copy remote config from one agent to other(s).

	* agent_manager.php: When create a new agent, cannot select group "ALL".

	* agent_template.php: Fixed a weird bug that creates two tagente_estado
	records when using a module template.

	* alert_manager_editor.php: Fixed ACL problem assigning combined alert
	components. Better management of NOP in combined alerts (Automated NOP 
	when create the first component. Added NAND, NXOR y NOR).

	* manage_config.php: Solved some bugs copying configuration with new
	modules (Added support for new module types). Added filter for group and
	fixed ACL problems. Code cleanup and better layout.

	* module_manager_editor_prediction.php: ACL checks added.

	* config_process.php, setup.php: Support to choose color graphs.

	* functions.php: Fixed typo and removed N/A for alerts with min/max = 0
	
	* functions_db.php: Fixed another typo in give_disabled_group(), and added
	feature to list_group() combo to render or now group "ALL".

	* estado_generalagente.php: Added network push button for whole agent.

	* tactical.php: Some minor layout improvement.

	* ver_agente.php: Network FLAG change request for whole group, and fixed
	manual validation on combined alerts.

	* events.php: Event description don't show with " ' "characters. Fixed.

	* fgraph.php: graph_event_module() restored (was missing in last commit),
	added user-defined color support.

	* stat_win.php: Added support to choose another date for graph. 



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@866 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
slerena 2008-06-16 18:09:56 +00:00
parent d3a1f45c1b
commit d135f1334f
23 changed files with 811 additions and 491 deletions

View File

@ -1,13 +1,57 @@
2008-06-15 Esteban Sanchez <estebans@artica.es>
2008-06-16 Sancho Lerena <slerena@gmail.com>
* pandoradb_data.sql: Updated some new config tokens (graph colors),
updated group default names and icons,
* manage_config_remote.php, godmode/menu.php: Added new config to
manage/copy remote config from one agent to other(s).
* agent_manager.php: When create a new agent, cannot select group "ALL".
* agent_template.php: Fixed a weird bug that creates two tagente_estado
records when using a module template.
* alert_manager_editor.php: Fixed ACL problem assigning combined alert
components. Better management of NOP in combined alerts (Automated NOP
when create the first component. Added NAND, NXOR y NOR).
* manage_config.php: Solved some bugs copying configuration with new
modules (Added support for new module types). Added filter for group and
fixed ACL problems. Code cleanup and better layout.
* module_manager_editor_prediction.php: ACL checks added.
* config_process.php, setup.php: Support to choose color graphs.
* functions.php: Fixed typo and removed N/A for alerts with min/max = 0
* functions_db.php: Fixed another typo in give_disabled_group(), and added
feature to list_group() combo to render or now group "ALL".
* estado_generalagente.php: Added network push button for whole agent.
* tactical.php: Some minor layout improvement.
* ver_agente.php: Network FLAG change request for whole group, and fixed
manual validation on combined alerts.
* events.php: Event description don't show with " ' "characters. Fixed.
* fgraph.php: graph_event_module() restored (was missing in last commit),
added user-defined color support.
* stat_win.php: Added support to choose another date for graph.
2008-06-16 Esteban Sanchez <estebans@artica.es>
* reporting/fgraph.php: Fixed a regresion bug with progress bar mode.
2008-06-15 Esteban Sanchez <estebans@artica.es>
2008-06-16 Esteban Sanchez <estebans@artica.es>
* reporting/fgraph.php: Fixed bug with graphic_combined_module() that
was causing not to work right.
2008-06-15 Esteban Sanchez <estebans@artica.es>
2008-06-16 Esteban Sanchez <estebans@artica.es>
* include/functions_html.php: Added to repository. Implements HTML
functions.

View File

@ -97,9 +97,7 @@
} else
$global_health = 100;
echo "<table class='databox' celldpadding=4 cellspacing=4 width=250>";
echo "<table class='databox' celldpadding=4 cellspacing=4 width=250>";
//echo "<h2>".$lang_label["tactical_indicator"]."</h2>";
//echo "<img src='reporting/fgraph.php?tipo=odo_tactic&value1=$global_health&value2=$data_health&value3=$monitor_health'>";
@ -118,7 +116,6 @@ echo "<table class='databox' celldpadding=4 cellspacing=4 width=250>";
echo "<tr><td colspan='2'>".lang_string("Alert level")."</th>";
echo "<tr><td colspan='2'><img src='reporting/fgraph.php?tipo=progress&height=20&width=260&mode=0&percent=$alert_level' title='$alert_level % ".lang_string("of non-fired alerts")."'>";
echo "</table>";
$query1 = "SELECT COUNT(id_usuario) FROM tusuario";

View File

@ -109,11 +109,10 @@ else
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)."</option>";
}
list_group ($id_user);
list_group ($id_user, 0);
echo "</select>";
echo "<tr><td class='datos2'>";

View File

@ -47,8 +47,6 @@ if (isset($_POST["template_id"])){
$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"];
@ -104,6 +102,7 @@ if (isset($_POST["template_id"])){
)";
}
mysql_query ($sql_insert);
$sql_insert = "";
}
}
echo "<h3 class='suc'>".$lang_label["add_mod_ok"]."</h3>";
@ -125,7 +124,7 @@ echo "<table width='300' class='databox' cellpadding='4' cellspacing='4'>";
echo "<tr><td>".$lang_label['template']."</td><td valign='middle'>";
echo "<select name='template_id' class='w130'>";
$sql1='SELECT * FROM tnetwork_profile ORDER BY name';
$sql1 = 'SELECT * FROM tnetwork_profile ORDER BY name';
$result=mysql_query($sql1);
if (mysql_num_rows($result))
while ($row=mysql_fetch_array($result))

View File

@ -313,30 +313,44 @@ if (($form_alerttype == "combined") AND ($update_alert != -1)){
echo "<select name='component_item'>";
// Add to combo single alerts
$result_alert = mysql_query("SELECT tagente_modulo.id_agente_modulo, tagente.nombre, tagente_modulo.nombre, id_aam FROM talerta_agente_modulo, tagente_modulo, tagente WHERE talerta_agente_modulo.id_agente_modulo = tagente_modulo.id_agente_modulo AND tagente_modulo.id_agente = tagente.id_agente");
$result_alert = mysql_query("SELECT tagente_modulo.id_agente_modulo, tagente.nombre, tagente_modulo.nombre, id_aam, tagente.id_grupo FROM talerta_agente_modulo, tagente_modulo, tagente WHERE talerta_agente_modulo.id_agente_modulo = tagente_modulo.id_agente_modulo AND tagente_modulo.id_agente = tagente.id_agente");
while ($alertrow = mysql_fetch_array($result_alert)){
echo "<option value='".$alertrow[3]."'>(S) ".$alertrow[1]." - ".$alertrow[2];
if (give_acl ($config["id_user"], $alertrow[4], "AR") == 1)
echo "<option value='".$alertrow[3]."'>(S) ".$alertrow[1]." - ".$alertrow[2];
}
// Add to combo combined alerts
$result_alert = mysql_query("SELECT * FROM talerta_agente_modulo WHERE id_agent != '' OR id_agent >0");
$result_alert = mysql_query("SELECT tagente.id_grupo, tagente.nombre, talerta_agente_modulo.id_aam, talerta_agente_modulo.descripcion FROM talerta_agente_modulo, tagente WHERE talerta_agente_modulo.id_agent = tagente.id_agente AND tagente.id_agente != '' AND tagente.id_agente > 0");
while ($alertrow = mysql_fetch_array($result_alert)){
echo "<option value='".$alertrow["id_aam"]."'>(C) ".get_db_sql("SELECT nombre from tagente where id_agente = ".$alertrow["id_agent"])." - ".substr($alertrow["descripcion"],0,20);
if (give_acl ($config["id_user"], $alertrow[0], "AR"))
echo "<option value='".$alertrow[2]."'>(C) ".$alertrow[1]." - ".$alertrow[3];
}
echo "</select>";
echo "<td>";
echo lang_string ("Operation");
echo "<td>";
echo "<select name='component_operation'>";
echo "<option>NOP";
echo "<option>OR";
echo "<option>AND";
echo "<option>NOT";
echo "<option>XOR";
echo "<option>XAND";
echo "</select>";
echo "<td>";
// there is any component already in this alert ?
$result = mysql_query ("SELECT COUNT(*) FROM tcompound_alert, talerta_agente_modulo WHERE tcompound_alert.id = $id_aam AND talerta_agente_modulo.id_aam = tcompound_alert.id_aam");
$row=mysql_fetch_array($result);
if ($row[0] > 0){
echo "<td>";
echo lang_string ("Operation");
echo "<td>";
echo "<select name='component_operation'>";
echo "<option>OR";
echo "<option>AND";
echo "<option>XOR";
echo "<option>NOR";
echo "<option>NAND";
echo "<option>NXOR";
echo "</select>";
} else {
echo "<input type=hidden name='component_operation' value='NOP'>";
}
echo "<td>";
echo '<input name="crtbutton" type="submit" class="sub wand" value="'.$lang_label["add"].'">';
echo "</form>";
echo "</table>";

View File

@ -134,8 +134,7 @@ if ( isset ($_POST["create_agent"])) { // Create a new and shining agent
$agent_creation_error = "";
$id_agente = mysql_insert_id ();
// Create special MODULE agent_keepalive
$sql_insert = "INSERT INTO tagente_modulo (nombre, id_agente, id_tipo_modulo, descripcion, id_modulo)
VALUES ('agent_keepalive', ".$id_agente.",100,'Agent Keepalive monitor',1)";
$sql_insert = "INSERT INTO tagente_modulo (nombre, id_agente, id_tipo_modulo, descripcion, id_modulo) VALUES ('agent_keepalive', ".$id_agente.",100,'Agent Keepalive monitor',1)";
$result=mysql_query($sql_insert);
$id_agent_module = mysql_insert_id();
// And create MODULE agent_keepalive in tagente_estado table
@ -435,7 +434,6 @@ if (isset($_POST["update_alert"])){ // Update an existing alert
$result=mysql_query($sql_insert);
if (! $result) {
echo "<h3 class='error'>".$lang_label["update_alert_no"]."</h3>";
// echo "SQL DEBUG ".$sql_insert;
}
else
echo "<h3 class='suc'>".$lang_label["update_agent_ok"]."</h3>";

View File

@ -1,9 +1,9 @@
<?php
// Pandora - the Free monitoring system
// Pandora FM
// ====================================
// 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) 2004-2008 Sancho Lerena, slerena@gmail.com
// Copyright (c) 2005-2008 Artica Soluciones Tecnoloicas S.L, info@artica.es
// Copyright (c) 2004-2006 Raul Mateos Martin, raulofpandora@gmail.com
// Copyright (c) 2008 Jorge Gonzalez <jorge.gonzalez@artica.es>
// This program is free software; you can redistribute it and/or
@ -21,319 +21,407 @@
// Load global vars
require("include/config.php");
if (comprueba_login() == 0)
$id_user = $_SESSION["id_usuario"];
if ( (give_acl($id_user, 0, "LM")==1) OR (give_acl($id_user, 0, "AW")==1) ){
comprueba_login();
$id_user = $_SESSION["id_usuario"];
$id_group = get_parameter ("id_group",0);
$origen = get_parameter ("origen", -1);
$update_agent = get_parameter ("update_agent", -1);
$update_group = get_parameter ("update_group", -1);
if ( (give_acl($id_user, 0, "LM")==0) AND (give_acl($id_user, 0, "AW")==0) ){
audit_db($id_user,$REMOTE_ADDR, "ACL Violation","Trying to access Agent Config Management Admin section");
require ("general/noaccess.php");
}
if ((isset($_GET["operacion"])) AND (! isset($_POST["update_agent"]))){
// DATA COPY
if (isset($_POST["copy"])) {
echo "<h2>".$lang_label["datacopy"]."</h2>";
// Initial checkings
// if selected more than 0 agents
$destino = $_POST["destino"];
if (count($destino) <= 0){
echo "<h3 class='error'>ERROR: ".$lang_label["noagents_cp"]."</h3>";
echo "</table>";
include ("general/footer.php");
exit;
}
$origen_modulo = $_POST["origen_modulo"];
if (count($origen_modulo) <= 0){
echo "<h3 class='error'>ERROR: ".$lang_label["nomodules_selected"]."</h3>";
echo "</table>";
include ("general/footer.php");
exit;
}
// Operations
// ---------------
if ((isset($_GET["operacion"])) AND ($update_agent == -1) AND ($update_group == -1) ) {
$multiple=1;
// DATA COPY
// ---------
if (isset($_POST["copy"])) {
echo "<h2>".$lang_label["datacopy"]."</h2>";
// Initial checkings
// Source
$id_origen = $_POST["origen"];
// If selected modules or alerts
if (isset($_POST["modules"]))
$modulos = 1;
else
$modulos = 0;
if (isset($_POST["alerts"]))
$alertas = 1;
else
$alertas = 0;
if (($alertas + $modulos) == 0){
echo "<h3 class='error'>ERROR: ".$lang_label["you_must_select_modules"]."</h3>";;
echo "</table>";
include ("general/footer.php");
exit;
}
// Copy
for ($a=0;$a <count($destino); $a++){ // For every agent in destination
$id_agente = $destino[$a];
echo "<br><br>".$lang_label["copyage"]."<b> [".dame_nombre_agente($id_origen)."] -> [".dame_nombre_agente($id_agente)."]</b>";
if ($multiple == 0)
$b=-1;
// if selected more than 0 agents
$destino = $_POST["destino"];
if (count($destino) <= 0){
echo "<h3 class='error'>ERROR: ".$lang_label["noagents_cp"]."</h3>";
echo "</table>";
include ("general/footer.php");
exit;
}
$origen_modulo = $_POST["origen_modulo"];
if (count($origen_modulo) <= 0){
echo "<h3 class='error'>ERROR: ".$lang_label["nomodules_selected"]."</h3>";
echo "</table>";
include ("general/footer.php");
exit;
}
$multiple=1;
// Source
$id_origen = $_POST["origen"];
// If selected modules or alerts
if (isset($_POST["modules"]))
$modulos = 1;
else
$modulos = 0;
if (isset($_POST["alerts"]))
$alertas = 1;
else
$alertas = 0;
if (($alertas + $modulos) == 0){
echo "<h3 class='error'>ERROR: ".$lang_label["you_must_select_modules"]."</h3>";;
echo "</table>";
include ("general/footer.php");
exit;
}
// Copy
// ----
for ($a=0;$a <count($destino); $a++){
// For every agent in destination
$id_agente = $destino[$a];
echo "<br><br>".$lang_label["copyage"]."<b> [".dame_nombre_agente($id_origen)."] -> [".dame_nombre_agente($id_agente)."]</b>";
if ($multiple == 0)
$b=-1;
else
$b=0;
// Module read
if ($modulos == 1){
for ($b=$b; $b < count($origen_modulo); $b++){
if ($multiple == 0)
$sql1='SELECT * FROM tagente_modulo WHERE id_agente = '.$id_origen;
else
$b=0;
$sql1='SELECT * FROM tagente_modulo WHERE id_agente_modulo = '.$origen_modulo[$b];
$result1=mysql_query($sql1);
while ($row=mysql_fetch_array($result1)){
$o_id_agente_modulo = $row["id_agente_modulo"];
$o_id_tipo_modulo = $row["id_tipo_modulo"];
$o_nombre = $row["nombre"];
$d_id_agente = $id_agente; // Rapelace with destination agent id
// Read every module in source agent
$o_descripcion = $row["descripcion"];
$o_max = $row["max"];
$o_min = $row["min"];
$o_module_interval = $row["module_interval"];
$o_tcp_port = $row["tcp_port"];
$o_tcp_send = $row["tcp_send"];
$o_tcp_rcv = $row["tcp_rcv"];
$o_snmp_community = $row["snmp_community"];
$o_snmp_oid = $row["snmp_oid"];
// Replace IP Address for main ip address of destination module
$real_ip_address = give_agent_address ($id_agente);
$o_ip_target = $real_ip_address;
$o_id_module_group = $row["id_module_group"];
// 2.0 new modules
$o_max_timeout = $row["max_timeout"];
$o_prediction_module = $row["prediction_module"];
$o_post_process = $row["post_process"];
$o_id_plugin = $row["id_plugin"];
$o_plugin_parameter = $row["plugin_parameter"];
$o_plugin_user = $row["plugin_user"];
$o_plugin_pass = $row["plugin_pass"];
$o_id_modulo = $row["id_modulo"];
// Module read
if ($modulos ==1){
for ($b=$b; $b < count($origen_modulo); $b++){
if ($multiple == 0)
$sql1='SELECT * FROM tagente_modulo WHERE id_agente = '.$id_origen;
else
$sql1='SELECT * FROM tagente_modulo WHERE id_agente_modulo = '.$origen_modulo[$b];
$result1=mysql_query($sql1);
while ($row=mysql_fetch_array($result1)){
$o_id_agente_modulo = $row["id_agente_modulo"];
$o_id_tipo_modulo = $row["id_tipo_modulo"];
$o_nombre = $row["nombre"];
$d_id_agente = $id_agente; // Rapelace with destination agent id
// Read every module in source agent
$o_descripcion = $row["descripcion"];
$o_max = $row["max"];
$o_min = $row["min"];
$o_module_interval = $row["module_interval"];
$o_tcp_port = $row["tcp_port"];
$o_tcp_send = $row["tcp_send"];
$o_tcp_rcv = $row["tcp_rcv"];
$o_snmp_community = $row["snmp_community"];
$o_snmp_oid = $row["snmp_oid"];
// Replace IP Address for main ip address of destination module
$real_ip_address = give_agent_address ($id_agente);
$o_ip_target = $real_ip_address;
$o_id_module_group = $row["id_module_group"];
// Write every module in destination agent
if ($o_nombre != "agent_keepalive") {
$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, flag) VALUES
(".$d_id_agente.",'".$o_id_tipo_modulo."','".$o_descripcion."','".$o_nombre."', '$o_max', '$o_min', '$o_module_interval', '$o_tcp_port','$o_tcp_send','$o_tcp_rcv','$o_snmp_community','$o_snmp_oid','$o_ip_target',$o_id_module_group, 1)";
$result2=mysql_query($sql);
$o_id_agente_modulo = mysql_insert_id();
// Create with different estado if proc type or data type
if (
($o_id_tipo_modulo == 2) ||
($o_id_tipo_modulo == 6) ||
($o_id_tipo_modulo == 9) ||
($o_id_tipo_modulo == 12) ||
($o_id_tipo_modulo == 18)){
$sql_status_insert = "INSERT INTO tagente_estado
(id_agente_modulo,datos,timestamp,cambio,estado,id_agente, utimestamp)
VALUES (
$o_id_agente_modulo, 0,'0000-00-00 00:00:00',0,0,'".$d_id_agente."',0
)";
} else {
$sql_status_insert = "INSERT INTO tagente_estado
(id_agente_modulo,datos,timestamp,cambio,estado,id_agente, utimestamp)
VALUES (
$o_id_agente_modulo, 0,'0000-00-00 00:00:00',0,100,'".$d_id_agente."',0
)";
}
$result_status=mysql_query($sql_status_insert);
echo "<br>&nbsp;&nbsp;".$lang_label["copymod"]." ->".$o_nombre;
}
}
}
}
if ($multiple == 0)
$b=-1;
else
$b=0;
// Alertas
if ($alertas == 1){
for ($b=$b; $b < count($origen_modulo); $b++){
if ($multiple == 0)
$sql1='SELECT * FROM tagente_modulo WHERE id_agente = '.$id_origen;
else
$sql1='SELECT * FROM tagente_modulo WHERE id_agente_modulo = '.$origen_modulo[$b];
$result1=mysql_query($sql1);
while ($row=mysql_fetch_array($result1)){
$o_id_agente_modulo = $row["id_agente_modulo"];
$o_id_tipo_modulo = $row["id_tipo_modulo"];
$o_nombre = $row["nombre"];
$d_id_agente = $id_agente; // destination agent id
// For each agent module, given as $o_id_agente_modulo:
// Searching if destination agent has a agente_modulo with same type and name that source
$sqlp="SELECT * FROM tagente_modulo WHERE id_agente = ".$d_id_agente." AND nombre = '".$o_nombre."' AND id_tipo_modulo = ".$o_id_tipo_modulo;
$resultp=mysql_query($sqlp);
if ( $rowp=mysql_fetch_array($resultp)){
// If rowp success get ID
$d_id_agente_modulo = $rowp["id_agente_modulo"];
// Read every alert from source agent
$sql2='SELECT * FROM talerta_agente_modulo WHERE id_agente_modulo = '.$o_id_agente_modulo;
$result3=mysql_query($sql2);
while ($row3=mysql_fetch_array($result3)){
$o_id_alerta = $row3["id_alerta"];
$o_al_campo1 = $row3["al_campo1"];
$o_al_campo2 = $row3["al_campo2"];
$o_al_campo3 = $row3["al_campo3"];
$o_descripcion = $row3["descripcion"];
$o_dis_max = $row3["dis_max"];
$o_dis_min = $row3["dis_min"];
$o_time_threshold = $row3["time_threshold"];
$o_last_fired = "2001-01-01 00:00:00";
$o_max_alerts = $row3["max_alerts"];
$o_min_alerts = $row3["min_alerts"];
$o_times_fired = 0;
// Insert
$sql_al="INSERT INTO talerta_agente_modulo (id_agente_modulo, id_alerta, al_campo1, al_campo2, al_campo3, descripcion, dis_max, dis_min, time_threshold, last_fired, max_alerts, times_fired, min_alerts) VALUES ( ".$d_id_agente_modulo.",
".$o_id_alerta.",
'".$o_al_campo1."',
'".$o_al_campo2."',
'".$o_al_campo3."',
'".$o_descripcion."',
".$o_dis_max.",
".$o_dis_min.",
".$o_time_threshold.",
'".$o_last_fired."',
".$o_max_alerts.",
".$o_times_fired.", $o_min_alerts)";
$result_al=mysql_query($sql_al);
// echo "DEBUG SQL: $sql_al <br>";
echo "<br>&nbsp;&nbsp;".$lang_label["copyale"]." ->".$o_descripcion;
}
} else
echo "<br><h3 class='error'>ERROR: ".$lang_label["notfoundmod"].$o_nombre.$lang_label["inagent"].dame_nombre_agente($d_id_agente)."</h3>";
} //while
} // for
}
}
} //end if copy modules or alerts
// DELETE DATA
elseif (isset($_POST["delete"])) {
echo "<h2>".$lang_label["deletedata"]."</h2>";
// Initial checkings
// if selected more than 0 agents
$destino = $_POST["destino"];
if (count($destino) <= 0){
echo "<h3 class='error'>ERROR: ".$lang_label["noagents_del"]."</h3>";
break;
}
// If selected modules or alerts
if (isset($_POST["modules"]))
$modulos = 1;
else
$modulos = 0;
if (isset($_POST["alerts"]))
$alertas = 1;
else
$alertas = 0;
if (($alertas + $modulos) == 0){
echo "<h3 class='error'>ERROR: ".$lang_label["del_sel_err"]."</h3>";
break;
}
// Delete
for ($a=0;$a <count($destino); $a++){ // for each agent
$id_agente = $destino[$a];
if ($modulos == 1){
echo "<br>".$lang_label["deleting_data"]." -> ".dame_nombre_agente($id_agente);
// Deleting data
$sql1='SELECT * FROM tagente_modulo WHERE id_agente = '.$id_agente;
$result1=mysql_query($sql1);
while ($row=mysql_fetch_array($result1)){
$sql_delete1="DELETE FROM tagente_datos WHERE id_agente_modulo=".$row["id_agente_modulo"];
$sql_delete2="DELETE FROM tagente_datos_inc WHERE id_agente_modulo=".$row["id_agente_modulo"];
$sql_delete3="DELETE FROM tagente_datos_string WHERE id_agente_modulo=".$row["id_agente_modulo"];
$result=mysql_query($sql_delete1);
$result=mysql_query($sql_delete2);
$result=mysql_query($sql_delete3);
}
// Delete conf
$sql_delete5 ="DELETE FROM tagente_modulo WHERE id_agente = ".$id_agente; // delete from table tagente_modulo
$sql_delete6 ="DELETE FROM tagente_estado WHERE id_agente = ".$id_agente; // detele from table tagente_estado
$result=mysql_query($sql_delete5);
$result=mysql_query($sql_delete6);
}
// delete alerts definitions
if ($alertas == 1){
// delete data
$sql1='SELECT * FROM tagente_modulo WHERE id_agente = '.$id_agente;
$result1=mysql_query($sql1);
while ($row=mysql_fetch_array($result1)){
$sql_delete1="DELETE FROM talerta_agente_modulo WHERE id_agente_modulo=".$row["id_agente_modulo"];
$result = mysql_query($sql_delete1);
} // while
}//if
}// for
}//delete
} else { // Form view
?>
// Write every module in destination agent
if ($o_nombre != "agent_keepalive") {
$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, flag,
max_timeout, prediction_module, post_process, id_plugin,
plugin_parameter, plugin_user, plugin_pass, id_modulo
) VALUES (
$d_id_agente, '$o_id_tipo_modulo', '$o_descripcion',
'$o_nombre', '$o_max', '$o_min', '$o_module_interval',
'$o_tcp_port', '$o_tcp_send', '$o_tcp_rcv', '$o_snmp_community',
'$o_snmp_oid', '$o_ip_target', $o_id_module_group, 1,
$o_max_timeout, $o_prediction_module, '$o_post_process',
$o_id_plugin, '$o_plugin_parameter', '$o_plugin_user',
'$o_plugin_pass', $o_id_modulo
)";
echo "DEBUG SQL: $sql <br>";
$result2=mysql_query($sql);
if (! $result2)
echo "<h3 class=error>".lang_string("Problem updating database")."</h3>";
$o_id_agente_modulo = mysql_insert_id();
<h2><?php echo $lang_label["agent_conf"] ?> &gt;
<?php echo $lang_label["config_manage"]; ?></h2>
<form method="post" action="index.php?sec=gagente&sec2=godmode/agentes/manage_config&operacion=1">
<table width='450' border='0' cellspacing='4' cellpadding='4' class='databox'>
<tr>
<td class="datost"><b><?php echo $lang_label["source_agent"]; ?></b><br><br>
<select name="origen" class="w130">
<?php
if ( (isset($_POST["update_agent"])) AND (isset($_POST["origen"])) ) {
echo "<option value=".$_POST["origen"].">".dame_nombre_agente($_POST["origen"])."</option>";
}
// Show combo with agents
$sql1='SELECT * FROM tagente order by nombre';
$result=mysql_query($sql1);
while ($row=mysql_fetch_array($result)){
if ( (isset($_POST["update_agent"])) AND (isset($_POST["origen"])) ){
if ( $_POST["origen"] != $row["id_agente"])
echo "<option value=".$row["id_agente"].">".$row["nombre"]."</option>";
// Create with different estado if proc type or data type
if (
($o_id_agente_modulo != "") AND (
($o_id_tipo_modulo == 2) ||
($o_id_tipo_modulo == 6) ||
($o_id_tipo_modulo == 9) ||
($o_id_tipo_modulo == 100) ||
($o_id_tipo_modulo == 21) ||
($o_id_tipo_modulo == 18))){
$sql_status_insert = "INSERT INTO tagente_estado
(id_agente_modulo,datos,timestamp,cambio,estado,id_agente, utimestamp)
VALUES (
$o_id_agente_modulo, 0,'0000-00-00 00:00:00',0,0,'".$d_id_agente."',0
)";
} else {
$sql_status_insert = "INSERT INTO tagente_estado
(id_agente_modulo,datos,timestamp,cambio,estado,id_agente, utimestamp)
VALUES (
$o_id_agente_modulo, 0,'0000-00-00 00:00:00',0,100,'".$d_id_agente."',0
)";
}
$result_status=mysql_query($sql_status_insert);
echo "<br>&nbsp;&nbsp;".$lang_label["copymod"]." ->".$o_nombre;
}
}
}
else
}
if ($multiple == 0)
$b=-1;
else
$b=0;
// Alerts
// ------
if ($alertas == 1){
for ($b=$b; $b < count($origen_modulo); $b++){
if ($multiple == 0)
$sql1='SELECT * FROM tagente_modulo WHERE id_agente = '.$id_origen;
else
$sql1='SELECT * FROM tagente_modulo WHERE id_agente_modulo = '.$origen_modulo[$b];
$result1=mysql_query($sql1);
while ($row=mysql_fetch_array($result1)){
$o_id_agente_modulo = $row["id_agente_modulo"];
$o_id_tipo_modulo = $row["id_tipo_modulo"];
$o_nombre = $row["nombre"];
$d_id_agente = $id_agente; // destination agent id
// For each agent module, given as $o_id_agente_modulo:
// Searching if destination agent has a agente_modulo with same type and name that source
$sqlp="SELECT * FROM tagente_modulo WHERE id_agente = ".$d_id_agente." AND nombre = '".$o_nombre."' AND id_tipo_modulo = ".$o_id_tipo_modulo;
$resultp=mysql_query($sqlp);
if ( $rowp=mysql_fetch_array($resultp)){
// If rowp success get ID
$d_id_agente_modulo = $rowp["id_agente_modulo"];
// Read every alert from source agent
$sql2='SELECT * FROM talerta_agente_modulo WHERE id_agente_modulo = '.$o_id_agente_modulo;
$result3=mysql_query($sql2);
while ($row3=mysql_fetch_array($result3)){
$o_id_alerta = $row3["id_alerta"];
$o_al_campo1 = $row3["al_campo1"];
$o_al_campo2 = $row3["al_campo2"];
$o_al_campo3 = $row3["al_campo3"];
$o_descripcion = $row3["descripcion"];
$o_dis_max = $row3["dis_max"];
$o_dis_min = $row3["dis_min"];
$o_time_threshold = $row3["time_threshold"];
$o_last_fired = "2001-01-01 00:00:00";
$o_max_alerts = $row3["max_alerts"];
$o_min_alerts = $row3["min_alerts"];
$o_times_fired = 0;
$o_alert_text = $row3["alert_text"];
$o_time_from = $row3["time_from"];
$o_time_to = $row3["time_to"];
$o_monday = $row3["monday"];
$o_tuesday = $row3["tuesday"];
$o_wednesday = $row3["wednesday"];
$o_thursday = $row3["thursday"];
$o_friday = $row3["friday"];
$o_saturday = $row3["saturday"];
$o_sunday = $row3["sunday"];
$o_recovery_notify = $row3["recovery_notify"];
$o_priority = $row3["priority"];
$o_al_f2_recovery= $row3["al_f2_recovery"];
$o_al_f3_recovery= $row3["al_f3_recovery"];
// Insert
$sql_al="INSERT INTO talerta_agente_modulo (id_agente_modulo, id_alerta, al_campo1, al_campo2, al_campo3, descripcion, dis_max, dis_min, time_threshold, last_fired, max_alerts, times_fired, min_alerts,
alert_text, time_from, time_to, monday, tuesday, wednesday,
thursday, friday, saturday, sunday, recovery_notify, priority,
al_f2_recovery, al_f3_recovery )
VALUES ( $d_id_agente_modulo , $o_id_alerta, '$o_al_campo1',
'$o_al_campo2', '$o_al_campo3', '$o_descripcion', $o_dis_max,
$o_dis_min, $o_time_threshold, '$o_last_fired', $o_max_alerts,
$o_times_fired, $o_min_alerts, '$o_alert_text', '$o_time_from',
'$o_time_to', '$o_monday', '$o_tuesday', '$o_wednesday',
'$o_thursday', '$o_friday', '$o_saturday', '$o_sunday',
$o_recovery_notify, $o_priority, '$o_al_f2_recovery',
'$o_al_f3_recovery' )";
$result_al=mysql_query($sql_al);
echo "DEBUG SQL: $sql_al <br>";
echo "<br>&nbsp;&nbsp;".$lang_label["copyale"]." ->".$o_descripcion;
}
} else
echo "<br><h3 class='error'>ERROR: ".$lang_label["notfoundmod"].$o_nombre.$lang_label["inagent"].dame_nombre_agente($d_id_agente)."</h3>";
} //while
} // for
} // Alerts
} // for each destination agent
} //end if copy modules or alerts
// -----------
// DELETE DATA
// -----------
elseif (isset($_POST["delete"])) {
echo "<h2>".$lang_label["deletedata"]."</h2>";
// Initial checkings
// if selected more than 0 agents
$destino = $_POST["destino"];
if (count($destino) <= 0){
echo "<h3 class='error'>ERROR: ".$lang_label["noagents_del"]."</h3>";
break;
}
// If selected modules or alerts
if (isset($_POST["modules"]))
$modulos = 1;
else
$modulos = 0;
if (isset($_POST["alerts"]))
$alertas = 1;
else
$alertas = 0;
if (($alertas + $modulos) == 0){
echo "<h3 class='error'>ERROR: ".$lang_label["del_sel_err"]."</h3>";
break;
}
// Delete
for ($a=0;$a <count($destino); $a++){ // for each agent
$id_agente = $destino[$a];
if ($modulos == 1){
echo "<br>".$lang_label["deleting_data"]." -> ".dame_nombre_agente($id_agente);
// Deleting data
$sql1='SELECT * FROM tagente_modulo WHERE id_agente = '.$id_agente;
$result1=mysql_query($sql1);
while ($row=mysql_fetch_array($result1)){
$sql_delete1="DELETE FROM tagente_datos WHERE id_agente_modulo=".$row["id_agente_modulo"];
$sql_delete2="DELETE FROM tagente_datos_inc WHERE id_agente_modulo=".$row["id_agente_modulo"];
$sql_delete3="DELETE FROM tagente_datos_string WHERE id_agente_modulo=".$row["id_agente_modulo"];
$result=mysql_query($sql_delete1);
$result=mysql_query($sql_delete2);
$result=mysql_query($sql_delete3);
}
// Delete conf
$sql_delete5 ="DELETE FROM tagente_modulo WHERE id_agente = ".$id_agente; // delete from table tagente_modulo
$sql_delete6 ="DELETE FROM tagente_estado WHERE id_agente = ".$id_agente; // detele from table tagente_estado
$result=mysql_query($sql_delete5);
$result=mysql_query($sql_delete6);
}
// delete alerts definitions
if ($alertas == 1){
// delete data
$sql1='SELECT * FROM tagente_modulo WHERE id_agente = '.$id_agente;
$result1=mysql_query($sql1);
while ($row=mysql_fetch_array($result1)){
$sql_delete1="DELETE FROM talerta_agente_modulo WHERE id_agente_modulo=".$row["id_agente_modulo"];
$result = mysql_query($sql_delete1);
} // while
}//if
}// for
}//delete
// ============
// Form view
// ============
} else {
// title
echo '<h2>'.lang_string ("agent_conf"). '&gt;'. lang_string ("config_manage").'</h2>';
echo '<form method="post" action="index.php?sec=gagente&sec2=godmode/agentes/manage_config&operacion=1">';
echo "<table width='650' border='0' cellspacing='4' cellpadding='4' class='databox'>";
// Source group
echo '<tr><td class="datost"><b>'. lang_string ("Source group"). '</b><br><br>';
echo '<select name="id_group" style="width:200px">';
if ($id_group != 0)
echo "<option value=$id_group>".dame_nombre_grupo ($id_group);
echo "<option value=0>".lang_string ("All");
list_group ($config["id_user"]);
echo '</select>';
echo '&nbsp;&nbsp;';
echo '<input type=submit name="update_group" class="sub upd" value="'.lang_string("Filter").'">';
echo '<br><br>';
// Source agent
echo '<b>'. lang_string ("source_agent").'</b><br><br>';
// Show combo with SOURCE agents
if ($id_group != 0)
$sql1 = "SELECT * FROM tagente WHERE id_grupo = $id_group ORDER BY nombre ";
else
$sql1 = 'SELECT * FROM tagente ORDER BY nombre';
echo '<select name="origen" style="width:200px">';
if (($update_agent != 1) AND ($origen != -1))
echo "<option value=".$_POST["origen"].">".dame_nombre_agente($origen)."</option>";
$result=mysql_query($sql1);
while ($row=mysql_fetch_array($result)){
if (give_acl ($config["id_user"], $row["id_grupo"], "AR")){
if ( $origen != $row["id_agente"])
echo "<option value=".$row["id_agente"].">".$row["nombre"]."</option>";
}
echo '</select>&nbsp;&nbsp;<input type=submit name="update_agent" class="sub upd" value="'.$lang_label["get_info"].'"><br><br>';
echo "<b>".$lang_label["modules"]."</b><br><br>";
echo "<select name='origen_modulo[]' size=10 multiple=yes style='width: 175px;'>";
if ( (isset($_POST["update_agent"])) AND (isset($_POST["origen"])) ) {
// Populate Module/Agent combo
$agente_modulo = $_POST["origen"];
$sql1="SELECT * FROM tagente_modulo WHERE id_agente = ".$agente_modulo. " ORDER BY nombre";
$result = mysql_query($sql1);
while ($row=mysql_fetch_array($result)){
echo "<option value=".$row["id_agente_modulo"].">".$row["nombre"]."</option>";
}
}
echo "</select>";
?>
<td class="datost"><b><?php echo $lang_label["copy_conf"]; ?></b><br><br>
<table>
<tr class=datos><td><?php echo $lang_label["modules"]; ?><td><input type="checkbox" name="modules" value="1" class="chk"><br>
<tr class=datos><td><?php echo $lang_label["alerts"]; ?><td><input type="checkbox" name="alerts" value="1" class="chk"><br>
</table>
<tr><td class="datost">
<b><?php echo $lang_label["toagent"]; ?></b><br><br>
<select name=destino[] size=10 multiple=yes style='width: 175px;'>
<?php
// Show combo with agents
$sql1='SELECT * FROM tagente order by nombre';
$result=mysql_query($sql1);
while ($row=mysql_fetch_array($result)){
echo "<option value=".$row["id_agente"].">".$row["nombre"]."</option>";
}
?>
</select>
<td align="right" class="datosb">
<input type="submit" name="copy" class="sub copy" value="<?php echo $lang_label["copy"].'" onClick="if (!confirm("'.$lang_label["are_you_sure"].'")) return false;>'; ?>
<input type="submit" name="delete" class="sub delete" value="<?php echo $lang_label["delete"].'" onClick="if (!confirm("'.$lang_label["are_you_sure"].'")) return false;>'; ?>
<tr><td colspan=2>
</div></td></tr>
</table>
<?php
}
} else {
audit_db($id_user,$REMOTE_ADDR, "ACL Violation","Trying to access Agent Config Management Admin section");
require ("general/noaccess.php");
echo '</select>';
echo '&nbsp;&nbsp;';
echo '<input type=submit name="update_agent" class="sub upd" value="'.lang_string ("get_info").'">';
echo '<br><br>';
// Source Module(s)
echo "<b>".$lang_label["modules"]."</b><br><br>";
echo "<select name='origen_modulo[]' size=10 multiple=yes style='width: 250px;'>";
if ( (isset($_POST["update_agent"])) AND (isset($_POST["origen"])) ) {
// Populate Module/Agent combo
$agente = $_POST["origen"];
$sql1="SELECT * FROM tagente_modulo WHERE id_agente = ".$agente. " ORDER BY nombre";
$result = mysql_query($sql1);
while ($row=mysql_fetch_array($result)){
echo "<option value=".$row["id_agente_modulo"].">".$row["nombre"]."</option>";
}
}
echo "</select>";
echo '<td class="datost">';
echo '<b>'.lang_string ("copy_conf"). '</b><br><br>';
echo '<table>';
echo '<tr class=datos><td>'.lang_string ("modules");
echo '<td><input type="checkbox" name="modules" value="1" class="chk">';
echo '<tr class=datos><td>'.lang_string ("alerts");
echo '<td><input type="checkbox" name="alerts" value="1" class="chk">';
echo '</table>';
// Destination agent
echo '<tr><td class="datost">';
echo '<b>'.$lang_label["toagent"].'</b><br><br>';
echo "<select name=destino[] size=10 multiple=yes style='width: 250px;'>";
$sql1='SELECT * FROM tagente ORDER BY nombre';
$result=mysql_query($sql1);
while ($row=mysql_fetch_array($result)){
if (give_acl ($config["id_user"], $row["id_grupo"], "AW"))
echo "<option value=".$row["id_agente"].">".$row["nombre"]."</option>";
}
echo '</select>';
// Form buttons
echo '<td align="right" class="datosb">';
echo '<input type="submit" name="copy" class="sub copy" value="'.lang_string ("copy").'" onClick="if (!confirm("'.lang_string ("are_you_sure").'")) return false;>';
echo '<input type="submit" name="delete" class="sub delete" value="'. lang_string("delete").'" onClick="if (!confirm("'.lang_string ("are_you_sure").'")) return false;>';
echo '<tr><td colspan=2>';
echo '</div></td></tr>';
echo '</table>';
}
?>

View File

@ -0,0 +1,142 @@
<?php
// Pandora FMS
// ====================================
// Copyright (c) 2004-2008 Sancho Lerena, slerena@gmail.com
// Copyright (c) 2005-2008 Artica Soluciones Tecnoloicas S.L, info@artica.es
// 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
// 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
// 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");
comprueba_login();
$id_user = $_SESSION["id_usuario"];
$origen = get_parameter ("origen", -1);
$id_group = get_parameter ("id_group", -1);
$update_agent = get_parameter ("update_agent", -1);
$update_group = get_parameter ("update_group", -1);
if ( (give_acl($id_user, 0, "LM")==0) AND (give_acl($id_user, 0, "AW")==0) ){
audit_db($id_user,$REMOTE_ADDR, "ACL Violation","Trying to access Agent Config Management Admin section");
require ("general/noaccess.php");
}
// Operations
// ---------------
if ((isset($_GET["operacion"])) AND ($update_agent == -1) AND ($update_group == -1) ) {
// DATA COPY
// ---------
if (isset($_POST["copy"])) {
echo "<h2>".$lang_label["datacopy"]."</h2>";
// Initial checkings
// if selected more than 0 agents
$destino = $_POST["destino"];
if (count($destino) <= 0){
echo "<h3 class='error'>ERROR: ".$lang_label["noagents_cp"]."</h3>";
echo "</table>";
include ("general/footer.php");
exit;
}
// Source
$id_origen = $_POST["origen"];
// Copy files
for ($a=0;$a <count($destino); $a++){
// For every agent in destination
$id_agente = $destino[$a];
$agent_name_src = dame_nombre_agente($id_origen);
$agent_name_dst = dame_nombre_agente($id_agente);
echo "<br><br>".$lang_label["copyage"]."<b> [".$agent_name_src."] -> [".$agent_name_dst."]</b>";
$source = $config["remote_config"]."/".md5($agent_name_src);
$destination = $config["remote_config"]."/".md5($agent_name_dst);
copy ( $source.".md5", $destination.".md5" );
copy ( $source.".conf", $destination.".conf" );
} // for each destination agent
} //end if copy modules or alerts
// ============
// Form view
// ============
} else {
// title
echo '<h2>'.lang_string ("agent_conf"). '&gt;'. lang_string ("config_manage").'</h2>';
echo '<form method="post" action="index.php?sec=gagente&sec2=godmode/agentes/manage_config_remote&operacion=1">';
echo "<table width='650' border='0' cellspacing='4' cellpadding='4' class='databox'>";
// Source group
echo '<tr><td class="datost"><b>'. lang_string ("Source group"). '</b><br><br>';
echo '<select name="id_group" style="width:200px">';
if ($id_group != 0)
echo "<option value=$id_group>".dame_nombre_grupo ($id_group);
echo "<option value=0>".lang_string ("All");
list_group ($config["id_user"]);
echo '</select>';
echo '&nbsp;&nbsp;';
echo '<input type=submit name="update_group" class="sub upd" value="'.lang_string("Filter").'">';
echo '<br><br>';
// Source agent
echo '<b>'. lang_string ("source_agent").'</b><br><br>';
// Show combo with SOURCE agents
if ($id_group != 0)
$sql1 = "SELECT * FROM tagente WHERE id_grupo = $id_group ORDER BY nombre ";
else
$sql1 = 'SELECT * FROM tagente ORDER BY nombre';
echo '<select name="origen" style="width:200px">';
if (($update_agent != 1) AND ($origen != -1))
echo "<option value=".$_POST["origen"].">".dame_nombre_agente($origen)."</option>";
$result=mysql_query($sql1);
while ($row=mysql_fetch_array($result)){
if (give_acl ($config["id_user"], $row["id_grupo"], "AR")){
if ( $origen != $row["id_agente"])
echo "<option value=".$row["id_agente"].">".$row["nombre"]."</option>";
}
}
echo '</select>';
echo '&nbsp;&nbsp;';
echo '<input type=submit name="update_agent" class="sub upd" value="'.lang_string ("get_info").'">';
echo '<br><br>';
// Destination agent
echo '<tr><td class="datost">';
echo '<b>'.$lang_label["toagent"].'</b><br><br>';
echo "<select name=destino[] size=10 multiple=yes style='width: 250px;'>";
$sql1='SELECT * FROM tagente ORDER BY nombre';
$result=mysql_query($sql1);
while ($row=mysql_fetch_array($result)){
if (give_acl ($config["id_user"], $row["id_grupo"], "AW"))
echo "<option value=".$row["id_agente"].">".$row["nombre"]."</option>";
}
echo '</select>';
// Form buttons
echo '<td align="right" class="datosb">';
echo '<input type="submit" name="copy" class="sub next" value="'.lang_string ("Replicate configuration").'" onClick="if (!confirm("'.lang_string ("are_you_sure").'")) return false;>';
echo '<tr><td colspan=2>';
echo '</div></td></tr>';
echo '</table>';
}
?>

View File

@ -105,10 +105,11 @@ echo '<tr>';
echo '<td class="datos">'.lang_string ("source_module")."</td>";
echo '<td class="datos" colspan=3>';
echo '<select name="form_id_prediction_module">';
$sql1='SELECT id_agente_modulo, nombre, id_agente FROM tagente_modulo WHERE id_tipo_modulo NOT IN (100,24,19,20,21,22,23,17,10,2) ORDER BY nombre, id_agente';
$sql1='SELECT id_agente_modulo, tagente_modulo.nombre, tagente.id_agente, tagente.id_grupo, tagente.nombre FROM tagente_modulo, tagente WHERE id_tipo_modulo NOT IN (100,24,19,20,21,22,23,17,10,2) AND tagente.id_agente = tagente_modulo.id_agente ORDER BY tagente.nombre';
$result=mysql_query($sql1);
while ($row=mysql_fetch_array($result)){
echo "<option value='".$row[0]."'>".$row["nombre"]." / ".dame_nombre_agente($row["id_agente"]);
if (give_acl($config["id_user"], $row[3], "AR"))
echo "<option value='".$row[0]."'>".$row[1]. " / ". $row[4];
}
echo "</select>";
echo "</tr>";

View File

@ -43,9 +43,16 @@ if (comprueba_login() == 0){
if (isset($_GET["sec2"]) && $_GET["sec2"] == "godmode/agentes/manage_config"){
echo "<div class='arrowgs'>";
}
else echo "<div class='arrowg'>";
echo "<ul class='mn'><li><a href='index.php?sec=gagente&amp;sec2=godmode/agentes/manage_config' class='mn'>".$lang_label["manage_config"]."</a></li></ul></div>";
else
echo "<div class='arrowg'>";
echo "<ul class='mn'><li><a href='index.php?sec=gagente&amp;sec2=godmode/agentes/manage_config' class='mn'>".lang_string ("manage_config")."</a></li></ul></div>";
if (isset($_GET["sec2"]) && $_GET["sec2"] == "godmode/agentes/manage_config_remote"){
echo "<div class='arrowgs'>";
}
else
echo "<div class='arrowg'>";
echo "<ul class='mn'><li><a href='index.php?sec=gagente&amp;sec2=godmode/agentes/manage_config_remote' class='mn'>".lang_string ("Duplicate config")."</a></li></ul></div>";
// Manage groups
if ((give_acl($id_user, 0, "PM")==1)){

View File

@ -33,6 +33,10 @@ if (comprueba_login() == 0)
$config["style"] = $_POST["style"];
$config["remote_config"] = $_POST["remote_config"];
$config["graph_color1"] = $_POST["graph_color1"];
$config["graph_color2"] = $_POST["graph_color2"];
$config["graph_color3"] = $_POST["graph_color3"];
$result2=mysql_query("UPDATE tconfig SET VALUE='".$config["remote_config"]."' WHERE TOKEN='remote_config'");
$result2=mysql_query("UPDATE tconfig SET VALUE='".$config["block_size"]."' WHERE TOKEN='block_size'");
$result2=mysql_query("UPDATE tconfig SET VALUE='".$config["language"]."' WHERE TOKEN='language_code'");
@ -43,6 +47,10 @@ if (comprueba_login() == 0)
$result2=mysql_query("UPDATE tconfig SET VALUE='".$config["show_unknown"]."' WHERE token='show_unknown'");
$result2=mysql_query("UPDATE tconfig SET VALUE='".$config["show_lastalerts"]."' WHERE token='show_lastalerts'");
$result2=mysql_query("UPDATE tconfig SET VALUE='".$config["style"]."' WHERE token='style'");
$result2=mysql_query("UPDATE tconfig SET VALUE='".$config["graph_color1"]."' WHERE token='graph_color1'");
$result2=mysql_query("UPDATE tconfig SET VALUE='".$config["graph_color2"]."' WHERE token='graph_color2'");
$result2=mysql_query("UPDATE tconfig SET VALUE='".$config["graph_color3"]."' WHERE token='graph_color3'");
}
echo "<h2>".$lang_label["setup_screen"]." &gt; ";
echo $lang_label["general_config"]."</h2>";
@ -66,21 +74,29 @@ if (comprueba_login() == 0)
echo '<tr><td class="datos2">'.lang_string ("Remote config directory");
echo '<td class="datos2"><input type="text" name="remote_config" size=30 value="'.$config["remote_config"].'"></td></tr>';
echo '<tr><td class="datos">'.$lang_label["days_compact"];
echo '<td class="datos"><input type="text" name="days_compact" size=5 value="'.$config["days_compact"].'"></td></tr>';
echo '<tr><td class="datos2">'.$lang_label["days_purge"];
echo '<td class="datos2"><input type="text" name="days_purge" size=5 value="'.$config["days_purge"].'"></td></tr>';
echo '<tr><td class="datos">'.$lang_label["graph_res"];
echo '<td class="datos"><input type="text" name="graph_res" size=5 value="'.$config["graph_res"].'"></td></tr>';
echo '<tr><td class="datos2">'.$lang_label["step_compact"].'</td>';
echo '<td class="datos2"><input type="text" name="step_compact" size=5 value="'.$config["step_compact"].'"></td></tr>';
echo '<tr><td class="datos">'.lang_string("Graph color (min)");
echo '<td class="datos"><input type="text" name="graph_color1" size=8 value="'.$config["graph_color1"].'"></td></tr>';
echo '<tr><td class="datos2">'.lang_string("Graph color (avg)");
echo '<td class="datos2"><input type="text" name="graph_color2" size=8 value="'.$config["graph_color2"].'"></td></tr>';
echo '<tr><td class="datos">'.lang_string("Graph color (max)");
echo '<td class="datos"><input type="text" name="graph_color3" size=8 value="'.$config["graph_color3"].'"></td></tr>';
echo '<tr><td class="datos2">'.$lang_label["days_compact"];
echo '<td class="datos2"><input type="text" name="days_compact" size=5 value="'.$config["days_compact"].'"></td></tr>';
echo '<tr><td class="datos">'.$lang_label["show_unknown"].'</td>';
echo '<td class="datos"><select name="show_unknown" class="w120">';
echo '<tr><td class="datos">'.$lang_label["days_purge"];
echo '<td class="datos"><input type="text" name="days_purge" size=5 value="'.$config["days_purge"].'"></td></tr>';
echo '<tr><td class="datos2">'.$lang_label["graph_res"];
echo '<td class="datos2"><input type="text" name="graph_res" size=5 value="'.$config["graph_res"].'"></td></tr>';
echo '<tr><td class="datos">'.$lang_label["step_compact"].'</td>';
echo '<td class="datos"><input type="text" name="step_compact" size=5 value="'.$config["step_compact"].'"></td></tr>';
echo '<tr><td class="datos2">'.$lang_label["show_unknown"].'</td>';
echo '<td class="datos2"><select name="show_unknown" class="w120">';
if ($config["show_unknown"]==1) {
echo '<option value="1">'.$lang_label["active"].'</option>';
echo '<option value="0">'.$lang_label["disabled"].'</option>';
@ -90,8 +106,8 @@ if (comprueba_login() == 0)
echo '<option value="1">'.$lang_label["active"].'</option>';
}
echo '<tr><td class="datos2">'.$lang_label["show_lastalerts"];
echo '<td class="datos2"><select name="show_lastalerts" class="w120">';
echo '<tr><td class="datos">'.$lang_label["show_lastalerts"];
echo '<td class="datos"><select name="show_lastalerts" class="w120">';
if ($config["show_lastalerts"]==1) {
echo '<option value="1">'.$lang_label["active"].'</option>';
echo '<option value="0">'.$lang_label["disabled"].'</option>';

View File

@ -80,6 +80,16 @@ if($result2=mysql_query("SELECT * FROM tconfig")){
break;
case "remote_config": $config["remote_config"] = $row2["value"];
break;
case "graph_color1":
$config["graph_color1"] = $row2["value"];
break;
case "graph_color2":
$config["graph_color2"] = $row2["value"];
break;
case "graph_color3":
$config["graph_color3"] = $row2["value"];
break;
}
}
} else {

View File

@ -598,7 +598,7 @@ function get_parameter_post ( $name, $default = "" ){
function get_alert_priority ($priority = 0) {
global $config;
switch ($prio) {
switch ($priority) {
case 0:
return lang_string("Maintenance");
break;
@ -698,6 +698,7 @@ function show_alert_row_edit ($row2, $tdcolor = "datos", $id_tipo_modulo = 1, $c
$mymin = 0;
}
if ($row2["dis_max"]!=0){
$mytempdata = fmod($row2["dis_max"], 1);
if ($mytempdata == 0)
@ -709,10 +710,6 @@ function show_alert_row_edit ($row2, $tdcolor = "datos", $id_tipo_modulo = 1, $c
$mymax = 0;
}
if (($mymin == 0) && ($mymax == 0)) {
$mymin = lang_string ("N/A");
$mymax = $mymin;
}
// We have alert text ?
if ($row2["alert_text"]!= "") {

View File

@ -145,7 +145,7 @@ function dame_perfil ($id_profile) {
// ---------------------------------------------------------------
function give_disabled_group ($id_group) {
return (bool) get_db_value ('disabled', 'tgroup', 'id_grupo', (int) $id_group);
return (bool) get_db_value ('disabled', 'tgrupo', 'id_grupo', (int) $id_group);
}
@ -756,16 +756,18 @@ function give_agentmodule_flag($id_agent_module){
// Returns a combo with the groups and defines an array
// to put all groups with Agent Read permission
// ----------------------------------------------------------------------
function list_group ($id_user){
function list_group ($id_user, $show_all = 1){
$mis_grupos=array (); // Define array mis_grupos to put here all groups with Agent Read permission
$sql='SELECT id_grupo FROM tgrupo order by nombre';
$sql='SELECT id_grupo, nombre FROM tgrupo';
$result=mysql_query($sql);
while ($row=mysql_fetch_array($result)){
if ($row["id_grupo"] != 0){
if (give_acl($id_user,$row["id_grupo"], "AR") == 1){
array_push ($mis_grupos, $row["id_grupo"]); //Put in an array all the groups the user belongs
echo "<option value='".$row["id_grupo"]."'>".
dame_nombre_grupo($row["id_grupo"])."</option>";
if (($row["id_grupo"] != 1) OR ($show_all == 1)){
array_push ($mis_grupos, $row["id_grupo"]); //Put in an array all the groups the user belongs
echo "<option value='".$row["id_grupo"]."'>".
$row["nombre"]."</option>";
}
}
}
}

View File

@ -9,7 +9,7 @@ function toggleDiv (divid){
}
function winopeng(url,wid) {
nueva_ventana=open(url,wid,"width=530,height=275,status=no,toolbar=no,menubar=no");
nueva_ventana=open(url,wid,"width=570,height=310,status=no,toolbar=no,menubar=no,scrollbar=no");
// WARNING !! Internet Explorer DOESNT SUPPORT "-" CARACTERS IN WINDOW HANDLE VARIABLE
status =wid;
}

View File

@ -78,7 +78,7 @@ table, img {
}
.menu {
color:#000;
background:#ccc;
background:#ddd;
margin-left: 10px;
padding-left: 10px;
padding-top: 10px;
@ -87,10 +87,10 @@ table, img {
font-size:10px;
border:1px solid #000;
position:absolute;
margin:0; width:325px;
height:220px;
margin:0; width:315px;
height:240px;
visibility:hidden;
filter:alpha(opacity=95);
-moz-opacity: 0.95;
opacity: 0.95;
filter:alpha(opacity=90);
-moz-opacity: 0.90;
opacity: 0.90;
}

View File

@ -62,7 +62,9 @@ if (comprueba_login() == 0) {
<td class="datos"><b>'.strtoupper(salida_limpia($nombre_agente)).'</b></td>';
echo "<td class='datos2' width='40'>
<a class='info' href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=".$id_agente."&refr=60'><span>".$lang_label["refresh_data"]."</span><img src='images/refresh.png' class='top' border=0></a>&nbsp;&nbsp;";
<a class='info' href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=".$id_agente."&refr=60'><span>".$lang_label["refresh_data"]."</span><img src='images/refresh.png' class='top' border=0></a>&nbsp;";
echo "<a href='index.php?sec=estado&sec2=operation/agentes/ver_agente&flag_agent=1&id_agente=$id_agente'><img src='images/target.png' border=0></A>";
// Data base access graph
echo '</td>';
@ -88,19 +90,12 @@ if (comprueba_login() == 0) {
echo "</select>";
//if ($agent_type == 0) {
echo '<tr>
<td class="datos"><b>'.$lang_label["os"].'</b></td>
<td class="datos" colspan="2">
<img src="images/'.dame_so_icon($id_os).'"> - '.dame_so_name($id_os);
if ($os_version != "")
echo ' '.salida_limpia($os_version);
/*
} elseif ($agent_type == 1) {
echo '<tr>
<td class="datos"><b>'.$lang_label["agent_type"].'</b></td>
<td class="datos" colspan=2><img src="images/network.png">';
}*/
echo '<tr>
<td class="datos"><b>'.$lang_label["os"].'</b></td>
<td class="datos" colspan="2">
<img src="images/'.dame_so_icon($id_os).'"> - '.dame_so_name($id_os);
if ($os_version != "")
echo ' '.salida_limpia($os_version);
echo '</td>';
echo '</tr>';
@ -147,7 +142,7 @@ if (comprueba_login() == 0) {
// Last contact
echo '<tr>
<td class="datos2">
<td class="datos2f9">
<b>'.$lang_label["last_contact"]." / ".$lang_label["remote"].'</b>
</td>
<td class="datos2 f9" colspan="2">';
@ -182,7 +177,7 @@ if (comprueba_login() == 0) {
}
echo "<tr>
<td class='datos'><b>".$lang_label['next_contact']."</b>
<td class='datos' colspan=2>
<td class='datosf9' colspan=2>
<img src='reporting/fgraph.php?tipo=progress&percent=".$percentil."&height=20&width=200'>
</td>
</tr>

View File

@ -64,7 +64,7 @@
// Monitor checks
// ~~~~~~~~~~~~~~~
echo "<table width=770 border=0>";
echo "<tr><td>";
echo "<tr><td valign=top>";
echo "<table class='databox' celldpadding=4 cellspacing=4 width=250>";
// Summary
@ -79,6 +79,7 @@
echo "<tr><td colspan='2'><img src='reporting/fgraph.php?tipo=progress&height=20&width=260&mode=0&percent=$module_sanity ' title='$module_sanity % ".lang_string("of well initialized modules")."'>";
echo "<tr><td colspan='2'><b>".lang_string("Alert level")."</th>";
echo "<tr><td colspan='2'><img src='reporting/fgraph.php?tipo=progress&height=20&width=260&mode=0&percent=$alert_level' title='$alert_level % ".lang_string("of non-fired alerts")."'>";
echo "<br><br>";
echo "<tr>";

View File

@ -34,11 +34,22 @@ if (comprueba_login() == 0) {
if ($validate_alert != ""){
if (give_acl($id_usuario, $id_grupo, "AW")==1){
$alert_row = get_db_row ("talerta_agente_modulo", "id_aam", $validate_alert);
$am_row = get_db_row ("tagente_modulo", "id_agente_modulo", $alert_row["id_agente_modulo"]);
$ag_row = get_db_row ("tagente", "id_agente", $am_row["id_agente"]);
if ($alert_row["id_agente_modulo"] != 0){
$am_row = get_db_row ("tagente_modulo", "id_agente_modulo", $alert_row["id_agente_modulo"]);
$ag_row = get_db_row ("tagente", "id_agente", $am_row["id_agente"]);
} else {
$ag_row = get_db_row ("tagente", "id_agente", $alert_row ["id_agent"]);
}
$alert_name = $alert_row["descripcion"];
event_insert("Manual validation of alert for '$alert_name'", $ag_row["id_grupo"], $am_row["id_agente"], 1, $id_usuario, "alert_manual_validation", 1, $alert_row["id_agente_modulo"], $validate_alert);
// Single alerts
if ($alert_row["id_agente_modulo"] != 0){
event_insert("Manual validation of alert for '$alert_name'", $ag_row["id_grupo"], $am_row["id_agente"], 1, $config["id_user"], "alert_manual_validation", 1, $alert_row["id_agente_modulo"], $validate_alert);
// Combined alerts
} else {
event_insert("Manual validation of alert for '$alert_name'", $ag_row["id_grupo"], $alert_row ["id_agent"], 1, $config["id_user"], "alert_manual_validation", 1, 0, $validate_alert);
}
$sql='UPDATE talerta_agente_modulo SET times_fired = 0, internal_counter = 0 WHERE id_aam = '.$validate_alert;
$result=mysql_query($sql);
}
@ -53,6 +64,15 @@ if (comprueba_login() == 0) {
}
}
}
// Check for Network FLAG change request
if (isset($_GET["flag_agent"])){
if ($_GET["flag_agent"]==1){
if (give_acl($id_usuario, $id_grupo, "AW")==1){
$query ="UPDATE tagente_modulo SET flag=1 WHERE id_agente = ". $id_agente;
$res=mysql_query($query);
}
}
}
if (give_acl($id_usuario,$id_grupo, "AR") == 1){
echo "<div id='menu_tab_frame_view'>";
echo "<div id='menu_tab_left'>
@ -61,7 +81,6 @@ if (comprueba_login() == 0) {
<a href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=$id_agente'><img src='images/bricks.png' class='top' border=0>&nbsp; ".substr(dame_nombre_agente($id_agente),0,15)." - ".$lang_label["view_mode"]."</a>";
echo "</li>";
echo "</ul></div>";
if (isset($_GET["tab"]))
$tab = $_GET["tab"];

View File

@ -360,9 +360,10 @@ if ($total_events > 0){
echo "<img src='images/network.png'>";
break;
}
// Event description
echo "<td class='".$tdclass."f9' title='".$row2["evento"]."'>";
$event_title = safe_input ($row2["evento"]);
echo "<td class='".$tdclass."f9' title='$event_title'>";
echo substr($row2["evento"],0,45);
if (strlen($row2["evento"]) > 45)
echo "..";

View File

@ -46,7 +46,22 @@ INSERT INTO `talerta` VALUES (9,'Jabber Alert','echo _field3_ | sendxmpp -r _fie
/*!40000 ALTER TABLE `tconfig` DISABLE KEYS */;
LOCK TABLES `tconfig` WRITE;
INSERT INTO `tconfig` VALUES
(1,'language_code','en'),(3,'block_size','20'),(4,'days_purge','60'),(5,'days_compact','15'),(6,'graph_res','5'),(7,'step_compact','1'),(8,'db_scheme_version','2.0'),(9,'db_scheme_build','PD80401'),(13,'show_unknown','0'),(14,'show_lastalerts','1'),(15,'style','pandora'),(16, 'remote_config', '/var/spool/pandora/data_in');
(1,'language_code','en'),
(3,'block_size','20'),
(4,'days_purge','60'),
(5,'days_compact','15'),
(6,'graph_res','5'),
(7,'step_compact','1'),
(8,'db_scheme_version','2.0'),
(9,'db_scheme_build','PD80401'),
(13,'show_unknown','0'),
(14,'show_lastalerts','1'),
(15,'style','pandora'),
(16, 'remote_config', '/var/spool/pandora/data_in'),
(17, 'graph_color1', '#38B800'),
(18, 'graph_color2', '#42D100'),
(19, 'graph_color3', '#89FF09')
;
UNLOCK TABLES;
/*!40000 ALTER TABLE `tconfig` ENABLE KEYS */;
@ -66,15 +81,15 @@ UNLOCK TABLES;
--
LOCK TABLES `tgrupo` WRITE;
INSERT INTO `tgrupo` VALUES (1,'All','world',0,0);
INSERT INTO `tgrupo` VALUES (2,'Servers','server_database',0,0);
INSERT INTO `tgrupo` VALUES (3,'IDS','eye',0,0);
INSERT INTO `tgrupo` VALUES (4,'Firewalls','firewall',0,0);
INSERT INTO `tgrupo` VALUES (8,'Databases','database_gear',0,0);
INSERT INTO `tgrupo` VALUES (9,'Network','transmit',0,0);
INSERT INTO `tgrupo` VALUES (10,'Not classified','house',0,0);
INSERT INTO `tgrupo` VALUES (11,'Workstations','computer',0,0);
INSERT INTO `tgrupo` VALUES (12,'Applications','applications',0,0);
INSERT INTO `tgrupo` VALUES
(1,'All','world',0,0),
(2,'Servers','server_database',0,0),
(4,'Firewalls','firewall',0,0),
(8,'Databases','database_gear',0,0),
(9,'Network','transmit',0,0),
(10,'Unknown','world',0,0),
(11,'Workstations','computer',0,0),
(12,'Applications','applications',0,0);
UNLOCK TABLES;
/*!40000 ALTER TABLE `tgrupo` ENABLE KEYS */;

View File

@ -587,7 +587,7 @@ function grafico_modulo_sparse ($id_agente_modulo, $periodo, $show_event,
// 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->setFillColor( 'gray@0.1' );
$Plot->setLowerBound( $alert_low);
$Plot->setUpperBound( $alert_high );
}
@ -626,15 +626,13 @@ function grafico_modulo_sparse ($id_agente_modulo, $periodo, $show_event,
$Plot->setFillStyle($FillArray);
if ($avg_only == 1){
$FillArray->addColor('green@0.6');
$FillArray->addColor($config["graph_color1"]);
} else {
$FillArray->addColor('yellow@0.5');
$FillArray->addColor('orange@0.6');
$FillArray->addColor('#e37907@0.7');
$FillArray->addColor('red@0.7');
$FillArray->addColor('blue@0.7');
$FillArray->addColor('green@0.7');
$FillArray->addColor('black@0.7');
$FillArray->addColor($config["graph_color3"]);
$FillArray->addColor($config["graph_color2"]);
$FillArray->addColor($config["graph_color1"]);
}
$AxisY_Weather =& $Plotarea->getAxis(IMAGE_GRAPH_AXIS_Y);
@ -1963,6 +1961,7 @@ function grafico_modulo_boolean ( $id_agente_modulo, $periodo, $show_event,
// Generic parameter handling
// **************************
$id_agent = (int) get_parameter ('id_agent');
$tipo = (string) get_parameter ('tipo');
$pure = (bool) get_parameter ('pure');
$period = (int) get_parameter ('period', 86400);
@ -2013,6 +2012,8 @@ if ($graphic_type) {
case "db_agente_purge":
grafico_db_agentes_purge($id, $width, $height);
break;
case "event_module":
graph_event_module ($width, $height, $id_agent);
case "group_events":
grafico_eventos_grupo($width, $height);
break;

View File

@ -1,8 +1,8 @@
<?php
// Pandora - the Free monitoring system
// ====================================
// Copyright (c) 2004-2006 Sancho Lerena, slerena@gmail.com
// Copyright (c) 2005-2006 Artica Soluciones Tecnologicas S.L, info@artica.es
// Copyright (c) 2004-2008 Sancho Lerena, slerena@gmail.com
// Copyright (c) 2005-2008 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>
@ -22,7 +22,10 @@
// Global & session management
include ('../include/config.php');
session_start();
if (!isset($_SESSION["id_user"])){
session_start();
session_write_close();
}
include ('../include/functions.php');
include ('../include/functions_db.php');
@ -37,32 +40,25 @@ if (comprueba_login() != 0) {
}
// Parsing the refresh before sending any header
if (isset($_GET['refresh']) and is_numeric($_GET['refresh']) and $_GET['refresh']>0) {
$refresh = get_parameter ("refresh", -1);
if ($refresh != -1)
header( 'refresh: ' . $_GET['refresh'] );
}
echo '<html>
<head><title>Pandora FMS Graph</title>
<link rel="stylesheet" href="../include/styles/pandora_minimal.css" type="text/css">';
;
echo "<script type='text/javaScript' src='../include/javascript/calendar.js'></script>";
echo "</head><body>";
// Get input parameters
if (isset($_GET["label"]))
$label = entrada_limpia($_GET["label"]);
$label = get_parameter ("label","");
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["period"]))
$period = entrada_limpia($_GET["period"]);
else
$period = 3600; // 1 hour (the most fast query possible)
$period = get_parameter ( "period", 3600);
switch ($period) {
case 3600: $period_label = $lang_label["hour"];
@ -92,49 +88,22 @@ switch ($period) {
default: $period_label = human_time_description_raw ($period);
}
if (isset($_GET["draw_alerts"]))
$draw_alerts = entrada_limpia($_GET["draw_alerts"]);
else
$draw_alerts = 0;
if (isset($_GET["avg_only"]))
$avg_only = entrada_limpia($_GET["avg_only"]);
else
$avg_only = 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["zoom"])){
$zoom = entrada_limpia ($_GET["zoom"]);
if ($zoom > 1){
$height=$height*($zoom/2.1);
$width=$width*($zoom/1.4);
}
$draw_alerts = get_parameter("draw_alerts", 0);
$avg_only = get_parameter ("avg_only", 0);
$period = get_parameter ("period", 86400);
$id = get_parameter ("id", 0);
$width = get_parameter ("width", 555);
$height = get_parameter ("height", 245);
$label = get_parameter ("label", "");
$start_date = get_parameter ("start_date", date("Y-m-d"));
$draw_events = get_parameter ("draw_events", 0);
$graph_type = get_parameter ("type", "sparse");
$zoom = get_parameter ("zoom", 1);
if ($zoom > 1){
$height=$height*($zoom/2.1);
$width=$width*($zoom/1.4);
}
else
$zoom = "1";
if ($zoom > 1) {
echo "
@ -144,12 +113,12 @@ if ($zoom > 1) {
";
}
$graph_type = "sparse";
if (isset($_GET["type"]))
$graph_type = entrada_limpia($_GET["type"]);
echo "<img src='fgraph.php?tipo=$graph_type&draw_alerts=$draw_alerts&draw_events=$draw_events&id=$id&zoom=$zoom&label=$label&height=$height&width=$width&period=$period&avg_only=$avg_only' border=0 alt=''>";
$current = date("Y-m-d");
if ($start_date != $current){
$utime = strtotime ($start_date);
echo "<img src='fgraph.php?tipo=$graph_type&draw_alerts=$draw_alerts&draw_events=$draw_events&id=$id&zoom=$zoom&label=$label&height=$height&width=$width&period=$period&avg_only=$avg_only&date=$utime' border=0 alt=''>";
} else
echo "<img src='fgraph.php?tipo=$graph_type&draw_alerts=$draw_alerts&draw_events=$draw_events&id=$id&zoom=$zoom&label=$label&height=$height&width=$width&period=$period&avg_only=$avg_only' border=0 alt=''>";
echo "<table width=450 cellspacing=1 cellpadding=1 class='databox' style='margin-left: 20px'>";
echo "<tr><td><b>";
@ -168,11 +137,11 @@ echo "<img src='fgraph.php?tipo=$graph_type&draw_alerts=$draw_alerts&draw_events
<script type='text/javascript' src='../include/javascript/x_slide.js'></script>
<script type='text/javascript'><!--
var defOffset = 2;
var defSlideTime = 200;
var defSlideTime = 220;
var tnActive = 0;
var visibleMargin = 3;
var visibleMargin = 5;
var menuW = 325;
var menuH = 220;
var menuH = 310;
window.onload = function() {
var d;
d = xGetElementById('divmenu');
@ -226,7 +195,7 @@ echo "<img src='fgraph.php?tipo=$graph_type&draw_alerts=$draw_alerts&draw_events
</td><td>
<?php
echo "<tr><td>";
echo "Refresh time (sec)";
echo lang_string("Refresh time");
echo "<td colspan=2>";
echo "<input type='text' size=5 name='refresh' value='" . $refresh . "'>";
@ -237,7 +206,12 @@ echo "<img src='fgraph.php?tipo=$graph_type&draw_alerts=$draw_alerts&draw_events
echo "<input type='checkbox' name='avg_only' value=1>";
echo "<tr><td>";
echo "Zoom factor (1x)";
echo lang_string("Begin date");
echo "<td>";
echo "<input type='text' id='start_date' name='start_date' size=10 value='".substr($start_date,0,10)."'><img src='../images/calendar_view_day.png' onclick='scwShow(scwID(\"start_date\"),this);'> ";
echo "<tr><td>";
echo lang_string("Zoom factor");
echo "<td>";
echo "<select name=zoom>";
echo "<option value='$zoom'>"."x".$zoom;
@ -248,7 +222,7 @@ echo "<img src='fgraph.php?tipo=$graph_type&draw_alerts=$draw_alerts&draw_events
echo "</select>";
echo "<tr><td>";
echo "Range of time";
echo lang_string("Time range");
echo "<td>";
echo "<select name='period'>";
echo "<option value=$period>".$period_label;
@ -267,17 +241,16 @@ echo "<img src='fgraph.php?tipo=$graph_type&draw_alerts=$draw_alerts&draw_events
echo "</select>";
echo "<tr><td>";
echo "Show events ";
echo lang_string("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 lang_string("Show alert");
echo "<td>";
if ($draw_alerts == 1)
echo "<input type='checkbox' name='draw_alerts' value=1 CHECKED>";
@ -287,6 +260,7 @@ echo "<img src='fgraph.php?tipo=$graph_type&draw_alerts=$draw_alerts&draw_events
echo "<td>";
echo "<input type='submit' class='sub next' value='GO'>";
echo "<br>";
?>
</td></tr>
</table>