# Adding Connection

## Agent-based

> Illustration executed through the [Agent CLI](https://docs.datasentinel.io/manual/implementation/agent-usage/cli)

```bash
cat > myInstance.json <<EOF
{
  "host": "host_name",
  "port": postgres_port,
  "user": "datasentinel",
  "password": "myPassword",
  "tags": "application=application_name,environment=application_type,datacenter=datacenter"
}
EOF
```

{% hint style="info" %}
Replace **MyConnectionName** with a meaningful connection name in your environment.
{% endhint %}

{% code title="Example with the agent CLI" %}

```bash
datasentinel add connection myConnectionName -f myInstance.json
```

{% endcode %}

{% hint style="info" %}
A script is present in the **datasentinel** subdirectory as an example named **connection\_example.sh**
{% endhint %}

The tags are customizable, allowing you to define your own tags.\
They are extremely useful in the user interface for filtering, grouping data, and defining role-based access.

{% content-ref url="../../features/tips-and-hints/tags" %}
[tags](https://docs.datasentinel.io/manual/features/tips-and-hints/tags)
{% endcontent-ref %}

## Agentless

> Refer to Agentless Documentation&#x20;

{% content-ref url="../../features/other-features/agentless-monitoring" %}
[agentless-monitoring](https://docs.datasentinel.io/manual/features/other-features/agentless-monitoring)
{% endcontent-ref %}
