ServiceNow — Data Template Usage

Configure the JSON templates used to raise and close ServiceNow tickets.

2 min read Updated SS

This section explains how to use the dynamic templates for raising and closing tickets in ServiceNow. The meta-template folder contains JSON files that serve as templates for these operations.

Dynamic Ticket Template Configuration

Ticket Raising Template: The service_now_description_template.json file serves as a dynamic template for raising tickets in ServiceNow. Here is the JSON structure of the template:

{
  "u_event_id": "${SignalId}",
  "u_application_name": "${LatestEvents_AppName}",
  "u_service_name": "${LatestEvents_ServiceName}",
  "u_affected_instance_name": "${LatestEvents_InstanceName}",
  "u_event_detected_time": "${LatestEvents_EventDetectedTime}",
  "u_threshold_set": "${LatestEvents_UpperThresholds},${LatestEvents_LowerThresholds}",
  "u_current_value": "${LatestEvents_value}",
  "u_host_address": "${LatestEvents_HostAddress}",
  "u_cmdb_ci": "${LatestEvents_InstanceName}",
  "u_heal_sub_category": "${LatestEvents_Category}",
  "u_heal_sub_sub_category": "${LatestEvents_KpiName}",
  "u_short_description": "${SignalDescription}",
  "u_description": "${LatestEvents}",
  "u_heal_status": "${SignalStatus}"
}

Ticket Closing Template

The service_now_close_description_template.json file serves as a dynamic template for sending closed events to ServiceNow. Here is the complete JSON structure of the template:

{
  "u_event_id": "${SignalId}",
  "u_application_name": "${LatestEvents_AppName}",
  "u_service_name": "${LatestEvents_ServiceName}",
  "u_affected_instance_name": "${LatestEvents_InstanceName}",
  "u_event_detected_time": "${LatestEvents_EventDetectedTime}",
  "u_threshold_set": "${LatestEvents_UpperThresholds},${LatestEvents_LowerThresholds}",
  "u_current_value": "${LatestEvents_value}",
  "u_host_address": "${LatestEvents_HostAddress}",
  "u_cmdb_ci": "${LatestEvents_InstanceName}",
  "u_heal_sub_category": "${LatestEvents_Category}",
  "u_heal_sub_sub_category": "${LatestEvents_KpiName}",
  "u_short_description": "${SignalDescription}",
  "u_description": "${LatestEvents}",
  "u_heal_status": "${SignalStatus}"
}

Updating Template

To update the dynamic templates, the placeholders should be populated with actual values from a database. Use the following SQL query to populate the database:

INSERT INTO `appsone`.`external_configurations`
  (`name`, `value`, `value_type`, `status`, `created_time`, `updated_time`, `entity_identifier`, `source`)
VALUES
  ('<config_name>', '<config_value>', 'Plain', '1', 'utc_time()', 'utc_time()', '<config_key>', 'ServiceNow');

Important Notes: If an application is not listed in the external_configurations table, default values should be provided.

  • The config_name and config_value correspond with the JSON key names and values for the dynamic configuration.

  • A few fields in the service_now_description_template.json file can be static and a few can be dynamic.

    ServiceNow dynamic template field mapping

Sending Events to ServiceNow

The service_now_event_collection_web_template.json file is used for sending events to ServiceNow. To set specific values for each attribute, modify the below JSON file.

Template structure:

{
  "records": [
    {
      "source": "${Source}",
      "event_class": "${EventClass}",
      "resource": "${Resource}",
      "node": "${NodeAddress}",
      "metric_name": "${MetricName}",
      "type": "${NodeCompType}",
      "severity": "${Severity}",
      "message_key": "${MessageKey}",
      "description": "${Description}",
      "additional_info": {
        "snow_instance": "${SnowInstance}",
        "metric-value": "${Metric-value}",
        "Timezone": "${Timezone}",
        "AccountIdentifier": "${AccountIdentifier}",
        "CompType": "${NodeCompType}",
        "Signal_ID": "${Signal_ID}",
        "Signal_Status": "${Signal_Status}",
        "Organization_Name": "${Organization_Name}",
        "App_Names": "${App_Names}",
        "RootCause_ServiceNames": "${RootCause_ServiceNames}",
        "Affected_ServiceNames": "${Affected_ServiceNames}",
        "Affected_ApplicationNames": "${Affected_ApplicationNames}",
        "Total_Events": "${Total_Events}",
        "severity": "${Severity}",
        "Latest_Events": ${Latest_Events}
      }
    }
  ]
}

Next — Return to Setting Up ServiceNow for the plugin configuration steps, review the full connector workflow in the HEAL Connectors SOP, or see where ticketing fits in the Agents & Connectors Overview.