Revision: 7643
http://pandora.svn.sourceforge.net/pandora/?rev=7643&view=rev
Author: zarzuelo
Date: 2013-02-13 12:33:33 +0000 (Wed, 13 Feb 2013)
Log Message:
-----------
2013-02-13 Sergio Martin <sergio.martin@...>
* lib/PandoraFMS/Core.pm
lib/PandoraFMS/DataServer.pm: Fixed the creation of a module
on Dataserver. When we fix the updates of the XML the creation was
broken to min/max warning/critical and disabled field
Modified Paths:
--------------
branches/pandora_4.0/pandora_server/ChangeLog
branches/pandora_4.0/pandora_server/lib/PandoraFMS/Core.pm
branches/pandora_4.0/pandora_server/lib/PandoraFMS/DataServer.pm
Modified: branches/pandora_4.0/pandora_server/ChangeLog
===================================================================
--- branches/pandora_4.0/pandora_server/ChangeLog 2013-02-13 12:26:19 UTC (rev 7642)
+++ branches/pandora_4.0/pandora_server/ChangeLog 2013-02-13 12:33:33 UTC (rev 7643)
@@ -1,3 +1,10 @@
+2013-02-13 Sergio Martin <sergio.martin@...>
+
+ * lib/PandoraFMS/Core.pm
+ lib/PandoraFMS/DataServer.pm: Fixed the creation of a module
+ on Dataserver. When we fix the updates of the XML the creation was
+ broken to min/max warning/critical and disabled field
+
2013-01-21 Koichiro KIKUCHI <koichiro@...>
* pandora_server.redhat.spec: Updated version strings
Modified: branches/pandora_4.0/pandora_server/lib/PandoraFMS/Core.pm
===================================================================
--- branches/pandora_4.0/pandora_server/lib/PandoraFMS/Core.pm 2013-02-13 12:26:19 UTC (rev 7642)
+++ branches/pandora_4.0/pandora_server/lib/PandoraFMS/Core.pm 2013-02-13 12:33:33 UTC (rev 7643)
@@ -1315,9 +1315,11 @@
=cut
##########################################################################
-sub pandora_create_module ($$$$$$$$$$;$) {
+sub pandora_create_module ($$$$$$$$$$;$$$$$$) {
my ($pa_config, $agent_id, $module_type_id, $module_name, $max,
- $min, $post_process, $description, $interval, $dbh, $module_group_id) = @_;
+ $min, $post_process, $description, $interval, $dbh,
+ $module_group_id, $min_warning, $max_warning, $min_critical,
+ $max_critical, $disabled) = @_;
logger($pa_config, "Creating module '$module_name' for agent ID $agent_id.", 10);
@@ -1325,9 +1327,18 @@
$max = 0 if ($max eq '');
$min = 0 if ($min eq '');
$post_process = 0 if ($post_process eq '');
- $module_group_id = 0 unless defined $module_group_id;
- my $module_id = db_insert($dbh, 'id_agente_modulo', 'INSERT INTO tagente_modulo (id_agente, id_tipo_modulo, nombre, max, min, post_process, descripcion, module_interval, id_modulo, id_module_group)
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, 1, ?)', $agent_id, $module_type_id, safe_input($module_name), $max, $min, $post_process, $description, $interval, $module_group_id);
+ $module_group_id = 0 unless defined $module_group_id;
+ $min_warning = 0 unless defined $min_warning;
+ $max_warning = 0 unless defined $max_warning;
+ $min_critical = 0 unless defined $min_critical;
+ $max_critical = 0 unless defined $max_critical;
+ $disabled = 0 unless defined $disabled;
+
+ my $module_id = db_insert($dbh, 'id_agente_modulo', 'INSERT INTO tagente_modulo (id_agente, id_tipo_modulo, nombre, max, min, post_process, descripcion, module_interval, id_modulo, id_module_group,
+ min_warning, max_warning, min_critical, max_critical, disabled)
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, 1, ?, ?, ?, ?, ?, ?)', $agent_id, $module_type_id, safe_input($module_name), $max, $min, $post_process, $description, $interval, $module_group_id,
+ $min_warning, $max_warning, $min_critical, $max_critical, $disabled);
+
db_do ($dbh, 'INSERT INTO tagente_estado (id_agente_modulo, id_agente, last_try) VALUES (?, ?, \'1970-01-01 00:00:00\')', $module_id, $agent_id);
return $module_id;
}
Modified: branches/pandora_4.0/pandora_server/lib/PandoraFMS/DataServer.pm
===================================================================
--- branches/pandora_4.0/pandora_server/lib/PandoraFMS/DataServer.pm 2013-02-13 12:26:19 UTC (rev 7642)
+++ branches/pandora_4.0/pandora_server/lib/PandoraFMS/DataServer.pm 2013-02-13 12:33:33 UTC (rev 7643)
@@ -467,7 +467,7 @@
my $tags = {'name' => 0, 'data' => 0, 'type' => 0, 'description' => 0, 'max' => 0,
'min' => 0, 'descripcion' => 0, 'post_process' => 0, 'module_interval' => 0, 'min_critical' => 0,
'max_critical' => 0, 'min_warning' => 0, 'max_warning' => 0, 'disabled' => 0, 'min_ff_event' => 0,
- 'datalist' => 0, 'status' => 0, 'unit' => 0, 'timestamp' => 0, 'id_module_group' => 0};
+ 'datalist' => 0, 'unit' => 0, 'timestamp' => 0, 'id_module_group' => 0};
# Other tags will be saved here
$module_conf->{'extended_info'} = '';
@@ -535,7 +535,10 @@
# Create the module
pandora_create_module ($pa_config, $agent->{'id_agente'}, $module_id, $module_name,
$module_conf->{'max'}, $module_conf->{'min'}, $module_conf->{'post_process'},
- $module_conf->{'descripcion'}, $module_conf->{'module_interval'}, $dbh,$module_conf->{'id_module_group'});
+ $module_conf->{'descripcion'}, $module_conf->{'module_interval'}, $dbh,
+ $module_conf->{'id_module_group'}, $module_conf->{'min_warning'}, $module_conf->{'max_warning'},
+ $module_conf->{'min_critical'}, $module_conf->{'max_critical'}, $module_conf->{'disabled'});
+
$module = get_db_single_row ($dbh, 'SELECT * FROM tagente_modulo WHERE id_agente = ? AND ' . db_text('nombre') . ' = ?', $agent->{'id_agente'}, safe_input($module_name));
if (! defined ($module)) {
logger($pa_config, "Could not create module '$module_name' for agent '$agent_name'.", 3);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|