diff --git a/pandora_server/ChangeLog b/pandora_server/ChangeLog index 0c1ac81725..3d460389f4 100644 --- a/pandora_server/ChangeLog +++ b/pandora_server/ChangeLog @@ -1,3 +1,9 @@ +2013-10-07 Sergio Martin + + * util/pandora_manage.pl: Fixed data_module feature adding the data + to be inserted into parameter list. The retro-compatibility has been + broken, but this feature was useless, so it shouldnt be a problem. + 2013-09-29 Junichi Satoh * FreeBSD/pandora_server.conf: Updated default settings as the same diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index d2aafbb71c..e2f95ae321 100755 --- a/pandora_server/util/pandora_manage.pl +++ b/pandora_server/util/pandora_manage.pl @@ -107,7 +107,7 @@ sub help_screen{ help_screen_line('--create_snmp_module', " \n\t [ \n\t \n\t \n\t \n\t ]", 'Add snmp network module to agent'); help_screen_line('--create_plugin_module', " \n\t [ \n\t \n\t ]", 'Add plug-in module to agent'); help_screen_line('--delete_module', 'Delete module from agent', ' '); - help_screen_line('--data_module', " \n\t []", 'Insert data to module'); + help_screen_line('--data_module', " \n\t []", 'Insert data to module'); help_screen_line('--get_module_data', " []", "\n\t Show the data of a module in the last X seconds (interval) in CSV format"); help_screen_line('--delete_data', '-m | -a | -g ', "Delete historic \n\t data of a module, the modules of an agent or the modules of the agents of a group"); help_screen_line('--update_module', ' ', 'Update a module field'); @@ -1653,7 +1653,7 @@ sub cli_delete_template_action() { ############################################################################## sub cli_data_module() { - my ($server_name,$agent_name,$module_name,$module_type,$datetime) = @ARGV[2..6]; + my ($server_name,$agent_name,$module_name,$module_type,$module_new_data,$datetime) = @ARGV[2..7]; my $utimestamp; if(defined($datetime)) { @@ -1676,18 +1676,22 @@ sub cli_data_module() { my $id_agent = get_agent_id($dbh,$agent_name); exist_check($id_agent,'agent',$agent_name); + my $id_module = get_agent_module_id($dbh, $module_name, $id_agent); + exist_check($id_module, 'module name', $module_name); + # Server_type 0 is dataserver my $server_id = get_server_id($dbh,$server_name,0); exist_check($server_id,'data server',$server_name); - my $module = get_db_single_row ($dbh, 'SELECT * FROM tagente_modulo WHERE id_agente = ? AND id_tipo_modulo = ?', $id_agent, $module_type_id); - + my $module = get_db_single_row ($dbh, 'SELECT * FROM tagente_modulo WHERE id_agente_modulo = ? AND id_tipo_modulo = ?', $id_module, $id_agent, $module_type_id); + if(not defined($module->{'module_interval'})) { - print_log "[ERROR] No module data finded. \n\n"; + print_log "[ERROR] No module found with this type. \n\n"; exit; } - - my %data = ('data' => 1); + + my %data = ('data' => $module_new_data); + pandora_process_module ($conf, \%data, '', $module, $module_type, '', $utimestamp, $server_id, $dbh); print_log "[INFO] Inserting data to module '$module_name'\n\n"; @@ -3450,7 +3454,7 @@ sub pandora_manage_main ($$$) { cli_delete_template_action(); } elsif ($param eq '--data_module') { - param_check($ltotal, 5, 1); + param_check($ltotal, 6, 1); cli_data_module(); } elsif ($param eq '--create_user') {