Object Payloads in Connection Center

Object payloads (or sometimes simply ‘the payload' in our documentation) - are blocks of text (usually JSON) containing parameters in place of actual values. The Cookdown Object engine replaces these parameters with actual values for each object. You will encounter these with 'Object Connections’.

This page contains information relevant to all types of object payloads (though it will contain examples from specific types). You can find information relevant to specific types in the subpages below.

Regular Expressions (RegEx)

Rather than simply pushing the values returned from a key into a payload we can transform their values using regular expressions. The following video will explain how they work and where to use theming ServiceNow as an example. The interface shown is from an older version, however, the content is still relevant:

Let us explore this with the example of Linux Servers on ServiceNow.

Linux Servers identified by ServiceNow’s own Discovery product use the Netbios name of a Linux Server as the name of each CI and ServiceNow’s default Identification and Reconciliation Engine Identity Entries call out the name field. This means that for Cookdown Discovery to co-exist with ServiceNow Discovery-created CIs for Linux Servers the Netbios name must be used in the name attribute.

When looking at the data in SCOM for Linux Servers, you will only find the FQDN of the server (“server01.mydomain.local” rather than simply “server01”). While this data is close, if you were to push CIs from SCOM using their FQDN you would create duplicate CIs in ServiceNow.

With the RegEx feature, we can get the Cookdown Discovery engine to drop everything after the first full stop in the Linux Server’s FQDN (in other words, to get “server01” only from “server01.mydomain.local”).

Back to Top

RegEx Syntax

Object connections use .net so all standard .net RegEx syntax applies to a connection's use of it, Read more on RegEx with .net here and see this handy RegEx cheat sheet with the most commonly used regular expressions.

Regular expressions are noted alongside the key they apply to as per the following syntax (an example line from a payload):

"<attribute name>": "[REGEX(<Cookdown Discovery Key>,'<regular expression>')]",

See below for an example of what this will look like in the product with a specific example for Windows Server

As with all Object Payloads, the format is JSON and keys are highlighted green, but unlike standard payloads, regular expressions are highlighted in yellow.

Back to Top

RegEx Example

In this example, we will split the NetBios name from an FQDN for “Server-01.cookdown.local”.

Payload:

{
  "items": [
    {
      "className": "cmdb_ci_win_server",
      "lookup": [],
      "values": {
        "name": "[REGEX(Microsoft.Windows.Computer:::PrincipalName,'\\D*\\d*')]"
      }
    }
  ],
  "relations": []
}

Note that \D matches non-numeric characters, when used with * it will match all non-numeric characters in the key from its start until it hits a number. \d matches all numeric characters and when used with * will match all numeric characters (so will stop matching when a non-numeric character is hit).

Typically in .net regular expressions, the syntax would be “\D*\d*” but in the JSON language \ is a protected symbol so must be escaped with a \. The result in a payload is “\\D*\\d*”

Result of payload for Server01:

{
  "items": [
    {
      "className": "cmdb_ci_win_server",
      "lookup": [],
      "values": {
        "name": "Server-01"
       }
    }
  ],
  "relations": []
}

Back to Top

Further reading and next steps

Reading about a specific connection type would be the next logical step.

Otherwise, for further reading at this stage we would recommend looking at the following:

Advanced Connection Center Configuration

Testing, Tips, and Tricks for Connection Center

Back to Top