# Tooling

{% hint style="info" %}
It is available as executable shell scripts that can be run in a terminal console, while connected as the Datasentinel owner.
{% endhint %}

This technical documentation aims to provide detailed information about these tools and their functions.

## **Informations**

***

This provides an overview of Datasentinel, including version number and license status.

```bash
/datasentinel/soft/datasentinel_backend/scripts/datasentinel_infos.sh
```

{% code title="Output" %}

```
Datasentinel toolkit - All rights reserved                       www.datasentinel.io
====================================================================================================

Datasentinel version: 2023.05

Token               : eyJ0eXAiOiJKV1QiLCJhbdeiOiJIUzI1NiJ9.eyJl5455dedeOTg2NTk5MDAsImlh6MTY4MzEwNzg5NSwiZGF0YWJUiOiJkcy1kYXRhIn0.ovIiD_UYhgXR9UEXR95Ik2mOMFr4AlBhb1cD1Kc
Token expiry time   : 2023-05-01 10:58:20
```

{% endcode %}

## **Token Update**

***

This script allows you to update the license (aka token). You can also perform this action directly from the UI. (Refer to [Documentation](https://docs.datasentinel.io/manual/implementation/platform-usage/configuration/license))

```bash
/datasentinel/soft/datasentinel_backend/scripts/datasentinel_update_token.sh <<TOKEN_VALUE>>
```

{% code title="Output" %}

```
Datasentinel toolkit - All rights reserved                       www.datasentinel.io
====================================================================================================

Token               : eyJ0eXAiOiJKV1QiLCJhbGciOdeIUzI1NiJ9.eyJleHAiOjE2OTAwdeIxNjksImlhdCI6MTY1ODg1MTc2NCwiZGF0YWJhc2UiOiJkcy1kYXRhIn0.4OCpfbJqZ_g1XmpFQtgAc-eYGkahYRTqjb05Gr1T_1I

Token updated successfully
New Token expiry time   : 2023-07-22 16:09:29
```

{% endcode %}

## **Registered Agents**

***

This displays agents currently registered in the platform as well as their version, the memory used, and the number of instances they monitor

```bash
/datasentinel/soft/datasentinel_backend/scripts/registered_agents.sh
```

{% code title="Output" %}

```
Datasentinel toolkit - All rights reserved                       www.datasentinel.io
====================================================================================================
This displays registered agents that have been active within the last three days.

15 agent(s) registered

                                          Listening                Memory Start                  Connection(s)                        Internal
Server                                         Port    Version         MB Time                         Running last upload(< 3d)       Threads
----------------------------------------------------------------------------------------------------------------------------------------------
pg-sales-5139                                  8282      3.4.0         81 2023-05-12 12:57:03              1/1 2023-05-12 14:39:00          18
pg-sales-3928                                  8282      3.4.0         70 2023-05-12 12:57:14              1/1 2023-05-12 14:39:00          18
pg-sales-3127                                  8282      3.4.0         70 2023-05-12 12:57:04              1/1 2023-05-12 14:39:00          18
pg-sales-0616                                  8282      3.4.0         65 2023-05-12 12:57:10              1/1 2023-05-12 14:39:00          18
pg-sales-0509                                  8282      3.4.0         69 2023-05-12 12:57:24              1/1 2023-05-12 14:39:00          18
pg-sales-0249                                  8282      3.4.0         50 2023-05-12 12:57:27              1/1 2023-05-12 14:39:00          18
pg-customer-2815                               8282      3.4.0         51 2023-05-12 12:57:21              1/1 2023-05-12 14:39:00          18
pg-crm-4529                                    8282      3.4.0         52 2023-05-12 12:57:14              1/1 2023-05-12 14:39:00          18
pg-crm-4107                                    8282      3.4.0         69 2023-05-12 12:57:06              1/1 2023-05-12 14:39:00          18
pg-crm-3108                                    8282      3.4.0         67 2023-05-12 12:57:05              1/1 2023-05-12 14:39:00          18
pg-crm-2031                                    8282      3.4.0         51 2023-05-12 12:57:22              1/1 2023-05-12 14:39:00          18
pg-crm-0926                                    8282      3.4.0         52 2023-05-12 12:57:19              1/1 2023-05-12 14:39:00          18
pg-cluster-03                                  8282      3.4.0         53 2023-05-12 10:57:13              1/1 2023-05-12 12:39:00          18
pg-cluster-02                                  8282      3.4.0         53 2023-05-12 10:57:12              1/1 2023-05-12 12:39:00          18
pg-cluster-01                                  8282      3.4.0         53 2023-05-12 10:57:13              1/1 2023-05-12 12:39:00          18
```

{% endcode %}

## **Inventory**

***

This displays all instances registered on the platform, regardless of whether they are agent-based or agentless

```bash
/datasentinel/soft/datasentinel_backend/scripts/registered_connections.sh
```

{% code title="Output" %}

```
Datasentinel toolkit - All rights reserved                       www.datasentinel.io
====================================================================================================
This displays all registered connections, whether agent-based or agentless and the last upload time (if < 12h)

Registered connections: 17

Instance                                                                         Version    last upload(< 12h)   Type
------------------------------------------------------------------------------------------------------------------------------------
pg-crm-0926@:9342                                                                11.8       2023-05-12 14:42:45  Agent-based
   Tags: server=pg-crm-0926,criticity=,provider=azure,datacenter=lyon,ha_cluster=,application=crm,application_name=,environment=production,

pg-crm-2031@:9342                                                                11.8       2023-05-12 14:42:43  Agent-based
   Tags: application=crm,criticity=,environment=production,provider=azure,datacenter=lyon,ha_cluster=,application_name=,server=pg-crm-2031,

pg-crm-3108@:9342                                                                14.7       2023-05-12 14:42:50  Agent-based
   Tags: application_name=,server=pg-crm-3108,application=crm,criticity=,environment=development,provider=azure,datacenter=paris,ha_cluster=,

pg-crm-4107@:9342                                                                14.7       2023-05-12 14:42:44  Agent-based
   Tags: environment=development,provider=azure,datacenter=paris,ha_cluster=,application=crm,application_name=,criticity=,server=pg-crm-4107,

pg-crm-4529@:9342                                                                14.0       2023-05-12 14:42:46  Agent-based
   Tags: application=crm,application_name=,datacenter=paris,server=pg-crm-4529,criticity=,environment=development,provider=azure,ha_cluster=,

pg-crm-0926@AgentLess1                                                           11.8       2023-05-12 14:42:45  Agentless
   Tags: datacenter=paris,ha_cluster=,application=crm,provider=aws,server=pg-crm-0926,application_name=,criticity=,environment=production,

pg-customer-2815@:9342                                                           9.4.24     2023-05-12 14:42:53  Agent-based
   Tags: application_name=,criticity=,environment=development,provider=on-premises,server=pg-customer-2815,application=customer,datacenter=lille,ha_cluster=,

pg-sales-0509@:9342                                                              12.6       2023-05-12 14:42:51  Agent-based
   Tags: server=pg-sales-0509,application=sales,application_name=,criticity=,datacenter=lyon,ha_cluster=,provider=amazon,environment=production,

pg-sales-5315@AgentLess3                                                         12.4       2023-05-12 14:42:50  Agentless
   Tags: application_name=,criticity=,environment=development,ha_cluster=,application=sales,provider=aws,datacenter=paris,server=pg-sales-5315,

pg-sales-0249@:9342                                                              10.23      2023-05-12 14:42:47  Agent-based
   Tags: provider=amazon,environment=production,datacenter=paris,ha_cluster=,application=sales,application_name=,criticity=,server=pg-sales-0249,

pg-sales-0616@:9342                                                              15.0       2023-05-12 14:42:51  Agent-based
   Tags: application_name=,criticity=,datacenter=paris,application=sales,environment=production,provider=amazon,ha_cluster=,server=pg-sales-0616,

pg-sales-3127@:9342                                                              15.2       2023-05-12 14:42:49  Agent-based
   Tags: application=sales,criticity=,ha_cluster=,provider=amazon,datacenter=paris,server=pg-sales-3127,application_name=,environment=production,

pg-sales-3928@:9342                                                              15.2       2023-05-12 14:42:52  Agent-based
   Tags: application_name=,criticity=,ha_cluster=,server=pg-sales-3928,datacenter=paris,environment=production,provider=amazon,application=sales,

pg-sales-5139@:9342                                                              15.1       2023-05-12 14:42:44  Agent-based
   Tags: datacenter=paris,ha_cluster=,application=sales,application_name=,provider=amazon,server=pg-sales-5139,criticity=,environment=production,

pg-cluster-01@:9342                                                              10.16      2023-05-12 14:42:49  Agent-based
   Tags: server=pg-cluster-01,provider=amazon,application=sales,ha_cluster=sales-app,application_name=,criticity=,environment=production,datacenter=paris,

pg-cluster-02@:9342                                                              10.16      2023-05-12 14:42:49  Agent-based
   Tags: application_name=,criticity=,datacenter=paris,ha_cluster=sales-app,provider=amazon,application=sales,server=pg-cluster-02,environment=production,

pg-cluster-03@:9342                                                              10.16      2023-05-12 14:42:51  Agent-based
   Tags: datacenter=paris,application_name=,criticity=,server=pg-cluster-03,environment=production,provider=amazon,application=sales,ha_cluster=sales-app,
```

{% endcode %}

## Dump

***

The script extracts roles, user settings, agentless connections, alert rules and outputs them in InfluxQL format.&#x20;

```bash
/datasentinel/soft/datasentinel_backend/scripts/dump_config.sh
```

{% hint style="info" %}
The script is run automatically by the daily backup script.
{% endhint %}

Separate **`dump*.txt`** files are created in the current directory.&#x20;

{% code title="Output" %}

```
This script extracts roles, user settings, agentless connections, alert rules and outputs them in InfluxQL format.

- 1 Roles saved in file dump_roles.txt

- 2 User Settings saved in file dump_user_settings.txt

- 9 Agentless Connections saved in file dump_agentless_connections.txt

- 1 Alert Rules saved in file dump_alert_rules.txt
```

{% endcode %}

{% hint style="info" %}
You can also specify a custom directory by providing the path as a parameter when executing the script.
{% endhint %}

You can then import one or multiple files into a different platform, for example.

{% code title="Example with curl" %}

```
curl -X POST 'http://localhost:8216/write?db=datasentinel' --data-binary @dump_user_settings.txt
```

{% endcode %}

{% hint style="success" %}
A successful execution of the curl command is indicated by it returning no result
{% endhint %}

{% hint style="warning" %}
When importing agentless connections, it is imperative to restart the `datasentinel_dispatcher` service
{% endhint %}

<table><thead><tr><th width="331">Configuration</th><th>Dump File</th></tr></thead><tbody><tr><td>Roles</td><td>dump_roles.txt</td></tr><tr><td>User Settings</td><td>dump_user_settings.txt</td></tr><tr><td>Agentless Connections</td><td>dump_agentless_connections.txt</td></tr><tr><td>Alert Rules</td><td>dump_alert_rules.txt</td></tr></tbody></table>

## **Agentless Method**

***

At Datasentinel, we offer an [Agentless approach](https://docs.datasentinel.io/manual/features/other-features/agentless-monitoring) to remotely connect with your PostgreSQL clusters. Our platform launches one or more internal agents (depending on the number of monitored instances) on the server to collect and transmit metrics to the backend. Configuration is performed directly via the UI or through the [API](https://docs.datasentinel.io/manual/implementation/platform-usage/api-reference/connection).

Additionally, we offer three scripts that list internal agents and their monitored connections.

### Remote Connections

This displays remote connections configured with the agentless mode

```bash
/datasentinel/soft/datasentinel_backend/scripts/agentless_connections.sh
```

{% code title="Output" %}

```
Datasentinel toolkit - All rights reserved                       www.datasentinel.io
====================================================================================================
Show the registered PostgreSQL connections in Agentless mode along with their latest metric upload time.

39 connection(s) registered

pg_instance                                                  port       user                 status               last upload(< 12h)
------------------------------------------------------------------------------------------------------------------------------------
51.15.143.45@agentLess0-1                                    9342       datasentinel         Enabled              2023-05-05 14:32:00
Tags : datacenter=dc1,provider=provider0,location=pg-sales-3127,ip=51.15.143.45

51.15.143.45@agentLess0-2                                    9342       datasentinel         Enabled              2023-05-05 14:32:00
Tags : datacenter=dc2,provider=provider0,location=pg-sales-3127,ip=51.15.143.45

51.15.143.45@agentLess0-3                                    9342       datasentinel         Enabled              2023-05-05 14:32:02
Tags : datacenter=dc3,provider=provider0,location=pg-sales-3127,ip=51.15.143.45

51.158.110.62@agentLess1-1                                   9342       datasentinel         Enabled              2023-05-05 14:32:01
Tags : datacenter=dc1,provider=provider1,location=pg-crm-4107,ip=51.158.110.62

51.158.110.62@agentLess1-2                                   9342       datasentinel         Enabled              2023-05-05 14:32:00
Tags : datacenter=dc2,provider=provider1,location=pg-crm-4107,ip=51.158.110.62

51.158.110.62@agentLess1-3                                   9342       datasentinel         Enabled              2023-05-05 14:32:02
Tags : datacenter=dc3,provider=provider1,location=pg-crm-4107,ip=51.158.110.62

51.158.70.115@agentLess10-1                                  9342       datasentinel         Enabled              2023-05-05 14:32:04
Tags : datacenter=dc1,provider=provider10,location=pg-sales-0249,ip=51.158.70.115

51.158.70.115@agentLess10-2                                  9342       datasentinel         Enabled              2023-05-05 14:32:01
Tags : datacenter=dc2,provider=provider10,location=pg-sales-0249,ip=51.158.70.115

51.158.70.115@agentLess10-3                                  9342       datasentinel         Enabled              2023-05-05 14:32:04
Tags : datacenter=dc3,provider=provider10,location=pg-sales-0249,ip=51.158.70.115

.../...
```

{% endcode %}

### Internal Agents

This displays the internal agents used by the agentless method.

```bash
/datasentinel/soft/datasentinel_backend/scripts/agentless_pool.sh
```

{% code title="Output" %}

```
Datasentinel toolkit - All rights reserved                       www.datasentinel.io
====================================================================================================
The internal agent-based technique is utilized in the agentless method.
Below is a summary list that showcases the agents, their monitored port, and the number of instances they monitor.

Internal agents : 4

Listening            Start                OS                         Connections               Used
Port                 Time                 Pid             Alive      Running      Not running  Memory (MB)     last upload(< 12h)
------------------------------------------------------------------------------------------------------------------------------------
13331                2023-05-05 14:10:01  8093            True       10           0            82              2023-05-05 14:34:00
13332                2023-05-05 14:17:28  8649            True       10           0            77              2023-05-05 14:34:00
13333                2023-05-05 14:30:03  11010           True       10           0            79              2023-05-05 14:34:00
13334                2023-05-05 14:30:24  11197           True       9            0            70              2023-05-05 14:34:00
```

{% endcode %}

### Internal Agents and Connections

This displays both the internal agents used by the Agentless method, and their associated connections.

```bash
/datasentinel/soft/datasentinel_backend/scripts/agentless_pool_and_connections.sh
```

{% code title="Output" %}

```
Datasentinel toolkit - All rights reserved                       www.datasentinel.io
====================================================================================================
The internal agent-based technique is utilized in the agentless method.
Below is a list that showcases the agents and their monitored instances.

Internal agents : 4

Listening            Start                OS                         Connections               Used
Port                 Time                 Pid             Alive      Running      Not running  Memory (MB)     last upload(< 12h)
------------------------------------------------------------------------------------------------------------------------------------
13331                2023-05-05 14:10:01  8093            True       10           0            82              2023-05-05 14:35:00

         Instances                                                    port       user                 status               last upload(< 12h)
         ------------------------------------------------------------------------------------------------------------------------------------
         51.15.143.45@agentLess0-1                                    9342       datasentinel         Enabled              2023-05-05 14:35:11
            Tags : datacenter=dc1,provider=provider0,location=pg-sales-3127,ip=51.15.143.45

         51.158.110.62@agentLess1-1                                   9342       datasentinel         Enabled              2023-05-05 14:35:12
            Tags : datacenter=dc1,provider=provider1,location=pg-crm-4107,ip=51.158.110.62

         51.15.208.226@agentLess2-1                                   9342       datasentinel         Enabled              2023-05-05 14:35:12
            Tags : datacenter=dc1,provider=provider2,location=pg-crm-3108,ip=51.15.208.226

         163.172.166.231@agentLess3-1                                 9342       datasentinel         Enabled              2023-05-05 14:35:14
            Tags : datacenter=dc1,provider=provider3,location=pg-sales-3928,ip=163.172.166.231

         51.15.212.183@agentLess4-1                                   9342       datasentinel         Enabled              2023-05-05 14:35:14
            Tags : datacenter=dc1,provider=provider4,location=pg-sales-5139,ip=51.15.212.183

         212.47.242.87@agentLess5-1                                   9342       datasentinel         Enabled              2023-05-05 14:35:15
            Tags : datacenter=dc1,provider=provider5,location=pg-sales-0616,ip=212.47.242.87

         51.15.215.2@agentLess6-1                                     9342       datasentinel         Enabled              2023-05-05 14:35:16
            Tags : datacenter=dc1,provider=provider6,location=pg-crm-4529,ip=51.15.215.2

         51.15.233.24@agentLess7-1                                    9342       datasentinel         Enabled              2023-05-05 14:35:17
            Tags : datacenter=dc1,provider=provider7,location=pg-sales-5315,ip=51.15.233.24

         51.158.125.244@agentLess8-1                                  9342       datasentinel         Enabled              2023-05-05 14:35:18
            Tags : datacenter=dc1,provider=provider8,location=pg-crm-2207,ip=51.158.125.244

         51.158.69.223@agentLess9-1                                   9342       datasentinel         Enabled              2023-05-05 14:35:09
            Tags : datacenter=dc1,provider=provider9,location=pg-crm-2031,ip=51.158.69.223

Listening            Start                OS                         Connections               Used
Port                 Time                 Pid             Alive      Running      Not running  Memory (MB)     last upload(< 12h)
------------------------------------------------------------------------------------------------------------------------------------
13332                2023-05-05 14:17:28  8649            True       10           0            77              2023-05-05 14:35:00

         Instances                                                    port       user                 status               last upload(< 12h)
         ------------------------------------------------------------------------------------------------------------------------------------
         51.15.143.45@agentLess0-2                                    9342       datasentinel         Enabled              2023-05-05 14:35:19
            Tags : datacenter=dc2,provider=provider0,location=pg-sales-3127,ip=51.15.143.45

         51.158.110.62@agentLess1-2                                   9342       datasentinel         Enabled              2023-05-05 14:35:09
            Tags : datacenter=dc2,provider=provider1,location=pg-crm-4107,ip=51.158.110.62

         51.158.70.115@agentLess10-1                                  9342       datasentinel         Enabled              2023-05-05 14:35:14
            Tags : datacenter=dc1,provider=provider10,location=pg-sales-0249,ip=51.158.70.115

         51.158.104.206@agentLess11-1                                 9342       datasentinel         Enabled              2023-05-05 14:35:15
            Tags : datacenter=dc1,provider=provider11,location=pg-crm-0926,ip=51.158.104.206

         51.15.130.69@agentLess12-1                                   9342       datasentinel         Enabled              2023-05-05 14:35:16
            Tags : datacenter=dc1,provider=provider12,location=pg-customer-2815,ip=51.15.130.69

         51.15.208.226@agentLess2-2                                   9342       datasentinel         Enabled              2023-05-05 14:35:10
            Tags : datacenter=dc2,provider=provider2,location=pg-crm-3108,ip=51.15.208.226

.../...
```

{% endcode %}

## Troubleshooting

Consult the available troubleshooting scripts for diagnostic guidance.

{% content-ref url="../troubleshooting/platform-diagnostics-tools" %}
[platform-diagnostics-tools](https://docs.datasentinel.io/manual/implementation/troubleshooting/platform-diagnostics-tools)
{% endcontent-ref %}

<br>
