Subscribe

how to email details got by filter

Hi,

 

I was working on creating custom workflow.

 

I want create a workflow to monitor all volumes in a cluster and if volume size increases by certain threshold ,

I have to gather all information of such volumes and have to send these details for approval to expand its size.

 

So i created a finder to get  all volumes of certain threshold from db and after that i am facing these below problems

 

1)How to get all volumes retrived by the finder and display somwhat  like excel format.(how to do this by custom)

 

2)If i want to mail these volumes details for approval  ? (How the approval process exactly works)

 

3)And after getiing approval i have to expand these volumes by x% 

 

the below figure depicts my idea

captur2.jpg

 

 

Re: how to email details got by filter

@ 1)How to get all volumes retrived by the finder and display somwhat  like excel format.(how to do this by custom)

 

2)If i want to mail these volumes details for approval  ? (How the approval process exactly works)

-----

If you want the result list of a filter to mailed, you would need to execute the query not as a filter but invoke it using Powershell/Perl methods Invoke-MySqlQuery/invokeMysqlQuery. Now have your data exported in a  CSV or TSV format in a file. You can now mail this file as an attachment from your command. If you use powershell it will be easy. Powershell is the best scripting language on earth.

 

You want me to do it for you Smiley Happy ?

 

 @(How the approval process exactly works)

----

A short summary: A workflow execution pauses before starting the next commad if an approval point is defined in a workflow. Email notification for this workflow execution Pause can be sent to the approver. The approver logs into WFA and resumes the workflow or aborts it based on the result till now.

 

Approval can't be done via email reply. 

 

@3)And after getiing approval i have to expand these volumes by x%

 

------

 

Yes do it in the next command.

 

 

sinhaa

 

If this post resolved your issue, help others by selecting ACCEPT AS SOLUTION or adding a KUDO.

Re: how to email details got by filter

A more simple way to send an email with SQL query info could be the use of a multi-query select .

 

In the additional test of the send email command, add the $sql_query variable

 

Then go to Setup->User Inputs-> double click $sql_query --> choose in type query ( multi-select )

 

Edit the query itself and use for example :

 

SELECT
    name,
    available_size_mb
FROM
    cm_storage.aggregate
ORDER BY
available_size_mb
DESC

 

SELECT only a few and do not use * because it seems to be too much for the email.

 

Re: how to email details got by filter

Thanks Sinhaa

Re: how to email details got by filter

Thanks trentino123

Re: how to email details got by filter

1

 

This is the code i have written to retrive the values from query and to put that values in .csv file.

But i cannot find whether the query is retriving or not.

 

where can i find the "wfautil" module sourcecode.

 

use strict;
use Getopt::Long;
use WFAUtil;
my $FileName;
my $FileNamePrefix = 'c:\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(my $FILE, ">" , $FileName);
foreach my $line (@data) {
    if ($line ne "\n")
    {
        if ($line eq "")
        {
        print $FILE "-,";
        }
        else {
        print $FILE $line . ",";
        }
    }
    else
    {
    print $FILE $line;
    }
}

close($FILE);

Re: how to email details got by filter

Hi Aswani, 

 

I am attaching the command that worked for me, which was a create qtree in perl clone.

 

Let me know if it showed the name of the aggregates for you.

 

Thanks!