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

Logical Operations in Webhook Payload

serhat_balik
Organizer

We can do some logical operations in AppDynamics to match the fields of BMC Truesight in the custom webhook integrations. Is there a way to accomplish this in Dynatrace? Because the moment I start writing some code, I immediately get a syntax error.

I also wonder how can we dive into JSON object of {impactedEntities} to extract only the entity name instead of long explanation in {impactedEntity}, such as "CPU increase at abcHost" ?

Below is the code we're using in AppDynamics integration right now...


[
{
"eventSourceHostName": "APMTEST",
"eventSourceIPAddress": "xx.xx.xx.xx",
#if(${latestEvent.node.name})
"eventSourceHostName": "${latestEvent.node.name}",
"eventSourceIPAddress": "",
#end
"attributes": {
"CLASS": "APM_EV",
"controllerUrl": "${controllerUrl}",
"accountId": "${account.id}",
"accountName": "${account.name}",
"mc_object": "${latestEvent.tier.name}",
"mc_object_uri": "${latestEvent.deepLink}",
#if(${latestEvent.healthRule.name})
"mc_parameter": "${latestEvent.healthRule.name}",
"mc_tool": "${latestEvent.healthRule.name}_${latestEvent.severity}",
"mc_smc_alias": "${latestEvent.healthRule.name}",
#end
"mc_service": "${latestEvent.application.name}",
"mc_priority": "PRIORITY_1",
#if(${latestEvent.severity}=="ERROR") ---->> HOW CAN WE WRITE THIS?
"severity": "CRITICAL",
#end
#if(${latestEvent.severity}=="WARN") ---->> HOW CAN WE WRITE THIS?
"severity": "MAJOR",
#end
#if(${latestEvent.severity}=="INFO") ---->> HOW CAN WE WRITE THIS?
"severity": "OK",
#end
"msg": "$!{latestEvent.summaryMessage.replace('<br>',' ').replace('<b>','').replace('</b>','')}",
"mc_long_msg": "$!{latestEvent.eventMessage.replace('<br>',' ').replace('<b>','').replace('</b>','')}"
}
}
]
1 REPLY 1

You cannot write any kind of logic in Webhook payloads.

https://www.dynatrace.com/support/help/setup-and-configuration/integrations/third-party-integrations...

You can only use existing placeholders that are in documentation above. I think it may be good idea to post new product idea about this feature.

Sebastian