Fix pandora diag texts and delete old secitons files - #1350

This commit is contained in:
enriquecd 2017-10-09 15:36:28 +02:00
parent b8809b2c36
commit c86bd5cc3c
6 changed files with 4 additions and 726 deletions

View File

@ -125,7 +125,7 @@ echo "<tr><th style='background-color:#b1b1b1;font-weight:bold;font-style:italic
render_row (phpversion(), "PHP Version");
render_row (ini_get('max_execution_time'), "PHP Max ejecution time");
render_row (ini_get('max_execution_time'), "PHP Max execution time");
render_row (ini_get('max_input_time'), "PHP Max input time");
@ -161,13 +161,9 @@ render_info_data ("SELECT COUNT( DISTINCT tagente.id_agente)
AND tagente_estado.id_agente = tagente.id_agente
AND tagente_estado.estado = 3","Total unknown agents");
render_info_data ("SELECT COUNT( DISTINCT tagente.id_agente)
FROM tagente_estado, tagente, tagente_modulo
WHERE tagente.disabled = 0
AND tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo
AND tagente_modulo.disabled = 0
AND tagente_estado.id_agente = tagente.id_agente
AND tagente_estado.estado = 4","Total not-init modules");
render_info_data ("SELECT COUNT(tagente_estado.estado)
FROM tagente_estado
WHERE tagente_estado.estado = 4","Total not-init modules");
$last_run_difference = '';

View File

@ -1,110 +0,0 @@
<?php
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2009 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// 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 for version 2.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Load global vars
global $config;
ui_print_page_header (__('Database maintenance').' &raquo; '.__('Database audit purge'), "images/gm_db.png", false, "", true);
check_login ();
if (! check_acl ($config['id_user'], 0, "DM")) {
db_pandora_audit("ACL Violation",
"Trying to access Database Management Audit");
require ("general/noaccess.php");
return;
}
// All data (now)
$time["all"] = get_system_time ();
// 1 day ago
$time["1day"] = $time["all"] - SECONDS_1DAY;
// 3 days ago
$time["3day"] = $time["all"] - ( SECONDS_1DAY * 3);
// 1 week ago
$time["1week"] = $time["all"] - SECONDS_1WEEK;
// 2 weeks ago
$time["2week"] = $time["all"] - SECONDS_2WEEK;
// 1 month ago
$time["1month"] = $time["all"] - SECONDS_1MONTH;
// Three months ago
$time["3month"] = $time["all"] - SECONDS_3MONTHS;
// Todo for a good DB maintenance
/*
- Delete too on datos_string and and datos_inc tables
- A function to "compress" data, and interpolate big chunks of data (1 month - 60000 registers)
onto a small chunk of interpolated data (1 month - 600 registers)
- A more powerful selection (by Agent, by Module, etc).
*/
# ADQUIRE DATA PASSED AS FORM PARAMETERS
# ======================================
# Purge data using dates
if (isset($_POST["purgedb"])) { # Fixed 2005-1-13, nil
$from_date = get_parameter_post("date_purge");
$deleted = db_process_sql_delete('tsesion', array('utimestamp' => '< ' . $from_date));
if ($deleted)
ui_print_success_message(__('Success data deleted'));
else
ui_print_error_message(__('Error deleting data'));
}
# End of get parameters block
echo "<table cellpadding='4' cellspacing='4' class='databox filters' width='100%'>";
echo "<tr><td class='datos'>";
$result = db_get_row_sql ("SELECT COUNT(*) AS total, MIN(fecha) AS first_date, MAX(fecha) AS latest_date FROM tsesion");
echo "<b>".__('Total')."</b></td>";
echo "<td class='datos'>".$result["total"]." ".__('Records')."</td>";
echo "<tr>";
echo "<td class='datos2'><b>".__('First date')."</b></td>";
echo "<td class='datos2'>".$result["first_date"]."</td></tr>";
echo "<tr><td class='datos'>";
echo "<b>".__('Latest date')."</b></td>";
echo "<td class='datos'>".$result["latest_date"]."</td>";
echo "</tr></table>";
?>
<h4><?php echo __('Purge data') ?></h4>
<form name="db_audit" method="post" action="index.php?sec=gdbman&sec2=godmode/db/db_audit">
<table width='100%' cellpadding='4' cellspacing='4' class='databox filters'>
<tr><td class='datos'>
<select name="date_purge">
<option value="<?php echo $time["3month"] ?>"><?php echo __('Purge audit data over 90 days') ?></option>
<option value="<?php echo $time["1month"] ?>"><?php echo __('Purge audit data over 30 days') ?></option>
<option value="<?php echo $time["2week"] ?>"><?php echo __('Purge audit data over 14 days') ?></option>
<option value="<?php echo $time["1week"] ?>"><?php echo __('Purge audit data over 7 days') ?></option>
<option value="<?php echo $time["3day"] ?>"><?php echo __('Purge audit data over 3 days') ?></option>
<option value="<?php echo $time["1day"] ?>"><?php echo __('Purge audit data over 1 day') ?></option>
<option value="<?php echo $time["all"] ?>"><?php echo __('Purge all audit data') ?></option>
</select>
</td>
<td class="datos">
<input class="sub wand" type="submit" name="purgedb" value="<?php echo __('Do it!') ?>" onClick="if (!confirm('<?php echo __('Are you sure?') ?>')) return false;">
</table>
</form>

View File

@ -1,94 +0,0 @@
<?php
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2009 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// 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 for version 2.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Load global vars
global $config;
check_login ();
ui_print_page_header (__('Database maintenance').' &raquo; ' .
__('Event database cleanup'), "images/gm_db.png", false, "", true);
if (! check_acl ($config['id_user'], 0, "DM")) {
db_pandora_audit("ACL Violation", "Trying to access Database Management Event");
require ("general/noaccess.php");
exit;
}
# ADQUIRE DATA PASSED AS FORM PARAMETERS
# ======================================
# Purge data using dates
if (isset ($_POST["date_purge"])) {
$from_date = (int) get_parameter_post ("date_purge");
$deleted = db_process_sql_delete('tevento',
array('utimestamp' => '< ' . $from_date));
if ($deleted !== false) {
ui_print_success_message(__('Successfully deleted old events'));
}
else {
ui_print_error_message(__('Error deleting old events'));
}
}
# End of get parameters block
$row = db_get_row_sql ("
SELECT COUNT(*) AS total,
MIN(timestamp) AS first_date,
MAX(timestamp) AS latest_date
FROM tevento");
$table = new stdClass();
$table->data = array ();
$table->cellpadding = 4;
$table->cellspacing = 4;
$table->class = "databox filters";
$table->width = '100%';
$table->data[0][0] = '<b>'.__('Total').':</b>';
$table->data[0][1] = $row["total"].' '.__('Records');
$table->data[1][0] = '<b>'.__('First date').':</b>';
$table->data[1][1] = $row["first_date"];
$table->data[2][0] = '<b>'.__('Latest data').':</b>';
$table->data[2][1] = $row["latest_date"];
html_print_table ($table);
unset ($table);
echo '<h4>'.__('Purge data').'</h4>';
echo '<form name="db_audit" method="post" action="index.php?sec=gdbman&sec2=godmode/db/db_event">';
echo '<table width="100%" cellpadding="4" cellspacing="4" class="databox filters">
<tr><td class="datos">';
$time = get_system_time ();
$fields = array ();
$fields[$time - SECONDS_3MONTHS] = __('Purge event data over 90 days');
$fields[$time - SECONDS_1MONTH] = __('Purge event data over 30 days');
$fields[$time - SECONDS_2WEEK] = __('Purge event data over 14 days');
$fields[$time - SECONDS_1WEEK] = __('Purge event data over 7 days');
$fields[$time - (SECONDS_1WEEK * 3)] = __('Purge event data over 3 days');
$fields[$time - SECONDS_1DAY] = __('Purge event data over 1 day');
$fields[$time] = __('Purge all event data');
html_print_select ($fields, "date_purge", '', '', '', '0', false, false, false, "w255");
echo '</td><td class="datos">';
html_print_submit_button (__('Do it!'),'purgedb', false, 'class="sub wand" onClick="if (!confirm(\''.__('Are you sure?').'\')) return false;"');
echo '</td></tr></table></form>';
?>

View File

@ -1,36 +0,0 @@
<?php
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2009 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// 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 for version 2.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Load global vars
global $config;
check_login();
if (! check_acl ($config['id_user'], 0, "DM")) {
db_pandora_audit("ACL Violation",
"Trying to access Database Management Info");
require ("general/noaccess.php");
return;
}
require_once ($config['homedir'] . '/include/functions_graph.php');
ui_print_page_header (__('Database maintenance').' &raquo; '.__('Database information'), "images/gm_db.png", false, "", true);
echo '<h4>'.__('Module data received').'</h4>';
echo grafico_db_agentes_purge(0, 600, 400);
?>

View File

@ -1,356 +0,0 @@
<?php
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2009 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// 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 for version 2.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Load global vars
global $config;
require_once ($config["homedir"] . '/include/functions_graph.php');
require_once($config['homedir'] . "/include/functions_agents.php");
require_once($config['homedir'] . "/include/functions_modules.php");
check_login ();
if (! check_acl ($config['id_user'], 0, "DM")) {
db_pandora_audit( "ACL Violation",
"Trying to access Database Purge Section");
include ("general/noaccess.php");
exit;
}
//id_agent = -1: None selected; id_agent = 0: All
$id_agent = (int) get_parameter_post ("agent", -1);
ui_print_page_header (__('Database maintenance') . ' &raquo; ' .
__('Database purge'), "images/gm_db.png", false, "", true);
echo grafico_db_agentes_purge($id_agent);
echo '<br /><br />';
echo '<h4>' . __('Get data from agent') . '</h4>';
// All data (now)
$time["all"] = get_system_time ();
// 1 day ago
$time["1day"] = $time["all"] - SECONDS_1DAY;
// 3 days ago
$time["3day"] = $time["all"] - SECONDS_1DAY * 3;
// 1 week ago
$time["1week"] = $time["all"] - SECONDS_1WEEK;
// 2 weeks ago
$time["2week"] = $time["all"] - SECONDS_1WEEK * 2;
// 1 month ago
$time["1month"] = $time["all"] - SECONDS_1MONTH;
// Three months ago
$time["3month"] = $time["all"] - SECONDS_3MONTHS;
//Init data
$data["1day"] = 0;
$data["3day"] = 0;
$data["1week"] = 0;
$data["2week"] = 0;
$data["1month"] = 0;
$data["3month"] = 0;
$data["total"] = 0;
// Purge data using dates
if (isset($_POST["purgedb"])) {
$from_date = get_parameter_post ("date_purge", 0);
if ($id_agent > 0) {
echo sprintf(
__("Purge task launched for agent %s :: Data older than %s"),
agents_get_name ($id_agent), human_time_description_raw ($from_date));
echo "<h3>" .
__('Please be patient. This operation can take a long time depending on the amount of modules.') .
"</h3>";
$sql = sprintf ("SELECT id_agente_modulo
FROM tagente_modulo
WHERE id_agente = %d", $id_agent);
$result = db_get_all_rows_sql ($sql);
if (empty ($result)) {
$result = array ();
}
$errors = 0;
$affected = 0;
foreach ($result as $row) {
echo sprintf(__('Deleting records for module %s'),
modules_get_agentmodule_name ($row["id_agente_modulo"]));
echo "<br />";
flush (); //Flush here in case there are errors and the script dies, at least we know where we ended
set_time_limit (); //Reset the time limit just in case
$result = db_process_sql_delete('tagente_datos',
array('id_agente_modulo' => $row["id_agente_modulo"],
'utimestamp' => '< ' . $from_date));
if ($result === false)
$errors++;
else
$affected += $result;
if ($errors == 0) {
$result = db_process_sql_delete('tagente_datos_inc',
array('id_agente_modulo' => $row["id_agente_modulo"],
'utimestamp' => '< ' . $from_date));
if ($result === false)
$errors++;
else
$affected += $result;
}
if ($errors == 0) {
$result = db_process_sql_delete('tagente_datos_string',
array('id_agente_modulo' => $row["id_agente_modulo"],
'utimestamp' => '< ' . $from_date));
if ($result === false)
$errors++;
else
$affected += $result;
}
if ($errors == 0) {
$result = db_process_sql_delete('tagente_datos_log4x',
array('id_agente_modulo' => $row["id_agente_modulo"],
'utimestamp' => '< ' . $from_date));
if ($result === false)
$errors++;
else
$affected += $result;
}
}
if ($errors > 0) {
echo sprintf(__('Total errors: %s'), $errors);
echo sprintf(__('Total records deleted: %s'), $affected);
}
else {
echo sprintf(__('Total records deleted: %s'), $affected);
}
}
else {
//All agents
echo __('Deleting records for all agents');
flush ();
db_process_sql_delete('tagente_datos',
array('utimestamp' => '< ' . $from_date));
db_process_sql_delete('tagente_datos_inc',
array('utimestamp' => '< ' . $from_date));
db_process_sql_delete('tagente_datos_string',
array('utimestamp' => '< ' . $from_date));
db_process_sql_delete('tagente_datos_log4x',
array('utimestamp' => '< ' . $from_date));
}
echo "<br /><br />";
}
# Select Agent for further operations.
$agents = agents_get_group_agents (0, true);
$agents[-1] = __('Choose agent');
$agents[0] = __('All agents');
echo '<form action="index.php?sec=gdbman&sec2=godmode/db/db_purge" method="post">';
echo '<div style="width:100%;">';
html_print_select ($agents, "agent", $id_agent, "this.form.submit();", "", "", false, false, false);
ui_print_help_tip (__("Select the agent you want information about"));
echo '<noscript>';
html_print_submit_button (__('Get data'), 'purgedb_ag', false, 'class="sub upd"');
ui_print_help_tip (__("Click here to get the data from the agent specified in the select box"));
echo '</noscript><br />';
if ($id_agent > 0) {
$title = __('Information on agent %s in the database', agents_get_name ($id_agent));
}
else {
$title = __('Information on all agents in the database');
}
echo '<h4>' . $title . '</h4>';
//Flush before we do some SQL stuff
flush ();
if ($id_agent > 0) { //If the agent is not All or Not selected
$modules = agents_get_modules ($id_agent);
$query = sprintf (" AND id_agente_modulo IN (%s)", implode (",", array_keys ($modules)));
}
else {
$query = "";
}
$data["1day"] = db_get_sql (sprintf ("
SELECT COUNT(*)
FROM tagente_datos
WHERE utimestamp > %d %s", $time["1day"], $query));
$data["3day"] = db_get_sql (sprintf ("
SELECT COUNT(*)
FROM tagente_datos
WHERE utimestamp > %d %s", $time["3day"], $query));
$data["1week"] = db_get_sql (sprintf ("
SELECT COUNT(*)
FROM tagente_datos
WHERE utimestamp > %d %s", $time["1week"], $query));
$data["2week"] = db_get_sql (sprintf ("
SELECT COUNT(*)
FROM tagente_datos
WHERE utimestamp > %d %s", $time["2week"], $query));
$data["1month"] = db_get_sql (sprintf ("
SELECT COUNT(*)
FROM tagente_datos
WHERE utimestamp > %d %s", $time["1month"], $query));
$data["3month"] = db_get_sql (sprintf ("
SELECT COUNT(*)
FROM tagente_datos
WHERE utimestamp > %d %s", $time["3month"], $query));
$data["total"] = db_get_sql (sprintf ("
SELECT COUNT(*)
FROM tagente_datos
WHERE 1=1 %s", $query));
$data["1day"] += db_get_sql (sprintf ("
SELECT COUNT(*)
FROM tagente_datos_inc
WHERE utimestamp > %d %s", $time["1day"], $query));
$data["3day"] += db_get_sql (sprintf ("
SELECT COUNT(*)
FROM tagente_datos_inc
WHERE utimestamp > %d %s", $time["3day"], $query));
$data["1week"] += db_get_sql (sprintf ("
SELECT COUNT(*)
FROM tagente_datos_inc
WHERE utimestamp > %d %s", $time["1week"], $query));
$data["2week"] += db_get_sql (sprintf ("
SELECT COUNT(*)
FROM tagente_datos_inc
WHERE utimestamp > %d %s", $time["2week"], $query));
$data["1month"] += db_get_sql (sprintf ("
SELECT COUNT(*)
FROM tagente_datos_inc
WHERE utimestamp > %d %s", $time["1month"], $query));
$data["3month"] += db_get_sql (sprintf ("
SELECT COUNT(*)
FROM tagente_datos_inc
WHERE utimestamp > %d %s", $time["3month"], $query));
$data["total"] += db_get_sql (sprintf ("
SELECT COUNT(*)
FROM tagente_datos_inc
WHERE 1=1 %s", $query));
$data["1day"] += db_get_sql (sprintf ("
SELECT COUNT(*)
FROM tagente_datos_string
WHERE utimestamp > %d %s", $time["1day"], $query));
$data["3day"] += db_get_sql (sprintf ("
SELECT COUNT(*)
FROM tagente_datos_string
WHERE utimestamp > %d %s", $time["3day"], $query));
$data["1week"] += db_get_sql (sprintf ("
SELECT COUNT(*)
FROM tagente_datos_string
WHERE utimestamp > %d %s", $time["1week"], $query));
$data["2week"] += db_get_sql (sprintf ("
SELECT COUNT(*)
FROM tagente_datos_string
WHERE utimestamp > %d %s", $time["2week"], $query));
$data["1month"] += db_get_sql (sprintf ("
SELECT COUNT(*)
FROM tagente_datos_string
WHERE utimestamp > %d %s", $time["1month"], $query));
$data["3month"] += db_get_sql (sprintf ("
SELECT COUNT(*)
FROM tagente_datos_string
WHERE utimestamp > %d %s", $time["3month"], $query));
$data["total"] += db_get_sql (sprintf ("
SELECT COUNT(*)
FROM tagente_datos_string
WHERE 1=1 %s", $query));
$data["1day"] += db_get_sql (sprintf ("
SELECT COUNT(*)
FROM tagente_datos_log4x
WHERE utimestamp > %d %s", $time["1day"], $query));
$data["3day"] += db_get_sql (sprintf ("
SELECT COUNT(*)
FROM tagente_datos_log4x
WHERE utimestamp > %d %s", $time["3day"], $query));
$data["1week"] += db_get_sql (sprintf ("
SELECT COUNT(*)
FROM tagente_datos_log4x
WHERE utimestamp > %d %s", $time["1week"], $query));
$data["2week"] += db_get_sql (sprintf ("
SELECT COUNT(*)
FROM tagente_datos_log4x
WHERE utimestamp > %d %s", $time["2week"], $query));
$data["1month"] += db_get_sql (sprintf ("
SELECT COUNT(*)
FROM tagente_datos_log4x
WHERE utimestamp > %d %s", $time["1month"], $query));
$data["3month"] += db_get_sql (sprintf ("
SELECT COUNT(*)
FROM tagente_datos_log4x
WHERE utimestamp > %d %s", $time["3month"], $query));
$data["total"] += db_get_sql (sprintf ("
SELECT COUNT(*)
FROM tagente_datos_log4x
WHERE 1=1 %s", $query));
$table->width = '98%';
$table->border = 0;
$table->class = "databox";
$table->data[0][0] = __('Packets less than three months old');
$table->data[0][1] = format_numeric($data["3month"]);
$table->data[1][0] = __('Packets less than one month old');
$table->data[1][1] = format_numeric($data["1month"]);
$table->data[2][0] = __('Packets less than two weeks old');
$table->data[2][1] = format_numeric($data["2week"]);
$table->data[3][0] = __('Packets less than one week old');
$table->data[3][1] = format_numeric($data["1week"]);
$table->data[4][0] = __('Packets less than three days old');
$table->data[4][1] = format_numeric($data["3day"]);
$table->data[5][0] = __('Packets less than one day old');
$table->data[5][1] = format_numeric($data["1day"]);
$table->data[6][0] = '<strong>'.__('Total number of packets').'</strong>';
$table->data[6][1] = '<strong>'.format_numeric($data["total"]).'</strong>';
html_print_table ($table);
echo '<br />';
echo '<h4>' . __('Purge data') . '</h4>';
$table->data = array ();
$times = array ();
$times[$time["3month"]] = __('Purge data over 3 months');
$times[$time["1month"]] = __('Purge data over 1 month');
$times[$time["2week"]] = __('Purge data over 2 weeks');
$times[$time["1week"]] = __('Purge data over 1 week');
$times[$time["3day"]] = __('Purge data over 3 days');
$times[$time["1day"]] = __('Purge data over 1 day');
$times[$time["all"]] = __('All data until now');
$table->data[0][0] = html_print_select ($times, 'date_purge', '', '',
'', '', true, false, false);
$table->data[0][1] = html_print_submit_button (__('Purge'), "purgedb",
false, 'class="sub wand"', true);
html_print_table ($table);
echo '</form>';
?>

View File

@ -1,122 +0,0 @@
<?php
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// 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 for version 2.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Load global vars
global $config;
check_login ();
if (! check_acl ($config['id_user'], 0, "DM")) {
db_pandora_audit("ACL Violation","Trying to access Database Debug Admin section");
require ("general/noaccess.php");
exit;
}
require_once($config['homedir'] . "/include/functions_agents.php");
require_once($config['homedir'] . "/include/functions_modules.php");
require_once($config['homedir'] . '/include/functions_users.php');
ui_print_page_header (__('Database maintenance').' &raquo; '.__('Database debug'), "images/gm_db.png", false, "", true);
if ((isset ($_GET["operacion"])) && (!isset ($_POST["update_agent"]))) {
// DATA COPY
if (isset ($_POST["eliminar"])) {
$max = get_parameter_post ("max", 0);
$min = get_parameter_post ("min", 0);
if ($max == $min) {
ui_print_error_message(__('Error').': '.__('Maximum is equal to minimum'));
return;
}
$origen_modulo = get_parameter_post ("origen_modulo", array ());
if (empty ($origen_modulo)) {
ui_print_success_message(__('Error').': '.__('No modules have been selected'));
return;
}
// Source (agent)
$id_origen = (int) get_parameter_post ("origen", 0);
// Copy
foreach ($origen_modulo as $id_agentemodulo) {
echo "<br /><br />".__('Filtering data module')."<b> [".modules_get_agentmodule_name ($id_agentemodulo)."]</b>";
if ($config["dbtype"] == 'oracle') {
$sql = sprintf ("DELETE FROM tagente_datos
WHERE id_agente_modulo = %d
AND (datos < TO_BINARY_DOUBLE('%s')
OR datos > TO_BINARY_DOUBLE('%s'))", $id_agentemodulo, $min, $max);
}
else {
$sql = sprintf ("DELETE FROM tagente_datos
WHERE id_agente_modulo = %d
AND (datos < '%s'
OR datos > '%s')", $id_agentemodulo, $min, $max);
}
db_process_sql ($sql);
}
} //if copy modules or alerts
echo '<br /><br />';
ui_print_success_message(__('Filtering completed'));
}
echo '<form method="post" action="index.php?sec=gdbman&sec2=godmode/db/db_refine&operacion=1">';
echo "<table width='100%' border='0' cellspacing='4' cellpadding='4' class='databox filters'>";
echo '<tr><td class="datost">';
echo '<div style="float:left; width: 250px;">';
echo '<b>'.__('Source agent').'</b><br /><br />';
$agent_selected = get_parameter_post ("origen", 0);
$agents = agents_get_group_agents (array_keys (users_get_groups ($config["id_user"], "DM")));
html_print_select ($agents, "origen", $agent_selected, 'javascript:this.form.update_agent.click();', __('No agent selected'), '0', false, false, false, '', false, 'max-width:300px !important;');
echo '&nbsp;&nbsp;';
html_print_submit_button (__('Get Info'), 'update_agent', false, 'style="display:none;"');
echo '<br /><br />';
echo '<b>'.__('Modules').'</b><br /><br />';
$module_selected = get_parameter_post ("origen", array ());
$modules = agents_get_modules ($module_selected, false, 'delete_pending != 1');
html_print_select ($modules, "origen_modulo[]", $module_selected, '', '', '0', false, true, false, '', false, 'max-width: 300px !important;');
echo '</div>'; //Left div
echo '<div style="float:left; width:\'98%\'; margin-left:20% ">
<b>'.__('Purge data out of these limits').'</b><br /><br />';
echo '<table><tr><td>';
echo __('Minimum').': ';
echo '</td><td>';
html_print_input_text ("min", 0, __('Minimum'), 4, 0, false);
echo '</td></tr>';
echo '<tr><td>';
echo __('Maximum').': ';
echo '</td><td>';
html_print_input_text ("max", 0, __('Maximum'), 4, 0, false);
echo '</td></tr>';
echo '</table>';
echo '</div>';
echo '<div style="clear:both;">&nbsp;</div>';
html_print_submit_button (__('Delete'), 'eliminar', false, 'class="sub delete" onClick="if (!confirm(\''.__('Are you sure?').'\')) return false;"');
echo '</td></tr></table>';
?>