Active IQ Unified Manager Discussions

how to email filter details

Aswani_Kumar
3,177 Views

 

I am bulding a workflow to monitor volumes and exapnd vol sizes.

 

I had written a filter that gets all volumes sizes above "threshold" and i want to mail all these details for approval.

 

And here my questions are

1)how to get all details returned by filter

2)How to email these details 

1 REPLY 1

abhit
3,165 Views

Step1:

======

Dump the filtered data in an XCEL.

How you can do it?

Please see the sample code below.

This is the "Create CSV Report-FLI" available in http://automationstore.netapp.com, under the "OFFLine Foreign Lun Import pack".

 

 

use strict;
use Getopt::Long;
use WFAUtil;

my $FileName;
my $FileNamePrefix = 'lun_report';

my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime();
$mon++;
$year += 1900;
my $CurrentTime = $mday . "_" . $mon . "_" . $year . "__" . $hour . "_" . $min . "_" . $sec;

#Creating CSV file name
$FileName = $FileNamePrefix . "_" . $CurrentTime . ".csv";

my $wfa_util = WFAUtil->new();
$wfa_util->sendLog('INFO', 'Creating CSV file: ' . $FileName);

my $query="SELECT * FROM lun_import"; -->Here you need to put your volume query.
my $database="playground";
my @data;
my $length;

eval {
@data = $wfa_util->invokeMySqlQuery($query,$database);

};

$length = @data;

open(FILE, ">$FileName"); # Open for output
print FILE "id,vserver_name,foreign_disk,path,import_home_node,administrative_status,compared_blocks,estimated_remaining_duration,".
"import_current_node,imported_blocks,operation_in_progress,operational_status,percent_complete,total_blocks,failure_reason,cluster,is_deleted\n";

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); # Closing file

 

========

 

Second Step:

Send the File.

Please use the "Send Email" code, which is part of WFA release.

 

You need to customize "Send Email" for attaching the CSV file created in the above segment.

Sample code here.

http://www.techrepublic.com/blog/windows-and-office/send-an-email-with-an-attachment-using-powershell/

 

===============

Put approval point after that.

============

Followed by the next command.

 

Public