Active IQ Unified Manager Discussions
Active IQ Unified Manager Discussions
Workflow Execution status reports can be very useful for WFA users, Admins and Architects even operators. I wanted to receive recurring email reports on how many workflows were executed in the last 7 days, and out of those how many passed or how many in Pending state. It helps to track jobs and workfflow executions. Like I wanted to know how many have been failing and how many times, which are stuck in Waiting for approval and need attention. Which workflows are being executed maximum no of times. How many workflow completed sucessfully etc.
A weekly/daily execution status report email to a list of users is a very useful feaure. But its not available as yet with WFA.
Making such a solution had some big challenges. BIG!!
However, considering that there is always a possibility of innovation and genius , let's build one.
The following logic is used for building the solution.
All jobs of our concerned workflow + (possibly) jobs of workflows with common patterns in their names.
We need to remove the latter.
Now I've designed a solution that generates the report and sends them by email. But you can use the above logic to generate your own reports the way you want them like in CSV or XL or PDF or just plain text.
Now, Lets look at the 3 commands.
Details on this command are available here: http://community.netapp.com/t5/OnCommand-Storage-Management-Software-Discussions/How-to-schedule-a-workflow-for-recurring-executions-The-solution/m-p/...
A sample workflow using the above 3 commands which sends Weekly Execution Status Report is attached. Just import it and execute it after getting the prerequisites done. You'll just love it.
Prerequisties:
Match: Exact
Type: Other
Name/IP: localhost
Username: <WFA Admin/Architect Username>
Password: <User Password>
A sample Email of a Job execution report email will look as following. And it will be sent recurringly as per your schedule.
I took the code that you wrote for this and started playing with it from Powershell directly on a machine with WFA3.0P1 installed. When I run the following:
$creds = get-credential
$URL = "http://localhost:8080/rest/search?term=Test Exit&context=EXECUTION_STATUS"
$results = Invoke-RestMethod -Method get -Uri $URL -Credential $creds -contenttype "application/xml"
I get a collection of results in the $results variable but all the job IDs are the same. I see the correct number of entries, for example if the workflow was run 3 times I see 3 items in the collection, but all 3 are idential.
Bug? Something I did wrong? Thinking no on that because if I just use a browser and do essentially the same thing with the correct URL I get the same result.
Hi 2006FatBoy,
I see that this is your first post on NetApp communities. So welcome to this forum.
@ Bug? Something I did wrong? Thinking no on that because if I just use a browser and do essentially the same thing with the correct URL I get the same result.
----
No bug but a user mistake. Your workflow name has <space> in it. So
$URL = "http://localhost:8080/rest/search?term=Test Exit&context=EXECUTION_STATUS"
wont give the right results. Serach will not fail, but it won't give what you are looking for. Search engines are designed not to fail.
I've taken care of it in my code, seems like you missed it.
You need to use URL as below
http://localhost:8080/rest/search?term='Test Exit'&context=EXECUTION_STATUS
i.e. have single quotes in the parameter for term i.e. workflow name so that in cases where workflow names have <space>, it will still work.
Try it on your browser. single quotes and <space> gets translated to %27 and %20 respectively by browser. But you get what you were looking for.
sinhaa
Ok. I had manually translated the [space] to %20 when I tried it in the browser but I did not add the quotes. So that was my mistake. Thanks for the assist.
Hi Sinha
I ahve imported the workflow and still hitting the issue
11:44:24.293 INFO [Workflow Execution Status Reporter] Credentials successfully provided for 'localhost' 11:44:43.059 ERROR [Workflow Execution Status Reporter] The remote server returned an error: (500) Internal Server Error. 11:44:43.121 ERROR [Workflow Execution Status Reporter] Failed executing command. Exception: The remote server returned an error: (500) Internal Server Error.
What version of WFA you are using?
I'll not try to debug this now, this solutiuon is outdated as new some APIs have come in WFA. I think this solution was developed for WFA3.X
I'll post a updated solution here. You need to wait for a few days.
sinhaa
it looks like its not advancing after below command
$url1= 'http://localhost:' + $httpPort + '/rest/workflows'
$workflowList = Invoke-RestMethod -Method get -Uri $url1 -Credential $cd -TimeoutSec 300
i am using 4.1
thanks in advance for checking
Even i use http://wfaservername/rest/docs/#!/Execution%3AWorkflows/getWorkflows link to manually check the api call the response code is still 500 and resonse body stayed empty.