Alerting
Questions about alerting and problem detection in Dynatrace.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Event Trigger on Problem Closure

MarwanC
Advisor

Does anyone know what parameters I need to define in the DAVIS EVENT TRIGGER in the workflow that is trigger the workflow when a DAVIS AI closes a problem.

I appreciate any support on this.

 

 

2 REPLIES 2

Mizső
DynaMight Guru
DynaMight Guru

Hi @MarwanC 

Maybe I do not understand your request well.

In case on Davis Problem trigger there are two options active and active or closed:

Mizs_4-1764323044789.png

In case of Davis event trigger you can use this DQL:

fetch events
| filter matchesValue(event.status, "CLOSED") 

Mizs_3-1764323007369.png

I hope it helps.

Best regards,

János

Dynatrace Community RockStar 2024, Certified Dynatrace Professional

Thanks indeed. In order to summarise this to other as well, there different places where you can focus the type of the trigger event when it comes to your workflow

1) In the trigger box, there is a pulldown menu which you choose, active or active or closed, this will give you the otion, it will be nice to have a feature to have the closed aswell.

2) You can also implement a gate box to allow what you need ACTIVE or CLOSE like this:

import { execution } from '@dynatrace-sdk/automation-utils';
import { settingsObjectsClient } from '@dynatrace-sdk/client-classic-environment-v2';
import { result } from '@dynatrace-sdk/automation-utils';

export default async function ({ execution_id }) {
const exe = await execution(execution_id);
const eventContext = exe.event(); // Access the event payload

const problemId = eventContext['event.id']; // Extract the problem ID
const displayId = eventContext['display_id']; // Extract the problem Display ID
const eventStatus = eventContext['event.status'];

console.log('Problem ID (Used in the API):', problemId);
console.log('Problem Display ID (Used in the Problems APP):', displayId);
console.log('Problem Event Status:', eventStatus);
console.log('Payload:', eventContext);

// Check if eventStatus is not CLOSED

if (eventStatus == 'ACTIVE') {
console.log("eventStatus=", eventStatus);
return 0;
}

return {
problemId,
displayId,
eventStatus
};

}

and in the next task you stop the workflow by a matcher in the condition section of the task: {{ result("gate") != 0 }}

So overall you can control the workflow by filter at the top or using gates.

 

One important thing as well to mention is very important to add a wait task at the begining of the workflow as the trigger can go go out of control when problems flooding can occur.

Hope this helps you in your workflow design.

Featured Posts