11 Mar 2024 12:29 PM
Hello Team,
Can someone help me to build workflow for below use case :
We want Dynatrace to send SMS notification for problems generated between 18:00 To 06:00(nextDay) monday to friday if the impacted entity falls under sev1 or sev2 category.
I am using Problem based trigger and need help to build query to filter problem where time stamp is after 18:00 or before 06:00 and day is between Monday to Friday.
Solved! Go to Solution.
11 Mar 2024 02:46 PM
hi
Try your DQL with
| fieldsAdd day_of_week = getDayOfWeek(timestamp), hour_of_day = getHour(timestamp)
| filter (hour_of_day > 18 OR hour_of_day < 6) AND day_of_week >= 1 AND day_of_week <= 5
11 Mar 2024 05:18 PM
Hello @PacoPorro,
I have DQL query to fetch events with this filter but can I trigger workflow using this ? if yes, How ?
Do you know how can we use match phrase function in workflow ?
Thanks
12 Mar 2024 11:42 AM
Use a cron trigger in the workflow as step 1, run the dql as step 2, run the SMS http request as step 3
12 Mar 2024 03:29 AM - edited 18 Mar 2024 02:27 AM
Hi @Omkar_B
You can achieve this in 3 steps:
Note: You have to reconfigure your JSON output in 2nd step itself so that SMS messages will not be split in the 3rd step.
12 Mar 2024 11:52 AM
@theharithsa
Why do we need to pull data via API if it is available in workflow or DQL. Can't we use those available options to achieve this ?
18 Mar 2024 02:31 AM
You can use both, but you can't use Davis problem trigger as a task. For that, you'll need to run some JavaScript. There's a library that can fetch problems in the same tenant.
12 Mar 2024 11:50 AM
Just tested the filter option, and seems to be working:
(getHour(timestamp) > 18 OR getHour(timestamp) < 6) AND getDayOfWeek(timestamp) >= 1 AND getDayOfWeek(timestamp) <= 5
18 Mar 2024 02:32 AM
It is good to get the problems. Thanks @PacoPorro
Is this what you were looking for @Omkar_B?
11 Apr 2024 09:13 AM
Just wanted to share approach I used to achieve this -
1. Used Davis Problem Trigger for problems in Open or Closed state and having certain conditions like tag="abc".
2. Task (JavaScript) to get output of trigger check conditions for time like hour after 6 PM and weekday or weekend and call SMS API if conditions are matching.
There are some SDKs available to get data of trigger or previous which we can use during workflow creation, but tedious task is to understand the syntax of JavaScript.
17 Jun 2024 12:35 AM
Hi Omkar, I'm having a hard time understanding how to use JavaScript to get the information, could you help me by indicating which SDK you used since I'm looking to make a similar workflow and with the trigger data it would help me define my flow
09 Oct 2024 03:20 AM
Hello @JhonU,
If you're still looking for it, here are the SDKs you can use.
@dynatrace-sdk/automation-utils :- to get details from previous tasks or trigger within execution.