2008-12-02 Esteban Sanchez <estebans@artica.es>

* godmode/agentes/manage_config.php: Fixed SQL sentence generation
        when copying a module. It was causing PHP notices and nothing was
        being copied.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1272 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
Esteban Sanchez 2008-12-02 08:11:42 +00:00
parent 65ab67b296
commit 068b17029e
2 changed files with 88 additions and 51 deletions

View File

@ -1,3 +1,9 @@
2008-12-02 Esteban Sanchez <estebans@artica.es>
* godmode/agentes/manage_config.php: Fixed SQL sentence generation
when copying a module. It was causing PHP notices and nothing was
being copied.
2008-12-01 Jorge Gonzalez <jorgegonz@artica.es>
* include/languages/index.pot: Updated po template.

View File

@ -90,14 +90,44 @@ if (isset($_POST["copy"])) {
if ($modulos == 1) {
echo '<br /><br />'.__('Copying module').'<b> ['.dame_nombre_agente ($origen).' - '.$module["nombre"].'] -> ['.dame_nombre_agente ($id_agent_dest).']</b>';
$sql = sprintf ("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, id_modulo, disabled, id_export,
plugin_user, plugin_pass, plugin_parameter, id_plugin, post_process, prediction_module, max_timeout)
VALUES (%d,".$module["id_tipo_modulo"].",'".$module["descripcion"]."','".$module["nombre"]."',".$module["max"].",".$module["min"].",".$module["module_interval"].",".$module["tcp_port"].",'".$module["tcp_send"]."','".$module["tcp_rcv"]."',
'".$module["snmp_community"]."','".$module["snmp_oid"]."','%s',".$module["id_module_group"].",".$module["flag"].",".$module["id_modulo"].",".$module["disabled"].",".$module["id_export"].",
'".$module["plugin_user"]."','".$module["plugin_pass"]."','".$module["plugin_parameter"]."',".$module["id_plugin"].",'".$module["post_process"]."',".$module["prediction_module"].",".$module["max_timeout"].")",
$id_agent_dest,get_agent_address ($id_agent_dest));
$sql = sprintf ('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, id_modulo,
disabled, id_export,
plugin_user, plugin_pass,
plugin_parameter, id_plugin,
post_process, prediction_module,
max_timeout)
VALUES (%d, %d, "%s", "%s", %f, %f, %d,
%d, "%s", "%s", "%s", "%s", "%s", %d,
%d, %d, %d, %d, "%s", "%s", "%s", %d,
%f, %d, %d)',
$id_agent_dest, $module["id_tipo_modulo"],
$module["descripcion"],
$module["nombre"], $module["max"],
$module["min"],
$module["module_interval"],
$module["tcp_port"],
$module["tcp_send"],
$module["tcp_rcv"],
$module["snmp_community"],
$module["snmp_oid"],
get_agent_address ($id_agent_dest),
$module["id_module_group"],
$module["flag"],
$module["id_modulo"],
$module["disabled"],
$module["id_export"],
$module["plugin_user"],
$module["plugin_pass"],
$module["plugin_parameter"],
$module["id_plugin"],
$module["post_process"],
$module["prediction_module"],
$module["max_timeout"]);
$id_new_module = process_sql ($sql, "insert_id");
if (empty ($id_new_module)) {
@ -112,6 +142,7 @@ if (isset($_POST["copy"])) {
case 18:
$sql = sprintf ("INSERT INTO tagente_estado (id_agente_modulo, datos, timestamp, cambio, estado, id_agente, utimestamp)
VALUES (%d, 0,'0000-00-00 00:00:00',0,0, %d, 0)", $id_new_module, $id_agent_dest);
break;
default:
$sql = sprintf ("INSERT INTO tagente_estado (id_agente_modulo, datos, timestamp, cambio, estado, id_agente, utimestamp)
VALUES (%d, 0,'0000-00-00 00:00:00',0,100, %d, 0)", $id_new_module, $id_agent_dest);
@ -170,10 +201,10 @@ if (isset($_POST["copy"])) {
$result = get_db_all_row_sql ($sql);
if ($result === false)
continue; // This alert is supposed to be part of a
// compound alert but there is no entry for
// it in the tcompound_alert table so we skip this
/* This alert is supposed to be part of a
compound alert but there is no entry for
it in the tcompound_alert table so we skip this */
continue;
foreach ($result as $comp_alert) {
$sql = sprintf ("INSERT INTO tcompound_alert (id_aam, operation) VALUES (%d, '%s')",$new_alert,$comp_alert["operation"]);
$result = process_sql ($sql);