> For the complete documentation index, see [llms.txt](https://docs.octoxlabs.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.octoxlabs.com/adapters/s/servicenow-cmdb.md).

# Servicenow CMDB

The Servicenow CMDB holds the configuration items of your IT estate. OctoXLabs reads the computer table and adds the computers to the device inventory. It can also attach business context, such as service owner and criticality, from the relationship table and from a custom table.

## Use cases

* List computers that the CMDB records.

```
Adapters = servicenow-cmdb
```

* Find CMDB computers that no EDR covers.

```
Adapters = servicenow-cmdb AND NOT Adapters = falcon-crowdstrike
```

* Find CMDB computers that have not been seen by discovery or any other source recently.

```
Adapters = servicenow-cmdb AND NOT LastSeen last now-90d/d
```

## Before you begin

### Network

| Source              | Destination                        | Port                          | Protocol                           |
| ------------------- | ---------------------------------- | ----------------------------- | ---------------------------------- |
| OctoXLabs connector | ServiceNow instance (IP you enter) | The port you enter (required) | HTTPS (HTTP when Is Secure is off) |

### Required permissions

| Scope or role       | Permission | Needed for                     |
| ------------------- | ---------- | ------------------------------ |
| itil                | Role       | Read access to the CMDB tables |
| rest\_api\_explorer | Role       | REST Table API access          |
| web\_service\_admin | Role       | Web service access             |

Also make sure the user can read the enrichment tables if you turn enrichment on. A missing read ACL shows up in the connection test.

## Create credentials in Servicenow CMDB

{% stepper %}
{% step %}

### Open User Administration

Log in to the ServiceNow admin panel and go to **User Administration**.
{% endstep %}

{% step %}

### Create the user

Click **Users**, then **New**, and fill in the details.
{% endstep %}

{% step %}

### Edit the user

Find the user on the **Users** screen and click **Edit**.
{% endstep %}

{% step %}

### Assign roles

Assign the roles **itil**, **rest\_api\_explorer** and **web\_service\_admin**.
{% endstep %}

{% step %}

### Save

Click **Save**, then click **Update**.
{% endstep %}
{% endstepper %}

## Connection parameters

| Parameter                                 | Required              | Type            | Default | Description                                                                                                                                                                                                                                                                                    |
| ----------------------------------------- | --------------------- | --------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| IP                                        | Yes                   | String          | None    | IP address of the ServiceNow host.                                                                                                                                                                                                                                                             |
| Port                                      | Yes                   | Integer         | None    | Port of the ServiceNow instance.                                                                                                                                                                                                                                                               |
| Username                                  | Yes                   | String          | None    | Account used to connect.                                                                                                                                                                                                                                                                       |
| Password                                  | Yes                   | String          | None    | Password of that account.                                                                                                                                                                                                                                                                      |
| Timeout (advanced)                        | No                    | Integer         | 30      | Seconds to wait for API responses.                                                                                                                                                                                                                                                             |
| Is Secure? (advanced)                     | No                    | Boolean         | True    | Use HTTPS.                                                                                                                                                                                                                                                                                     |
| Fetch Enrichment                          | No                    | Boolean         | False   | Master switch for business context and custom table enrichment. While off, only the computer table is read.                                                                                                                                                                                    |
| Relationship Query (advanced)             | No                    | String          | Empty   | `sysparm_query` for the `cmdb_rel_ci` table. Empty turns business context collection off. Keep the `childINSTANCEOFcmdb_ci_computer` condition. The relationship `type` value is the sys\_id from your own instance.                                                                           |
| Additional Relationship Fields (advanced) | No                    | List of strings | Empty   | Extra columns requested from `cmdb_rel_ci`, added to the built-in list (service name, criticality, classification, operational status, short description, department and its head, owned by, managed by, location). Dot-walked columns are supported. Custom `u_` columns must be listed here. |
| Relationship Join Field (advanced)        | No                    | String          | child   | Relationship column that identifies the host. `child.sys_id` is used automatically when present.                                                                                                                                                                                               |
| Custom Table (advanced)                   | No                    | String          | Empty   | Table to read. Give the table name, or a full path starting with `/` if it is not under `/api/now/table`. Empty turns this section off.                                                                                                                                                        |
| Custom Table Query (advanced)             | No                    | String          | Empty   | `sysparm_query` for the custom table.                                                                                                                                                                                                                                                          |
| Custom Table Fields (advanced)            | No                    | List of strings | Empty   | Columns requested from the custom table. Empty collects every column, which can add many fields per device.                                                                                                                                                                                    |
| Custom Table Join Field (advanced)        | Yes, for custom table | String          | Empty   | Column that holds the host name. Without it the table is skipped and a warning is logged.                                                                                                                                                                                                      |

## Troubleshooting

| Error message                                                                                       | Cause                                                                                                                                      | Fix                                                                                                                          |
| --------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------- |
| : ServiceNow did not return these requested fields (non-existent column, typo or missing read ACL): |                                                                                                                                            |                                                                                                                              |
| A requested column is not in the response (log warning).                                            | Check the column name and the read ACL.                                                                                                    |                                                                                                                              |
| enrichment failed, devices keep no data:                                                            |                                                                                                                                            |                                                                                                                              |
| The enrichment table call failed (log error). Devices are still collected.                          | Check the table name, the query and the ACL.                                                                                               |                                                                                                                              |
| <p>is configured but its join field is empty, the enrichment is skipped.</p><h2>Change history</h2> |                                                                                                                                            |                                                                                                                              |
| Custom Table is set without Custom Table Join Field.                                                | Set the join field.                                                                                                                        |                                                                                                                              |
| Status Code:                                                                                        | The API answered with a status other than the one the connector expects. The message also lists the URL, the method and the response body. | Read the status code and the response body in the message, then check the credentials, the permissions and the network path. |

| Custom Table is set without Custom Table Join Field. | Set the join field.                                                                                                                        |                                                                                                                              |
| ---------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------- |
| Status Code:                                         | The API answered with a status other than the one the connector expects. The message also lists the URL, the method and the response body. | Read the status code and the response body in the message, then check the credentials, the permissions and the network path. |

| The enrichment table call failed (log error). Devices are still collected.                          | Check the table name, the query and the ACL.                                                                                               |                                                                                                                              |
| --------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------- |
| <p>is configured but its join field is empty, the enrichment is skipped.</p><h2>Change history</h2> |                                                                                                                                            |                                                                                                                              |
| Custom Table is set without Custom Table Join Field.                                                | Set the join field.                                                                                                                        |                                                                                                                              |
| Status Code:                                                                                        | The API answered with a status other than the one the connector expects. The message also lists the URL, the method and the response body. | Read the status code and the response body in the message, then check the credentials, the permissions and the network path. |

| Custom Table is set without Custom Table Join Field. | Set the join field.                                                                                                                        |                                                                                                                              |
| ---------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------- |
| Status Code:                                         | The API answered with a status other than the one the connector expects. The message also lists the URL, the method and the response body. | Read the status code and the response body in the message, then check the credentials, the permissions and the network path. |

| A requested column is not in the response (log warning).                                            | Check the column name and the read ACL.                                                                                                    |                                                                                                                              |
| --------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------- |
| enrichment failed, devices keep no data:                                                            |                                                                                                                                            |                                                                                                                              |
| The enrichment table call failed (log error). Devices are still collected.                          | Check the table name, the query and the ACL.                                                                                               |                                                                                                                              |
| <p>is configured but its join field is empty, the enrichment is skipped.</p><h2>Change history</h2> |                                                                                                                                            |                                                                                                                              |
| Custom Table is set without Custom Table Join Field.                                                | Set the join field.                                                                                                                        |                                                                                                                              |
| Status Code:                                                                                        | The API answered with a status other than the one the connector expects. The message also lists the URL, the method and the response body. | Read the status code and the response body in the message, then check the credentials, the permissions and the network path. |

| Custom Table is set without Custom Table Join Field. | Set the join field.                                                                                                                        |                                                                                                                              |
| ---------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------- |
| Status Code:                                         | The API answered with a status other than the one the connector expects. The message also lists the URL, the method and the response body. | Read the status code and the response body in the message, then check the credentials, the permissions and the network path. |

| The enrichment table call failed (log error). Devices are still collected.                          | Check the table name, the query and the ACL.                                                                                               |                                                                                                                              |
| --------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------- |
| <p>is configured but its join field is empty, the enrichment is skipped.</p><h2>Change history</h2> |                                                                                                                                            |                                                                                                                              |
| Custom Table is set without Custom Table Join Field.                                                | Set the join field.                                                                                                                        |                                                                                                                              |
| Status Code:                                                                                        | The API answered with a status other than the one the connector expects. The message also lists the URL, the method and the response body. | Read the status code and the response body in the message, then check the credentials, the permissions and the network path. |

| Custom Table is set without Custom Table Join Field. | Set the join field.                                                                                                                        |                                                                                                                              |
| ---------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------- |
| Status Code:                                         | The API answered with a status other than the one the connector expects. The message also lists the URL, the method and the response body. | Read the status code and the response body in the message, then check the credentials, the permissions and the network path. |
