Simplified the query to test it and it worked, the rest of the code seems to be fine, saved the aggregate names , could the problem be in the query ?.
#!/usr/bin/perl
use strict;
use Getopt::Long;
use WFAUtil;
my $FileName;
my $FileNamePrefix = 'c:/temp/vol_report';
#Creating CSV file name
$FileName = $FileNamePrefix.".csv";
my $wfa_util = WFAUtil->new();
$wfa_util->sendLog('INFO', 'Creating CSV file: ' . $FileName);
my $query="SELECT name from cm_storage.aggregate";
my $database="cm_storage";
my @data;
my $length;
eval {
@data = $wfa_util->invokeMySqlQuery($query,$database);
};
$length = @data;
open(FILE, ">$FileName");
print FILE "aggr_name,aggr_used_percentage,name,vol_avilable_percentage,vol.available_size_mb,vserver.cluster.primary_address,vserver.name";
for (my $index =0; $index < $length; $index++)
{
if ($data[$index] ne "\n")
{
if ($data[$index] eq "")
{
print FILE "-,";
}
else {
print FILE "$data[$index]" . ",";
}
}
else
{
print FILE $data[$index];
}
}
close(FILE);