27 Mar 2025 05:33 PM
Hi
I am following this blog and implemented the same workflow which identifies the entity having resource outage, it generate problem by creating event by js code.This event generations is creating problem for the prediction with entity details but that problem is getting closed after minutes automatically. Can somebody please help me to understand why?
Also is there way to add more details to problem like problem description of custom fields and also can we set how long problem should remain problem.
https://www.dynatrace.com/news/blog/automate-predictive-capacity-management-with-davis-ai-for-workfl...
Solved! Go to Solution.
27 Mar 2025 05:53 PM
Please guide me on this.
27 Mar 2025 11:05 PM
I believe you will need to amend your code to supply the timeout parameter. The default value is 15 minutes unless you specify another value. This will set the timeout value to control how long the event will stay active without being refreshed (up to 6 hours). Please note that you can also keep the problem open by sending the same payload again (such as from a subsequent execution of the workflow).
28 Mar 2025 12:30 PM
Thanks Marco for providing solution.
I tried adding in properties but getting error response.
violations.forEach(function (violation) {
eventsClient.createEvent({
body : {
eventType: EventIngestEventType.ResourceContentionEvent,
title: 'Prediction Alarm ',
entitySelector: 'type(host),entityId("' + violation['dt.entity.host'] + '")',
properties: {
'dt.davis.timeout' : 40,
'dt.entity.host' : violation['dt.entity.host'],
'dt.entity.disk' : violation['dt.entity.disk']
}
}
});
});
Getting Below error ,
An error of type UNCAUGHT_EXCEPTION occurred in an imported library: 400: Constraints violated.
at EventsClient.createEvent (file:///opt/sdk_modules/@dynatrace-sdk/client-classic-environment-v2/esm/index.js:8056:17)
at eventLoopTick (ext:core/01_core.js:175:7)
31 Mar 2025 03:14 PM
Hey ,
Can somebody please help me to fix this issue.
01 Apr 2025 09:31 AM
Any help will be appreciated.
01 Apr 2025 11:19 AM
Check if this give you additional information.
violations.forEach(function (violation) {
eventsClient.createEvent({
body: {
eventType: EventIngestEventType.ResourceContentionEvent,
title: 'Prediction Alarm',
entitySelector: 'type(host),entityId("' + violation['dt.entity.host'] + '")',
properties: {
'dt.davis.timeout': 40,
'dt.entity.host': violation['dt.entity.host'],
'dt.entity.disk': violation['dt.entity.disk']
}
}
}).catch(error => {
console.error('Error creating event:', error);
});
});
01 Apr 2025 11:41 PM
Hi,
Your amended code passes the paramter dt.davis.timeout within the properties object. This is incorrect per the documentation. The parameter should be passed as 'timeout' (excluding quotation marks) in the main section.
I have amended your code below:
violations.forEach(function (violation) {
eventsClient.createEvent({
body : {
eventType: EventIngestEventType.ResourceContentionEvent,
title: 'Prediction Alarm ',
entitySelector: 'type(host),entityId("' + violation['dt.entity.host'] + '")',
timeout : 40,
properties: {
'dt.entity.host' : violation['dt.entity.host'],
'dt.entity.disk' : violation['dt.entity.disk']
}
}
});
});
02 Apr 2025 08:19 AM
Thanks Marco . That works 😀