> 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/documentation/adapters/connect-an-adapter.md).

# Connect an adapter

Create a connection to one of your products, test it, run a discovery and check the assets it fetched.

Connect OctoXLabs to a product by creating a connection to its adapter. By the end of this page the connection passes its test and its assets are in your inventories. To see how adapters, connections and connectors relate first, read How adapters work.

### Before you begin

* Required permissions: add, change and delete connections (to create, edit and remove them), and permission to start discovery.
* The address and credentials of the product, with the permissions its adapter needs. The requirements are on the adapter's page in the [Adapters space](https://docs.octoxlabs.com/adapters) and in the panel next to the connection form.
* The connector that will run the connection can reach the product. For a product in another network, install a remote connector first.

### Connect an adapter

{% stepper %}
{% step %}

#### Find the adapter

Open **Adapters** from the side menu. The page lists the adapters as cards. Use **Search Adapter** or the **Type**, **Group**, **Mapping** and **Connector** filters to find the product, then open its card. The adapter page shows its connections.
{% endstep %}

{% step %}

#### Create a connection

Select **Create New Connection** (top right). The form has two parts.

**Fields that every adapter has**

| Field           | What to enter                                                                                                                                              |
| --------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Name**        | A name for the connection. Required. It cannot contain HTML. Use a name that tells connections of the same adapter apart, for example the site or account. |
| **Description** | Optional free text.                                                                                                                                        |
| **Connector**   | The connector that runs this connection. Required. Choose the default connector, or a remote connector for a product in another network.                   |

**Fields of the adapter**

Below these, the form shows the fields of the selected adapter, such as host, port, username, password, API key or a certificate file. Required fields are marked. The fields differ for every adapter, so follow the panel on the right and the adapter's page. Rarely changed options, such as timeouts, SSL or proxy settings and what to fetch, are under **Advanced Settings**. Select it to expand the list.

{% hint style="info" %}
Settings such as a proxy, SSL verification, timeouts and fetch limits are adapter fields, not fields every connection has. A proxy for all the connections of a connector is set on the connector, under the connector settings (**HTTPS Proxy**, **HTTPS Proxy Username**, **HTTPS Proxy Password**).
{% endhint %}

Select **Create**. The connection is saved and its edit page opens.
{% endstep %}

{% step %}

#### Test the connection

On the edit page, select **Test**. OctoXLabs checks that the connector can reach the product with the details you entered. A message tells you the result: **Connection successful**, or the error text from the product or connector. The test uses the values in the form. Select **Save** to keep any change you made.

{% hint style="warning" %}
Always test before the first discovery. A connection that fails its test is skipped by the discovery and shows **Error**.
{% endhint %}
{% endstep %}

{% step %}

#### Run a discovery

Choose how much to collect.

{% tabs %}
{% tab title="All connections" %}
In the top bar, open the **Discovery** dropdown and select **Start discovery**. The confirmation says that this starts a new discovery process and cannot be undone. Confirm to start. To run discovery automatically, add a schedule (see Discovery Schedule).
{% endtab %}

{% tab title="One connection" %}
On the connection's edit page, select **Fetch**. A message confirms that the connection discovery started. Use this to check a new connection without waiting for a full run.
{% endtab %}
{% endtabs %}

Wait until the discovery shows as completed. Open **History** in the **Discovery** panel to see each step and the **Connections Status** of every connection.

{% hint style="info" %}
**Fetch** needs a full discovery to have run before. If you have never run a full discovery on this installation, start one from **Start discovery** first.
{% endhint %}
{% endstep %}

{% step %}

#### Check the result

Open the adapter page. The **Status** column of the connection must read **Success**. Then open the inventory that matches what the adapter provides, for example **Inventories** > **Devices**, and filter by connection:

```
Connections = YOUR_CONNECTION_NAME
```

You should see one row for each asset the connection returned. See How adapters work for the asset type each inventory holds.
{% endstep %}
{% endstepper %}

### Manage connections

All connections are listed on the adapter page and under **Adapters** > **All Connections**. The list shows **Status**, **Name**, **Connector** and an **Enabled** toggle, and you can filter it with the search box.

| Task                  | How                                                                                                                                                                                          |
| --------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Edit                  | Select the edit icon in the **Actions** column, change the fields and select **Save**. Sensitive fields show as asterisks. Leave them unchanged to keep the stored value, or type a new one. |
| Disable or enable     | Switch the **Enabled** toggle. A disabled connection stays in the list but is skipped by discovery.                                                                                          |
| Delete                | Select the delete icon in the **Actions** column.                                                                                                                                            |
| Test or fetch several | On the list, open **Actions** and choose **Test All Enabled Connections**, **Test Selected Connections** or **Fetch Selected Connections**.                                                  |
| Disable or enable all | In **Actions**, choose **Disable All** or **Enable All**.                                                                                                                                    |

On the adapter page, **Adapter Based Discovery** lets you add a schedule for that adapter alone, and **Preview** shows when it will run. By default, connections that have such a schedule are not run again in the full discovery. This is controlled by **Add Adapterized Adapters to Full Discovery** in Advanced Settings.

### Verify the result

* The connection shows **Success** in the **Status** column and the adapter card is no longer marked as having no connection.
* The discovery in **History** is completed and your connection has no error under **Connections Status**.
* The inventory lists assets for `Connections = YOUR_CONNECTION_NAME`.

Below the connections, the adapter page can also suggest queries and charts for the adapter under **Chart & Query Recommendations**. Choose a dashboard to add them to.

### Troubleshooting

| Symptom or error message                                                    | Cause                                                                                                                                                          | Fix                                                                                                                                              |
| --------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
| Test fails with `Invalid connector token.`                                  | The connector selected on the connection has no token set.                                                                                                     | Set the connector's token in its settings and select **Send Test** there, then test the connection again.                                        |
| Test fails with `Connector is unreachable`                                  | The main server cannot reach the connector.                                                                                                                    | Check that the connector is running and that the ports between the two servers are open. See Install a remote connector.                         |
| Saving fails with `This host points to the application's internal network.` | A host, IP, URL or domain field resolves to the OctoXLabs server's own network, a loopback or a link-local address.                                            | Enter the address of the product itself, as reachable from the connector.                                                                        |
| Saving fails with `Enter a valid host.`                                     | The host field is empty or not a valid host or URL.                                                                                                            | Correct the value.                                                                                                                               |
| **Error occurred during connection test**                                   | The product refused the connection or the details are wrong.                                                                                                   | Check the address, port, credentials and permissions. Confirm the product is reachable from the connector's network, not only from your browser. |
| The connection is missing from a discovery                                  | It is disabled, it failed its test at the start of the run, or it has an adapter based schedule and the full discovery does not include scheduled connections. | Enable it, fix and test it, or turn on **Add Adapterized Adapters to Full Discovery**.                                                           |
| A **Fetch** ends with an error at once                                      | No full discovery has run yet. The discovery log says `Before starting an adapterized discovery, a full discovery must be started.`                            | Start a full discovery, then use **Fetch** again.                                                                                                |
| Discovery does not start and ends with an error                             | Disk usage on the server is above 80%.                                                                                                                         | Free disk space or increase it, then start the discovery again.                                                                                  |
| The log says `Connector timed out. Connection test exceed 120 seconds.`     | The connector could not finish the test in 120 seconds.                                                                                                        | Check the network path and the load on the product and the connector.                                                                            |

### What's next?

<table data-view="cards"><thead><tr><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><strong>How adapters work</strong></td><td>Connections, connectors, discovery and aggregation explained.</td><td></td></tr><tr><td><strong>File-based adapters</strong></td><td>Import assets from files when there is no API to connect to.</td><td></td></tr><tr><td><strong>Discovery Schedule</strong></td><td>Run discovery automatically.</td><td></td></tr><tr><td><strong>Create and save queries</strong></td><td>Filter the fetched assets and reuse the filter.</td><td></td></tr></tbody></table>
