09 Nov 2023
04:44 AM
- last edited on
23 Nov 2023
03:05 PM
by
Michal_Gebacki
Hi Dynatracers!
We have a solution that executes actions based on specific conditions detected in Dynatrace using Dynatrace events. To facilitate this I've setup a Dynatrace problem integration that loops back into Dynatrace via a webhook problem notification.
Overall the structure works fine and is in general doing what I need, however I'm having some issues getting the JSON fields to travel through the the problem notification in a way that's acceptable to the Dynatrace V2 events ingest API (/api/v2/events/ingest).
To be specific, in order for this to work I need to send the problem information through as an event 'property' - this works fine for the standard 'string' style fields available in the problem notification, but won't work for any of the complex elements such as ProblemDetailsJSONv2. Even attempting to send a test notification results in an error (400 - Bad Request) - {"error":{"code":400,"message":"Could not map JSON at 'properties.probDeets' near line 19 column 18"}}
Worst case sending ProblemDetailsText works correctly, but using a JSON version would be much nicer when working with it on the other side.
Any suggestions? I'm thinking this is almost certainly a constraint from the v2 event/ingest api (can't take a JSON struct as a property) - looking for any workarounds/thoughts?
Problem Notification Payload Definition:
{
"eventType": "CUSTOM_INFO",
"title": "Run Action Request",
"properties": {
"reqId": "00",
"target": "{ImpactedEntity}",
"retryOnFail": false,
"dt.event.source": "ACTION_REQUEST",
"ImpactedEntityNames": "{ImpactedEntityNames}",
"ImpactedEntity": "{ImpactedEntity}",
"ProblemID": "{ProblemID}",
"ProblemDetails": "{ProblemDetailsText}",
"source": "DynatraceNative",
"probDeetsTXT": "{ProblemDetailsText}",
"probDeets": {ProblemDetailsJSONv2}
},
"timeout": 1
}
All help greatly appreciated!
Solved! Go to Solution.
Hello,
I noticed that you are missing the double quote as below
"probDeetsTXT": "{ProblemDetailsText}",
"probDeets": "{ProblemDetailsJSONv2}"
I don't know if that should cause the problem or not, but this is the only field without ""
Thanks,
Islam
Hi Islam,
Thanks for the suggestion, but unfortunately no luck (although it does give me a different error now 😎 ) - from memory the ProblemDetailsJSONv2 field is one of those that's meant to not be quoted as it expands to a JSON struct - could be wrong there though.
Thanks anyway!
I'm afraid that you will have to stay with ProblemDetailsText - otherwise it will probably be necessary to create some script, plugin, which will handle as an intermediary this communication.
Thanks Radek - I suspect you're right - was hoping there was some other magic available I didn't see, but suspect not. Thanks anyway!