Controller (SaaS, On Premise)

cancel
Showing results for 
Search instead for 
Did you mean: 

ServiceNow integration - REST API

Highlighted
Discoverer

ServiceNow integration - REST API

Hello Community and a Happy New Year

 

Is there a way to configure a http request template to be able to close an existing servicenow incident on Health Rule Violation Ending by locating an existing record using the sys_id ?

 

Post /api/now/table/incident

Put /api/now/table/incident/{sys_id}

 

thanks

Steve

ServiceNow integration - REST API
1 REPLY 1
AppDynamics Team (Retired)

Re: ServiceNow integration - REST API

Hello, Steven. Normally customers use an event management system, for this reason, otherwise, your ticket may get extremely cluttered or you will end up with a lot of duplicate tickets. We do not have an integration which does what you are asking, but if you look at how we integrate with ServiceNow Event Management you can likely derive a new HTTP Action template from the concept using the table API. 

 

#set($controllerName="demo1.appdynamics.com")
{
"records":[
#foreach(${event} in ${fullEventList})

#foreach(${entity} in ${event.affectedEntities})
#if($foreach.index > 0)
,
#end
{
"source": "AppDynamics"
,"event_class": "$controllerName"
,"x_apd_appdynamics_event_source_url": "$event.deepLink"
#if( $entity.entityTypeDisplayName == "Node" )
,"node": "$entity.name"
, "resource": "$entity.name"
, "ci_type": "x_apd_appdynamics_node"
,"ci_identifier" :{
"name":"$entity.name",
"tier_name":"$event.tier.name",
"application_name":"$event.application.name",
"controller_name": "$controllerName"
}
#elseif( $entity.entityTypeDisplayName == "Tier" )
,"node": "$entity.name"
, "resource": "$entity.name"
, "ci_type": "x_apd_appdynamics_tier"
,"ci_identifier" :{
"name":"$entity.name",
"application_name":"$event.application.name",
"controller_name": "$controllerName"
}
#elseif( $entity.entityTypeDisplayName == "Application" )
,"node": "$entity.name"
, "resource": "$entity.name"
, "ci_type": "x_apd_appdynamics_application"
,"ci_identifier" :{
"name":"$event.application.name",
"controller_name": "$controllerName"
}
#elseif( $entity.entityTypeDisplayName == "Business Transaction" )
, "ci_type": "x_apd_appdynamics_tier"
, "resource": "$entity.entityTypeDisplayName - $entity.name"
,"node": "$event.tier.name"
,"ci_identifier" :{
"name":"$event.tier.name",
"application_name":"$event.application.name",
"controller_name": "$controllerName"
}
#elseif( $entity.entityTypeDisplayName == "Service Endpoint" )
, "ci_type": "x_apd_appdynamics_tier"
, "resource": "$entity.entityTypeDisplayName - $entity.name"
,"node": "$event.tier.name"
,"ci_identifier" :{
"name":"$event.tier.name",
"application_name":"$event.application.name",
"controller_name": "$controllerName"
}
#elseif( $entity.entityTypeDisplayName == "Backend" )
, "ci_type": "x_apd_appdynamics_remote_service"
, "resource": "$entity.entityTypeDisplayName - $entity.name"
,"node": "$entity.name"
,"ci_identifier" :{
"name":"$entity.name",
"application_name":"$event.application.name",
"controller_name": "$controllerName"
}
#else
#if($event.node)
, "ci_type": "x_apd_appdynamics_node"
, "resource": "$entity.entityTypeDisplayName - $entity.name"
,"node": "$event.node.name"
,"ci_identifier" :{
"name":"$event.node.name",
"tier_name":"$event.tier.name",
"application_name":"$event.application.name",
"controller_name": "$controllerName"
}
#elseif($event.tier)
, "ci_type": "x_apd_appdynamics_tier"
, "resource": "$entity.entityTypeDisplayName - $entity.name"
,"node": "$event.tier.name"
,"ci_identifier" :{
"name":"$event.tier.name",
"application_name":"$event.application.name",
"controller_name": "$controllerName"
}
#elseif($event.application)
, "ci_type": "x_apd_appdynamics_application"
, "resource": "$entity.entityTypeDisplayName - $entity.name"
,"node": "$event.application.name"
,"ci_identifier" :{
"name":"$event.application.name",
"controller_name": "$controllerName"
}
#else
, "node": "$entity.name"
, "resource": "$entity.entityTypeDisplayName - $entity.name"
#end

#end
#if($event.healthRule)
,"metric_name" : "$event.healthRule.name"
#set( $msg=$event.healthRule.name)
#else
#set( $msg="")
#end
#set( $msg=$msg + ". " + ${event.eventMessage})
#set( $msg = $msg.replace("<b>", "") )
#set( $msg = $msg.replace("</b>", "") )
#set( $msg = $msg.replace("<br>", "") )
,"description" : "$msg"
#if($event.eventType == "POLICY_OPEN_WARNING"
|| $event.eventType == "POLICY_CONTINUES_WARNING"
|| $event.eventType == "POLICY_DOWNGRADED")
,"severity": "2"
#elseif($event.eventType == "POLICY_OPEN_CRITICAL"
|| $event.eventType == "POLICY_CONTINUES_CRITICAL"
|| $event.eventType == "POLICY_UPGRADED")
,"severity": "1"
#elseif($event.eventType == "POLICY_CLOSE_WARNING"
|| $event.eventType == "POLICY_CLOSE_CRITICAL"
|| $event.eventType == "POLICY_CANCELED_WARNING"
|| $event.eventType == "POLICY_CANCELED_CRITICAL")
,"severity": "0"
#end
}
#end
#end
]
}



Found something helpful? Click the Accept as Solution button to help others find answers faster.
Liked something? Click the Thumbs Up button.