2008-08-21 Sancho Lerena <slerena@gmail.com>

* pandoradb*.sql: tplanned_downtime: Fixed a typo, changed timestamp 
	types, added executed field and removed id_agent_module.

	* manage_config.php:  (Problem copying keep_alive modules
	and alerts and solved bad message with no data supplied.

	* manage_config_remote.php: Solved BUG #2042788 Fixed, was missing 
	extension in filename check.

	* planned_downtime.php: Major rewrite. Now works with server model of
	planned downtimes based on select agents to disable in specific times.
	Using unixtime was a very nice idea, so the javascript controls are 
	fantastic to do this job!. Thanks Esteban and Evi!.

	* manage_recontask*: Some issues with styles, using new div for button.

	* modificar_server.php:  Some issues with styles, using new div for button

	* config.inc.php: By default, show errors, easy to debug first problems.

	* functions_db.php: Fixed problems detected in borrar_incidencia() function
	(this is delete_incident in spanish).

	* estado_agente.php: Added support to search by IP address in agent view.

	* networkmap.php: Regen on by default, Font label shortened.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1019 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
slerena 2008-08-21 19:16:16 +00:00
parent 4081e8301b
commit 81a61a3025
13 changed files with 340 additions and 179 deletions

View File

@ -1,3 +1,33 @@
2008-08-21 Sancho Lerena <slerena@gmail.com>
* pandoradb*.sql: tplanned_downtime: Fixed a typo, changed timestamp
types, added executed field and removed id_agent_module.
* manage_config.php: (Problem copying keep_alive modules
and alerts and solved bad message with no data supplied.
* manage_config_remote.php: Solved BUG #2042788 Fixed, was missing
extension in filename check.
* planned_downtime.php: Major rewrite. Now works with server model of
planned downtimes based on select agents to disable in specific times.
Using unixtime was a very nice idea, so the javascript controls are
fantastic to do this job!. Thanks Esteban and Evi!.
* manage_recontask*: Some issues with styles, using new div for button.
* modificar_server.php: Some issues with styles, using new div for button
* config.inc.php: By default, show errors, easy to debug first problems.
* functions_db.php: Fixed problems detected in borrar_incidencia() function
(this is delete_incident in spanish).
* estado_agente.php: Added support to search by IP address in agent view.
* networkmap.php: Regen on by default, Font label shortened.
2008-08-21 Esteban Sanchez <estebans@artica.es> 2008-08-21 Esteban Sanchez <estebans@artica.es>
* general/pandora_help.php: Added a require of a functions file. Added * general/pandora_help.php: Added a require of a functions file. Added
@ -319,6 +349,10 @@
* view_server_detail.php: Code stype update, and some fixes and new * view_server_detail.php: Code stype update, and some fixes and new
column information. column information.
* modificar_agente.php, configurar_agente.php: Fixed use of $id_user.
* index.php: Temporal workaround to use $id_user as global. Need to fix.
2008-08-05 Esteban Sanchez <estebans@artica.es> 2008-08-05 Esteban Sanchez <estebans@artica.es>
@ -339,10 +373,6 @@
* ChangeLog: Added comment about commit #1000. * ChangeLog: Added comment about commit #1000.
* modificar_agente.php, configurar_agente.php: Fixed use of $id_user.
* index.php: Temporal workaround to use $id_user as global. Need to fix.
2008-08-04 Esteban Sanchez <estebans@artica.es> 2008-08-04 Esteban Sanchez <estebans@artica.es>
* index.php: Set id_user in config array when login. This fixes errors * index.php: Set id_user in config array when login. This fixes errors

View File

@ -45,19 +45,18 @@ if ((isset($_GET["operacion"])) && ($update_agent == -1) && ($update_group == -1
// Initial checkings // Initial checkings
// if selected more than 0 agents // if selected more than 0 agents
$destino = $_POST["destino"]; if (isset($_POST["destino"]))
if (count($destino) <= 0){ $destino = $_POST["destino"];
if ((!isset($_POST["destino"])) OR (count($destino) <= 0)) {
echo "<h3 class='error'>ERROR: ".__('No selected agents to copy')."</h3>"; echo "<h3 class='error'>ERROR: ".__('No selected agents to copy')."</h3>";
echo "</table>"; return;
include ("general/footer.php");
exit;
} }
$origen_modulo = $_POST["origen_modulo"]; if (isset($_POST["origen_modulo"]))
if (count($origen_modulo) <= 0){ $origen_modulo = $_POST["origen_modulo"];
if ((!isset($_POST["origen_modulo"])) OR (count($origen_modulo) <= 0)) {
echo "<h3 class='error'>ERROR: ".__('No modules has been selected')."</h3>"; echo "<h3 class='error'>ERROR: ".__('No modules has been selected')."</h3>";
echo "</table>"; return;
include ("general/footer.php");
exit;
} }
$multiple=1; $multiple=1;
@ -132,8 +131,7 @@ if ((isset($_GET["operacion"])) && ($update_agent == -1) && ($update_group == -1
// Write every module in destination agent // Write every module in destination agent
if ($o_nombre != "agent_keepalive") { $sql = "INSERT INTO tagente_modulo (
$sql = "INSERT INTO tagente_modulo (
id_agente,id_tipo_modulo,descripcion, nombre, max, min, id_agente,id_tipo_modulo,descripcion, nombre, max, min,
module_interval, tcp_port, tcp_send, tcp_rcv, snmp_community, module_interval, tcp_port, tcp_send, tcp_rcv, snmp_community,
snmp_oid, ip_target, id_module_group, flag, snmp_oid, ip_target, id_module_group, flag,
@ -148,35 +146,34 @@ if ((isset($_GET["operacion"])) && ($update_agent == -1) && ($update_group == -1
$o_id_plugin, '$o_plugin_parameter', '$o_plugin_user', $o_id_plugin, '$o_plugin_parameter', '$o_plugin_user',
'$o_plugin_pass', $o_id_modulo '$o_plugin_pass', $o_id_modulo
)"; )";
$result2=mysql_query($sql); $result2=mysql_query($sql);
if (! $result2) if (! $result2)
echo "<h3 class=error>".__('Problem updating database')."</h3>"; echo "<h3 class=error>".__('Problem updating database')."</h3>";
$o_id_agente_modulo = mysql_insert_id(); $o_id_agente_modulo = mysql_insert_id();
// Create with different estado if proc type or data type // Create with different estado if proc type or data type
if ( if (
($o_id_agente_modulo != "") AND ( ($o_id_agente_modulo != "") AND (
($o_id_tipo_modulo == 2) || ($o_id_tipo_modulo == 2) ||
($o_id_tipo_modulo == 6) || ($o_id_tipo_modulo == 6) ||
($o_id_tipo_modulo == 9) || ($o_id_tipo_modulo == 9) ||
($o_id_tipo_modulo == 100) || ($o_id_tipo_modulo == 100) ||
($o_id_tipo_modulo == 21) || ($o_id_tipo_modulo == 21) ||
($o_id_tipo_modulo == 18))){ ($o_id_tipo_modulo == 18))){
$sql_status_insert = "INSERT INTO tagente_estado $sql_status_insert = "INSERT INTO tagente_estado
(id_agente_modulo,datos,timestamp,cambio,estado,id_agente, utimestamp) (id_agente_modulo,datos,timestamp,cambio,estado,id_agente, utimestamp)
VALUES ( VALUES (
$o_id_agente_modulo, 0,'0000-00-00 00:00:00',0,0,'".$d_id_agente."',0 $o_id_agente_modulo, 0,'0000-00-00 00:00:00',0,0,'".$d_id_agente."',0
)"; )";
} else { } else {
$sql_status_insert = "INSERT INTO tagente_estado $sql_status_insert = "INSERT INTO tagente_estado
(id_agente_modulo,datos,timestamp,cambio,estado,id_agente, utimestamp) (id_agente_modulo,datos,timestamp,cambio,estado,id_agente, utimestamp)
VALUES ( VALUES (
$o_id_agente_modulo, 0,'0000-00-00 00:00:00',0,100,'".$d_id_agente."',0 $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;".__('Copying module')." ->".$o_nombre;
} }
$result_status=mysql_query($sql_status_insert);
echo "<br>&nbsp;&nbsp;".__('Copying module')." ->".$o_nombre;
} }
} }
} }

View File

@ -83,10 +83,10 @@ if ((isset($_GET["operacion"])) AND ($update_agent == -1) AND ($update_group ==
// Source group // Source group
echo '<tr><td class="datost"><b>'. __('Source group'). '</b><br><br>'; echo '<tr><td class="datost"><b>'. __('Source group'). '</b><br><br>';
echo '<select name="id_group" style="width:200px">'; echo '<select name="id_group" style="width:200px">';
if ($id_group != 0) if ($id_group != 0)
echo "<option value=$id_group>".dame_nombre_grupo ($id_group); echo "<option value=$id_group>".dame_nombre_grupo ($id_group);
echo "<option value=0>".__('All');
list_group ($config["id_user"]); list_group ($config["id_user"]);
echo '</select>'; echo '</select>';
echo '&nbsp;&nbsp;'; echo '&nbsp;&nbsp;';
@ -97,14 +97,15 @@ if ((isset($_GET["operacion"])) AND ($update_agent == -1) AND ($update_group ==
echo '<b>'. __('Source agent').'</b><br><br>'; echo '<b>'. __('Source agent').'</b><br><br>';
// Show combo with SOURCE agents // Show combo with SOURCE agents
if ($id_group != 0) if ($id_group > 1)
$sql1 = "SELECT * FROM tagente WHERE id_grupo = $id_group ORDER BY nombre "; $sql1 = "SELECT * FROM tagente WHERE id_grupo = $id_group ORDER BY nombre ";
else else
$sql1 = 'SELECT * FROM tagente ORDER BY nombre'; $sql1 = 'SELECT * FROM tagente ORDER BY nombre';
echo '<select name="origen" style="width:200px">'; echo '<select name="origen" style="width:200px">';
if (($update_agent != 1) AND ($origen != -1)){ if (($update_agent != 1) AND ($origen != -1)){
$agent_name_src = dame_nombre_agente ($origen); $agent_name_src = dame_nombre_agente ($origen);
$source = $config["remote_config"]."/". md5($agent_name_src); $source = $config["remote_config"]."/". md5($agent_name_src).".conf";
if (file_exists($source)) if (file_exists($source))
echo "<option value=".$_POST["origen"].">" . $agent_name_src . "</option>"; echo "<option value=".$_POST["origen"].">" . $agent_name_src . "</option>";
} }
@ -112,7 +113,7 @@ if ((isset($_GET["operacion"])) AND ($update_agent == -1) AND ($update_group ==
while ($row=mysql_fetch_array($result)){ while ($row=mysql_fetch_array($result)){
if (give_acl ($config["id_user"], $row["id_grupo"], "AR")){ if (give_acl ($config["id_user"], $row["id_grupo"], "AR")){
if ( $origen != $row["id_agente"]){ if ( $origen != $row["id_agente"]){
$source = $config["remote_config"]."/". md5($row["nombre"]); $source = $config["remote_config"]."/". md5($row["nombre"]).".conf";
if (file_exists($source)) if (file_exists($source))
echo "<option value=".$row["id_agente"].">".$row["nombre"]."</option>"; echo "<option value=".$row["id_agente"].">".$row["nombre"]."</option>";
} }

View File

@ -30,7 +30,6 @@ if (! give_acl ($config['id_user'], 0, "AW")) {
//Initialize data //Initialize data
$id_agent = get_parameter ("id_agent"); $id_agent = get_parameter ("id_agent");
$modules = get_modules_in_agent ($id_agent);
$name = ''; $name = '';
$description = ''; $description = '';
$date_from = (string) get_parameter ('date_from', date ('Y-m-j')); $date_from = (string) get_parameter ('date_from', date ('Y-m-j'));
@ -38,50 +37,77 @@ $time_from = (string) get_parameter ('time_from', date ('h:iA'));
$date_to = (string) get_parameter ('date_to', date ('Y-m-j')); $date_to = (string) get_parameter ('date_to', date ('Y-m-j'));
$time_to = (string) get_parameter ('time_to', date ('h:iA')); $time_to = (string) get_parameter ('time_to', date ('h:iA'));
$first_create = (int) get_parameter ('first_create', 0);
$first_update = (int) get_parameter ('first_update', 0);
$create_downtime = (int) get_parameter ('create_downtime'); $create_downtime = (int) get_parameter ('create_downtime');
$delete_downtime = (int) get_parameter ('delete_downtime'); $delete_downtime = (int) get_parameter ('delete_downtime');
$edit_downtime = (int) get_parameter ('edit_downtime'); $edit_downtime = (int) get_parameter ('edit_downtime');
$update_downtime = (int) get_parameter ('update_downtime'); $update_downtime = (int) get_parameter ('update_downtime');
$id_downtime = (int) get_parameter ('id_downtime'); $id_downtime = (int) get_parameter ('id_downtime',0);
//Here cometh the parsing of the entered form $insert_downtime_agent = (int) get_parameter ("insert_downtime_agent", 0);
if ($delete_downtime) { $delete_downtime_agent = (int) get_parameter ("delete_downtime_agent", 0);
$sql = sprintf ("DELETE FROM tplanned_downtime WHERE id = %d",
$id_downtime);
echo $sql; // INSERT A NEW DOWNTIME_AGENT ASSOCIATION
if ($insert_downtime_agent == 1){
$agents = $_POST["id_agent"];
for ($a=0;$a <count($agents); $a++){
$id_agente_dt = $agents[$a];
$sql = "INSERT INTO tplanned_downtime_agents (id_downtime, id_agent) VALUES ($id_downtime, $id_agente_dt)";
$result = process_sql ($sql);
}
}
// DELETE A DOWNTIME_AGENT ASSOCIATION
if ($delete_downtime_agent == 1){
$id_da = get_parameter ("id_downtime_agent");
$sql = "DELETE FROM tplanned_downtime_agents WHERE id = $id_da";
$result = process_sql ($sql); $result = process_sql ($sql);
if ($result === false) { }
// DELETE WHOLE DOWNTIME!
if ($delete_downtime) {
$sql = sprintf ("DELETE FROM tplanned_downtime WHERE id = %d", $id_downtime);
$result = process_sql ($sql);
$sql = sprintf ("DELETE FROM tplanned_downtime_agents WHERE id = %d", $id_downtime);
$result2 = process_sql ($sql);
if (($result === false) OR ($result2 === false)){
echo '<h3 class="error">'.__('Not deleted. Error deleting data').'</h3>'; echo '<h3 class="error">'.__('Not deleted. Error deleting data').'</h3>';
} else { } else {
echo '<h3 class="suc">'.__('Deleted successfully').'</h3>'; echo '<h3 class="suc">'.__('Deleted successfully').'</h3>';
} }
} }
// UPDATE OR CREATE A DOWNTIME (MAIN DATA, NOT AGENT ASSOCIATION)
if ($create_downtime || $update_downtime) { if ($create_downtime || $update_downtime) {
$description = (string) get_parameter ('description'); $description = (string) get_parameter ('description');
$name = (string) get_parameter ('name'); $name = (string) get_parameter ('name');
$id_module = (int) get_parameter ('id_agent_module');
$datetime_from = strtotime ($date_from.' '.$time_from); $datetime_from = strtotime ($date_from.' '.$time_from);
$datetime_to = strtotime ($date_to.' '.$time_to); $datetime_to = strtotime ($date_to.' '.$time_to);
echo $datetime_from.' > '.$datetime_to;
if ($datetime_from > $datetime_to) { if ($datetime_from > $datetime_to) {
echo '<h3 class="error">'.__('Not created. Error inserting data').': START &gt; END</h3>'; echo '<h3 class="error">'.__('Not created. Error inserting data').': START &gt; END</h3>';
} else { } else {
$sql = ''; $sql = '';
if ($create_downtime) { if ($create_downtime) {
$sql = sprintf ("INSERT INTO tplanned_downtime (`name`, $sql = sprintf ("INSERT INTO tplanned_downtime (`name`,
`description`, `date_from`, `date_to`, `id_agent_module`) `description`, `date_from`, `date_to`)
VALUES ('%s','%s',%d,%d,%d)", VALUES ('%s','%s',%d,%d)",
$name, $description, $datetime_from, $name, $description, $datetime_from,
$datetime_to, $id_module); $datetime_to);
} else if ($update_downtime) { } else if ($update_downtime) {
$sql = sprintf ("UPDATE tplanned_downtime $sql = sprintf ("UPDATE tplanned_downtime
SET `name`='%s', `description`='%s', `date_from`=%d, SET `name`='%s', `description`='%s', `date_from`=%d,
`date_to`=%d, `id_agent_module`=%d `date_to`=%d
WHERE `id` = '%d'", WHERE `id` = '%d'",
$name, $description, $datetime_from, $name, $description, $datetime_from,
$datetime_to, $id_module, $id_downtime); $datetime_to, $id_downtime);
} }
$result = process_sql ($sql); $result = process_sql ($sql);
@ -93,90 +119,197 @@ if ($create_downtime || $update_downtime) {
} }
} }
if ($id_downtime) { // Show create / update form
$sql = sprintf ("SELECT `id`, `name`, `description`, `date_from`, `date_to`, `id_agent_module`
FROM `tplanned_downtime` WHERE `id` = %d",
$id_downtime);
$result = get_db_row_sql ($sql); if (($first_create != 0) OR ($first_update != 0)){
$name = $result["name"]; // Have any data to show ?
$description = $result["description"]; if ($id_downtime > 0) {
$id_agent_module = $result["id_agent_module"]; $sql = sprintf ("SELECT `id`, `name`, `description`, `date_from`, `date_to`
$date_from = strftime ('%Y-%m-%d', $result["date_from"]); FROM `tplanned_downtime` WHERE `id` = %d",
$date_to = strftime ('%Y-%m-%d', $result["date_to"]); $id_downtime);
}
$result = get_db_row_sql ($sql);
$name = $result["name"];
$description = $result["description"];
$date_from = strftime ('%Y-%m-%d', $result["date_from"]);
$date_to = strftime ('%Y-%m-%d', $result["date_to"]);
}
$table->class = 'databox_color';
$table->width = '90%';
$table->data = array ();
$table->data[0][0] = __('Name');
$table->data[0][1] = print_input_text ('name', $name, '', 25, 40, true);
$table->data[2][0] = __('Description');
$table->data[2][1] = print_textarea ('description', 3, 35, $description, '', true);
$table->data[3][0] = __('Timestamp from');
$table->data[3][1] = print_input_text ('date_from', $date_from, '', 10, 10, true);
$table->data[3][1] .= print_input_text ('time_from', $time_from, '', 7, 7, true);
$table->data[4][0] = __('Timestamp to');
$table->data[4][1] = print_input_text ('date_to', $date_to, '', 10, 10, true);
$table->data[4][1] .= print_input_text ('time_to', $time_to, '', 7, 7, true);
echo '<form method="POST" action="index.php?sec=gagente&sec2=godmode/agentes/planned_downtime">';
//Page header if ($id_downtime > 0){
echo '<h3>'.__('Planned Downtime Form').' <img class="img_help" src="images/help.png" onClick="pandora_help(\'planned_downtime\')" /></h3>'; echo "<table width=100% border=0 cellpadding=4 >";
echo "<tr><td width=65% valign='top'>";
}
//Editor form
echo '<h3>'.__('Planned Downtime Form').' <img class="img_help" src="images/help.png" onClick="pandora_help(\'planned_downtime\')" /></h3>';
print_table ($table);
print_input_hidden ('id_agent', $id_agent);
echo '<div class="action-buttons" style="width: 90%">';
if ($id_downtime) {
print_input_hidden ('update_downtime', 1);
print_input_hidden ('id_downtime', $id_downtime);
print_submit_button (__('Update'), 'updbutton', false, 'class="sub upd"');
} else {
print_input_hidden ('create_downtime', 1);
print_submit_button (__('Add'), 'crtbutton', false, 'class="sub wand"');
}
echo '</div>';
echo '</form>';
if ($id_downtime > 0) {
$table->class = 'databox_color'; echo "<td valign=top>";
$table->width = '90%'; // Show available agents to include into downtime
$table->data = array (); echo '<h3>'.__('Available Agents').':</h3>';
$table->data[0][0] = __('Name');
$table->data[0][1] = print_input_text ('name', $name, '', 25, 40, true);
$table->data[1][0] = __('Module'); $filter_group = get_parameter("filter_group", -1);
$table->data[1][1] = print_input_text ('name', $name, '', 25, 40, true); if ($filter_group != -1)
$table->data[2][0] = __('Description'); $filter_cond = " AND id_grupo = $filter_group ";
$table->data[2][1] = print_textarea ('description', 2, 60, $description, '', true); else
$table->data[3][0] = __('Time from'); $filter_cond = "";
$table->data[3][1] = print_input_text ('date_from', $date_from, '', 10, 10, true); $sql = sprintf ("SELECT tagente.id_agente, tagente.nombre FROM tagente WHERE tagente.id_agente NOT IN (SELECT tagente.id_agente FROM tagente, tplanned_downtime_agents WHERE tplanned_downtime_agents.id_agent = tagente.id_agente AND tplanned_downtime_agents.id_downtime = %d) AND disabled = 0 $filter_cond ORDER by tagente.nombre", $id_downtime);
$table->data[3][1] .= print_input_text ('time_from', $time_from, '', 7, 7, true);
$table->data[4][0] = __('Time to'); $downtimes = get_db_all_rows_sql ($sql);
$table->data[4][1] = print_input_text ('date_from', $date_from, '', 10, 10, true); $data = array ();
$table->data[4][1] .= print_input_text ('time_to', $time_to, '', 7, 7, true); if ($downtimes)
foreach ($downtimes as $downtime) {
echo '<form method="POST" action="index.php?sec=gagente&sec2=godmode/agentes/planned_downtime">'; $data[$downtime['id_agente']] = $downtime['nombre'];
print_table ($table); }
print_input_hidden ('id_agent', $id_agent);
echo '<div class="action-buttons" style="width: '.$table->width.'">'; echo "<form method=post action='index.php?sec=gagente&sec2=godmode/agentes/planned_downtime&first_update=1&id_downtime=$id_downtime'>";
if ($id_downtime) {
print_input_hidden ('update_downtime', 1); print_select_from_sql ("SELECT id_grupo, nombre FROM tgrupo WHERE id_grupo > 1", "filter_group", $filter_group, '', __("Any"), -1, false, false);
print_input_hidden ('id_downtime', $id_downtime); echo "<br><br>";
print_submit_button (__('Update'), 'updbutton', false, 'class="sub upd"'); echo print_submit_button (__('Filter by group'), '', false, 'class="sub next"',false);
echo "</form>";
echo "<form method=post action='index.php?sec=gagente&sec2=godmode/agentes/planned_downtime&first_update=1&insert_downtime_agent=1&id_downtime=$id_downtime'>";
echo print_select ($data, "id_agent[]", '', '', '', 0, false, true);
echo "<br><br><br>";
echo print_submit_button (__('Add'), '', false, 'class="sub next"',false);
echo "</form>";
echo "</table>";
//Start Overview of existing planned downtime
echo '<h3>'.__('Agents planned for this downtime').':</h3>';
$table->class = 'databox';
$table->width = '80%';
$table->data = array ();
$table->head = array ();
$table->head[0] = __('Name');
$table->head[1] = __('Group');
$table->head[2] = __('OS');
$table->head[3] = __('Last contact');
$table->head[4] = __('Remove');
$sql = sprintf ("SELECT tagente.nombre, tplanned_downtime_agents.id, tagente.id_os, tagente.id_agente, tagente.id_grupo, tagente.ultimo_contacto FROM tagente, tplanned_downtime_agents WHERE tplanned_downtime_agents.id_agent = tagente.id_agente AND tplanned_downtime_agents.id_downtime = %d ",$id_downtime);
$downtimes = get_db_all_rows_sql ($sql);
if ($downtimes === false) {
$table->colspan[0][0] = 5;
$table->data[0][0] = __('No planned downtime');
$downtimes = array();
}
foreach ($downtimes as $downtime) {
$data = array ();
$data[0] = $downtime['nombre'];
$data[1] = get_db_sql ("SELECT nombre FROM tgrupo WHERE id_grupo = ". $downtime["id_grupo"]);
$data[2] = '<img src="images/'.dame_so_icon($downtime["id_os"]).'"> - '.dame_so_name($downtime["id_os"]);
$data[3] = $downtime["ultimo_contacto"];
$data[4] = '<a href="index.php?sec=gagente&sec2=godmode/agentes/planned_downtime&id_agent='.
$id_agent.'&delete_downtime_agent=1&first_update=1&id_downtime_agent='.$downtime["id"].'&id_downtime='.$id_downtime.'">
<img src="images/cross.png" border="0" alt="'.__('Delete').'"></a>';
array_push ($table->data, $data);
}
print_table ($table);
}
} else { } else {
print_input_hidden ('create_downtime', 1);
print_submit_button (__('Add'), 'crtbutton', false, 'class="sub wand"');
}
echo '</div>';
echo '</form>';
//Start Overview of existing planned downtime // View available downtimes present in database (if any of them)
echo '<h3>'.__('Planned Downtime').':</h3>'; $table->class = 'databox';
$table->width = '90%'; //Start Overview of existing planned downtime
$table->data = array (); echo '<h3>'.__('Planned Downtime present on system').':</h3>';
$table->head = array (); $table->width = '90%';
$table->head[0] = __('Name'); $table->data = array ();
$table->head[1] = __('Module'); $table->head = array ();
$table->head[2] = __('Time from'); $table->head[0] = __('Name #Ag.');
$table->head[3] = __('Time to'); $table->head[1] = __('Description');
$table->head[2] = __('From');
$table->head[3] = __('To');
$table->head[4] = __('Del');
$table->head[5] = __('Upd');
$table->head[6] = __('Running');
$sql = sprintf ("SELECT tplanned_downtime.id, tplanned_downtime.name, tplanned_downtime.id_agent_module, tplanned_downtime.date_from, tplanned_downtime.date_to $sql = "SELECT * FROM tplanned_downtime";
FROM tplanned_downtime, tagente_modulo WHERE tplanned_downtime.id_agent_module = tagente_modulo.id_agente_modulo $downtimes = get_db_all_rows_sql ($sql);
AND tagente_modulo.id_agente = %d AND date_to > UNIX_TIMESTAMP(NOW())", $id_agent); if ($downtimes === false) {
$downtimes = get_db_all_rows_sql ($sql); $table->colspan[0][0] = 5;
if ($downtimes === false) { $table->data[0][0] = __('No planned downtime');
$table->colspan[0][0] = 5; $downtimes = array();
$table->data[0][0] = __('No planned downtime'); }
$downtimes = array();
foreach ($downtimes as $downtime) {
$data = array();
$total = get_db_sql ("SELECT COUNT(id_agent) FROM tplanned_downtime_agents WHERE id_downtime = ".$downtime["id"]);
$data[0] = $downtime['name']. " ($total)";
$data[1] = $downtime['description'];
$data[2] = date ("Y-m-d H:i", $downtime['date_from']);
$data[3] = date ("Y-m-d H:i", $downtime['date_to']);
if ($downtime["executed"] == 0){
$data[4] = '<a href="index.php?sec=gagente&sec2=godmode/agentes/planned_downtime&id_agent='.
$id_agent.'&delete_downtime=1&id_downtime='.$downtime['id'].'">
<img src="images/cross.png" border="0" alt="'.__('Delete').'"></a>';
$data[5] = '<a href="index.php?sec=gagente&sec2=godmode/agentes/planned_downtime&edit_downtime=1&first_update=1&id_downtime='.$downtime['id'].'">
<img src="images/config.png" border="0" alt="'.__('Update').'"></a>';
}
if ($downtime["executed"] == 0)
$data[6] = "<img src='images/pixel_green.png' width=20 height=20>";
else
$data[6] = "<img src='images/pixel_red.png' width=20 height=20>";
array_push ($table->data, $data);
}
print_table ($table);
echo '<div class="action-buttons" style="width: '.$table->width.'">';
echo "<form method=post action='index.php?sec=gagente&sec2=godmode/agentes/planned_downtime'>";
echo "<input type=hidden name='first_create' value='1'>";
echo "<input type=submit class='sub wand' value='".__('Create')."'>";
echo "</form>";
} }
foreach ($downtimes as $downtime) {
$data = array ();
$data[0] = $downtime['name'];
$data[1] = dame_nombre_modulo_agentemodulo ($downtime['id_agent_module']);
$data[2] = date ("Y-m-d H:i", $downtime['date_from']);
$data[3] = date ("Y-m-d H:i", $downtime['date_to']);
$data[4] = '<a href="index.php?sec=gagente&sec2=godmode/agentes/planned_downtime&id_agent='.
$id_agent.'&delete_downtime=1&id_downtime='.$downtime['id'].'">
<img src="images/cross.png" border="0" alt="'.__('Delete').'"></a>';
$data[4] .= '<a href="index.php?sec=gagente&sec2=godmode/agentes/planned_downtime&id_agent='.
$id_agent.'&edit_downtime=1&id_downtime='.$downtime['id'].'">
<img src="images/config.png" border="0" alt="'.__('Update').'"></a>';
array_push ($table->data, $data);
}
print_table ($table);
?> ?>
<link rel="stylesheet" href="include/styles/datepicker.css" type="text/css" media="screen"> <link rel="stylesheet" href="include/styles/datepicker.css" type="text/css" media="screen">

View File

@ -129,9 +129,10 @@ if ($result !== false) {
echo '<div class="nf">'.__('There are no recon task configured').'</div>'; echo '<div class="nf">'.__('There are no recon task configured').'</div>';
} }
$table->align = array ("right"); echo '<div class="action-buttons" style="width: 700px">';
$table->width = 700; echo '<form method="post" action="index.php?sec=gservers&sec2=godmode/servers/manage_recontask_form&create">';
$table->data[] = array ('<form method="post" action="index.php?sec=gservers&sec2=godmode/servers/manage_recontask_form&create">'.print_submit_button (__('Create'),"crt",false,'class="sub next"',true).'</form>'); echo print_submit_button (__('Create'),"crt",false,'class="sub next"',true);
print_table($table); echo '</form>';
unset($table); echo "</div>";
?> ?>

View File

@ -135,18 +135,14 @@ $table->data[] = array (__('Comments'),print_textarea ("description", 2, 70, $de
print_table ($table); print_table ($table);
unset ($table); unset ($table);
//Table with buttons echo '<div class="action-buttons" style="width: 700px">';
$table->align = array ("right"); if ($id_rt != "-1")
$table->width = 700; echo print_submit_button (__('Update'),"crt",false,'class="sub upd"',true);
$table->cellpadding = 4; else
$table->cellspacing = 4; echo print_submit_button (__('Add'),"crt",false,'class="sub wand"',true);
if ($id_rt != "-1") { echo '</form>';
$table->data[] = array ('<input name="updbutton" type="submit" class="sub upd" value="'.__('Update').'">'); echo "</div>";
} else {
$table->data[] = array ('<input name="crtbutton" type="submit" class="sub wand" value="'.__('Add').'">');
}
print_table($table);
unset($table);
echo "</form>"; echo "</form>";

View File

@ -81,7 +81,7 @@ if (isset($_GET["server"])) {
if ($result !== false) { if ($result !== false) {
$table->cellpadding = 4; $table->cellpadding = 4;
$table->cellspacing = 4; $table->cellspacing = 4;
$table->width = "100%"; $table->width = "90%";
$table->class = "databox"; $table->class = "databox";
$table->align = array ('',"center","center","center","center","center","center","center"); $table->align = array ('',"center","center","center","center","center","center","center");
$table->head = array (__('Name'),__('Status'),__('IP Address'),__('Description'),__('Type'),__('Started at'),__('Updated at'),__('Delete')); $table->head = array (__('Name'),__('Status'),__('IP Address'),__('Description'),__('Type'),__('Started at'),__('Updated at'),__('Delete'));

View File

@ -28,7 +28,7 @@
// $config["homeurl"]="/pandora_console/"; // $config["homeurl"]="/pandora_console/";
// Do not display any ERROR // Do not display any ERROR
error_reporting(0); error_reporting(E_ALL);
// Display ALL errors // Display ALL errors
// error_reporting(E_ERROR); // error_reporting(E_ERROR);

View File

@ -767,26 +767,30 @@ function dame_generic_string_data ($id) {
function borrar_incidencia ($id_inc) { function borrar_incidencia ($id_inc) {
global $config; global $config;
$sql = sprintf ("DELETE FROM `tincidencia` WHERE `id_incidencia` = %d",$id_inc); $sql = sprintf ("DELETE FROM `tincidencia` WHERE `id_incidencia` = %d", $id_inc);
process_sql ($sql); process_sql ($sql);
$sql = sprintf ("SELECT `id_nota` FROM `tnota_inc` WHERE `id_incidencia` = %d".$id_inc); $sql = sprintf ("SELECT `id_nota` FROM `tnota_inc` WHERE `id_incidencia` = %d ", $id_inc);
$rows = get_db_all_rows_sql ($sql); $rows = get_db_all_rows_sql ($sql);
foreach ($rows as $row) { if ($rows){
$sql = sprintf ("DELETE FROM `tnota` WHERE `id_nota` = %d",$row["id_nota"]); foreach ($rows as $row) {
$sql = sprintf ("DELETE FROM `tnota` WHERE `id_nota` = %d",$row["id_nota"]);
process_sql ($sql);
}
$sql = "DELETE FROM `tnota_inc` WHERE `id_incidencia` = $id_inc";
process_sql ($sql); process_sql ($sql);
} }
$sql = "DELETE FROM `tnota_inc` WHERE `id_incidencia` = ".$id_inc;
process_sql ($sql);
// Delete attachments // Delete attachments
$sql = sprintf ("SELECT `id_attachment`,`filename` FROM `tattachment` WHERE `id_incidencia` = %d",$id_inc); $sql = sprintf ("SELECT `id_attachment`,`filename` FROM `tattachment` WHERE `id_incidencia` = %d", $id_inc);
$rows = get_db_all_rows_sql ($sql); $rows = get_db_all_rows_sql ($sql);
foreach ($rows as $row) { if ($rows){
// Unlink all attached files for this incident foreach ($rows as $row) {
unlink ($attachment_store."attachment/pand".$row["id_attachment"]."_".$row["filename"]); // Unlink all attached files for this incident
unlink ($attachment_store."attachment/pand".$row["id_attachment"]."_".$row["filename"]);
}
$sql = sprintf ("DELETE FROM `tattachment` WHERE `id_incidencia` = %d",$id_inc);
process_sql ($sql);
} }
$sql = sprintf ("DELETE FROM `tattachment` WHERE `id_incidencia` = %d",$id_inc);
process_sql ($sql);
} }
/** /**

View File

@ -84,7 +84,7 @@ echo "</td></table>";
if ($search != ""){ if ($search != ""){
$search_sql = " AND nombre LIKE '%$search%' "; $search_sql = " AND nombre LIKE '%$search%' OR direccion LIKE '%$search%' ";
} else { } else {
$search_sql = ""; $search_sql = "";
} }

View File

@ -240,7 +240,7 @@ $pure = (int) get_parameter ('pure');
$zoom = (float) get_parameter ('zoom'); $zoom = (float) get_parameter ('zoom');
$ranksep = (float) get_parameter ('ranksep', 2.5); $ranksep = (float) get_parameter ('ranksep', 2.5);
$simple = (boolean) get_parameter ('simple', 0); $simple = (boolean) get_parameter ('simple', 0);
$regen = (boolean) get_parameter ('regen',0); $regen = (boolean) get_parameter ('regen',1); // Always regen by default
$font_size = (int) get_parameter ('font_size', 12); $font_size = (int) get_parameter ('font_size', 12);
echo '<h2>'.__('Pandora Agents').' &gt; '.__('Network Map').'&nbsp'; echo '<h2>'.__('Pandora Agents').' &gt; '.__('Network Map').'&nbsp';
@ -302,7 +302,7 @@ if ($nooverlap == 1){
} }
echo "<td>"; echo "<td>";
echo __('Font size') . ' &nbsp;'; echo __('Font') . ' &nbsp;';
print_input_text ('font_size', $font_size, $alt = 'Font size (in pt)', 3, 4, 0); print_input_text ('font_size', $font_size, $alt = 'Font size (in pt)', 3, 4, 0);

View File

@ -720,11 +720,10 @@ CREATE TABLE IF NOT EXISTS `tplanned_downtime` (
`id` MEDIUMINT( 8 ) NOT NULL AUTO_INCREMENT, `id` MEDIUMINT( 8 ) NOT NULL AUTO_INCREMENT,
`name` VARCHAR( 100 ) NOT NULL, `name` VARCHAR( 100 ) NOT NULL,
`description` TEXT NOT NULL, `description` TEXT NOT NULL,
`date_from` INT NOT NULL, `date_from` bigint(20) NOT NULL default '0',
`date_to` INT NOT NULL, `date_to` bigint(20) NOT NULL default '0',
`id_agent_module` BIGINT(14) NOT NULL, `executed` tinyint(1) UNSIGNED NOT NULL default 0,
PRIMARY KEY ( `id` ) , PRIMARY KEY ( `id` )
INDEX (`date_from`, `date_end`, `id_agent_module`)
) ENGINE = InnoDB DEFAULT CHARSET=utf8; ) ENGINE = InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `tplanned_downtime_agents` ( CREATE TABLE IF NOT EXISTS `tplanned_downtime_agents` (

View File

@ -60,7 +60,7 @@ INSERT INTO `tconfig` VALUES
(18, 'graph_color2', '#42D100'), (18, 'graph_color2', '#42D100'),
(19, 'graph_color3', '#89FF09'), (19, 'graph_color3', '#89FF09'),
(20, 'sla_period', '604800'), (20, 'sla_period', '604800'),
(21, 'locale', 'C'),; (21, 'locale', 'C');
UNLOCK TABLES; UNLOCK TABLES;
-- --