01 Feb 2021 12:41 PM
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>','')}"
}
}
]
Solved! Go to Solution.
02 Feb 2021 09:33 AM
You cannot write any kind of logic in Webhook payloads.
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