> For the complete documentation index, see [llms.txt](https://wiki.datadike.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://wiki.datadike.com/sonar/get-started/architecture.md).

# Architecture and components

The parts SONAR is made of, on the server and on each endpoint, how a command travels to a device and back, and what stops working when one part is down.

SONAR has two halves. On the **server**, operated by DataDike, a set of services holds the data, serves the console and talks to the devices. On each **endpoint**, one or more services installed by the agent installer keep a connection to the server, report on the computer, and carry out what the console asks for.

Knowing which part does what turns "SONAR is not working" into "remote desktop is down on this computer, everything else answers".

{% hint style="info" %}
This page is about the software that runs the product. The objects you manage — clients, sites, devices, policies — are in [Core concepts](https://wiki.datadike.com/sonar/get-started/core-concepts.md). Installing agents belongs to Deploy and operate.
{% endhint %}

## The components

### On the server

| Component                 | What it does                                                                                                                                                                                                                                                                                                                  |
| ------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Console**               | The web application you log in to. Everything you see and do in SONAR goes through it                                                                                                                                                                                                                                         |
| **API**                   | Serves the console and your integrations, authenticates every request, records changes in the audit trail, and receives the data agents send over HTTPS: check results, task results, script output, installed software, Windows updates, user activity                                                                       |
| **Messaging service**     | Holds one persistent connection per agent. Commands travel to the device over it, and the agent's heartbeat and inventory reports travel back, to be written to the database as they arrive                                                                                                                                   |
| **Task service**          | Runs the scheduled and background work: availability alerts and notifications, bulk actions, delivery of automated tasks to Windows computers, scheduled tasks on Linux and macOS, patch approval and installation schedules, automatic agent updates, distribution of access policies, and the figures behind the dashboards |
| **Remote access service** | Carries remote desktop, remote terminal and file transfer sessions to the remote access agent on each device, and provides wake-on-LAN and the power history shown in the **Uptime** tab                                                                                                                                      |
| **Database**              | Holds the configuration, the inventory, the history and the audit trail                                                                                                                                                                                                                                                       |

These services run on the server that DataDike operates for you. How they are sized, backed up and updated is set up with DataDike implementation support.

### On the endpoint

| Component               | Platforms             | Service name on the computer                                                     | What it does                                                                                                                                                                                                                               |
| ----------------------- | --------------------- | -------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **SONAR agent**         | Windows, Linux, macOS | `sonarrmm` (**Sonar Agent Service**) on Windows; `sonaragent` on Linux and macOS | Registers the computer, sends a heartbeat and inventory, runs checks, commands, scripts and tasks, scans for and installs Windows updates, and updates itself                                                                              |
| **Remote access agent** | Windows, Linux, macOS | **Mesh Agent**                                                                   | Serves remote desktop, remote terminal and file transfer sessions. Installed by the agent installer                                                                                                                                        |
| **Productivity module** | Windows               | `SonarProductivityService` (**Sonar Productivity Service**)                      | Records logon sessions, the applications and websites in use, and idle time, and enforces the access policies on the computer: blocks a logon outside the allowed window, warns before a session ends, and signs the user out when it does |

Every connection is opened **from the endpoint to the server**, over HTTPS on port 443: the agent to the API address, and the remote access agent to the remote access address. Nothing on the network has to reach into the endpoint. See [Network requirements](https://wiki.datadike.com/sonar/deploy-operate/network-requirements.md).

## How a command reaches a device

Running a command on one device, from the **Send Command** action of the device panel:

1. **You submit the command in the console.** The API checks that your role grants the permission and gives you access to that device's client and site.
2. **The API writes a line in the device's History tab** and hands the command to the messaging service, addressed to that one agent.
3. **The messaging service delivers it** over the connection the agent keeps open. The agent runs the command in its own process.
4. **The agent replies** over the same connection, and also sends the output to the API, which stores it against the History line.
5. **The console shows the output** and the audit trail records who ran what, on which device.

A script follows the same path. A bulk action from the **Tools** menu differs in one respect: the API does not wait for the devices. It queues the job, the task service sends it to every selected agent at once, and each device's output arrives in its own **History** tab as it finishes.

Scheduled work runs the other way round. The agent asks the API, on its own schedule, which checks are due and sends back each result. Automated tasks on Windows are written into the computer's own task scheduler, which starts them at the planned time; on Linux and macOS, the task service starts them. In both cases the result comes back to the API and shows in the device's tabs.

## When a device is offline

A device's status is the age of its last heartbeat, which the agent sends about once a minute while it is connected. There is no separate "disconnected" signal: a device that stops reporting keeps its last status until the offline threshold passes. The thresholds are in [Core concepts](https://wiki.datadike.com/sonar/get-started/core-concepts.md#device-status).

What that means for the work you send:

| You send                                                                    | While the device is offline                                                                                                                                                                             |
| --------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| A command, a script, a reboot, a shutdown, a process list, a service action | Needs the agent connected. A single-device action fails with a message such as `Unable to contact the agent`. A bulk action is sent once; a device that is offline at that moment does not run it later |
| Checks                                                                      | The agent fetches the checks that are due when it runs its next cycle, so they resume on their own when the device is back                                                                              |
| Automated tasks for Windows                                                 | Created, changed or removed on the computer the next time it is online. Tasks already on the computer keep their schedule                                                                               |
| Access policies                                                             | Held for the device. The productivity module receives the current version when it reconnects, applies it, and confirms it                                                                               |
| Remote desktop, terminal, file transfer                                     | Needs the remote access agent connected, shown as **Remote Online** in the device panel                                                                                                                 |

## What stops when a part is unavailable

| Unavailable                         | What stops                                                                                                                                                                                                               | What keeps working                                                                                                                                                    |
| ----------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Console or API**                  | The console, the integrations, and everything agents send over HTTPS: results, script output, inventory updates                                                                                                          | The agents keep running on the computers                                                                                                                              |
| **Messaging service**               | Commands, scripts, reboots, process, service and event log views, check runs on demand. Heartbeats stop being recorded, so devices move to offline once the threshold passes                                             | Remote desktop, terminal and file transfer, which use the remote access service                                                                                       |
| **Task service**                    | Availability alerts and email or SMS notifications, bulk actions, automatic agent updates, patch schedules, Linux and macOS scheduled tasks, delivery of access policy changes, and the refresh of the dashboard figures | Actions on a single device from its panel, which go straight through the API                                                                                          |
| **Remote access service**           | Remote desktop, remote terminal, file transfer, wake-on-LAN, the **Uptime** tab                                                                                                                                          | Everything that goes through the agent                                                                                                                                |
| **Database**                        | Everything                                                                                                                                                                                                               | Nothing on the server side                                                                                                                                            |
| **SONAR agent on a device**         | That device stops reporting and accepting commands, and goes offline                                                                                                                                                     | Remote desktop may still answer if the remote access agent is running                                                                                                 |
| **Remote access agent on a device** | Remote desktop, terminal and file transfer for that device. The panel shows **Remote Offline**                                                                                                                           | Everything that goes through the SONAR agent. With the agent online, **Restart Remote Service** in the device panel asks the agent to restart the remote access agent |
| **Productivity module on a device** | User activity for that computer, and enforcement of access policies on it                                                                                                                                                | Everything that goes through the SONAR agent                                                                                                                          |

## Why some figures lag

Screens that summarise the whole fleet do not count devices each time you open them. The task service calculates those figures in the background, and the **Home** dashboard cards are recalculated every five minutes. A device that has just come online appears in the **Sysadmin** device list as soon as you reload it, and in the Home counts within a few minutes.

## Common errors

| Symptom                                                                                | Cause                                                                                     | Fix                                                                                                                                |
| -------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
| `Unable to contact the agent` when sending a command                                   | The agent is not connected to the messaging service                                       | Check **Agent Status** and **Last Response**. If the device is off or offline, wait for it to come back; the command is not queued |
| A bulk action reports that it will run, but some devices have no result in **History** | Those devices were offline when the job was sent                                          | Run the action again on those devices once they are online                                                                         |
| **Take Control** is disabled and the panel shows **Remote Offline**                    | The remote access agent on the device is not connected                                    | If the device is online, use **Restart Remote Service**; otherwise wait for the device to return                                   |
| The device list shows a device as online, but it was switched off an hour ago          | The status is the age of the last heartbeat, and the offline threshold has not passed yet | Read **Last Response**, which shows the actual time of the last contact                                                            |
| A new device is in the device list but not yet in the Home counts                      | The Home figures are recalculated every five minutes                                      | Wait a few minutes and refresh the Home dashboard                                                                                  |

## Related pages

* [Core concepts](https://wiki.datadike.com/sonar/get-started/core-concepts.md) — the objects the components act on
* [A tour of the console](https://wiki.datadike.com/sonar/get-started/console-tour.md) — where each screen lives
* [Network requirements](https://wiki.datadike.com/sonar/deploy-operate/network-requirements.md) — what the endpoints must be able to reach
* [The productivity module](https://wiki.datadike.com/sonar/deploy-operate/productivity-module.md)
* [Troubleshoot agents](https://wiki.datadike.com/sonar/deploy-operate/troubleshooting.md)
