diff --git a/pandora_server/ChangeLog b/pandora_server/ChangeLog index 1eaee362d7..9dc6d6eb8e 100644 --- a/pandora_server/ChangeLog +++ b/pandora_server/ChangeLog @@ -1,3 +1,7 @@ +2013-01-11 Sancho Lerena + + * util/pandora_csvbridge.pl: Fixed code for CSV bridge too + 2013-01-11 Sergio Martin * lib/PandoraFMS/Config.pm diff --git a/pandora_server/util/pandora_csvbridge.pl b/pandora_server/util/pandora_csvbridge.pl index 65179e5b4c..4830c93896 100755 --- a/pandora_server/util/pandora_csvbridge.pl +++ b/pandora_server/util/pandora_csvbridge.pl @@ -42,7 +42,7 @@ sub print_usage () { print "\t-hV Help (this help)\n"; print "\nSample Usage:\n\n"; print "\tperl pandora_csv_bridge.pl -f datos4.csv -c @ -A 2 -Y 26 -M Consumo_Electrico -d /tmp/dump -G 3 -X 12\n\n"; - exit; + exit; } sub transform_date ($){ @@ -80,6 +80,10 @@ $opt_T = "generic_data"; my $utimestamp; my $utimestamp_extra; +if ( $ARGV[0] eq "" ) { + print_usage(); +} + GetOptions ("h" => \$opt_h, "R" => \$opt_R, @@ -142,13 +146,18 @@ for ($ax = 0; $ax < $opt_s; $ax++){ # Dump header if ( defined($opt_R)){ - my @header_data = split ("$opt_c", $header ); + + if (!defined($opt_c)){ + print_usage(); + } + + my %header_data = split ("$opt_c", $header ); my $key; print "\nDumping CSV Structure (Field Label -> Field Order)\n\n"; - foreach $key (keys @header_data){ - print $header_data[$key] ." -> ". $key ." \n"; + foreach $key (keys %header_data){ + print $header_data{$key} ." -> ". $key ." \n"; } exit;