cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Workflow Condition to Run if AM Run a series of HTTP Requests If PM Run Another series of HTTP Requests

CTull
Guide

I have a dilemma where I am to create a maintenance window to prevent alerts from 6pm to 6am.  This is log ingestion via API, that does not contain many details to allow for a criteria for filtering to allow for a maintenance window.  SOOO, doing a work around using workflows to make an api call to Dynatrace to enable\disable the event extraction entities between 6pm and 6am.

So I have the api for enable\disable for the extraction event.  However, there is only one trigger and I have that set to run at 6am and 6pm.  BUT the condition I do not know the syntax for and I am not seeing any syntax for it in the documentation.

Condition would be to run is if time is AM run the Enable, if time is PM run disable api.

I am open to other conditions or ideas but it must be in 1 workflow as I only have 3 workflows to utilize.  I can use another workflow but I do not want to do that.  NOT a DPS customer yet.  In this layout both run at 6am and 6pm which enables and disables them and is doing nothing.  Also maintaining within one workflow for this one process keeps things organized.

 

CTull_1-1725553441147.png

 

 

1 REPLY 1

ChristopherHejl
Dynatrace Advisor
Dynatrace Advisor

Hi,

you can use expression in the condition https://docs.dynatrace.com/docs/platform-modules/automations/workflows/building#task-conditions
In this case, the now expression should be most useful https://docs.dynatrace.com/docs/platform-modules/automations/workflows/reference#now

With this, you can get the current timestamp in any format for any timezone and compare.
I suggest either to extract the current hour and compare with > < 12, or there is even a format to get AM / PM out.

Sample condition:

 

{{ now('US/Eastern').strftime("%p") == "PM" }}

 

 

ChristopherHejl_0-1725558456164.png

I'll also attach this sample workflow as an export so can either import it into your tenant and have a look or just look into the definition.

Featured Posts