# Detection & Response troubleshooting

> What to check when a device shows no alerts, a sensor shows disconnected, a configuration hasn't reached a device, or a response failed.

Most problems come down to one question: is the device connected, and is its sensor reporting? Start with the
device's status in the sensors list:

```sh
curl https://foobar.cvyuh.com/api/v0/endpoint/dar/v1/agents \
  -H "Cookie: x-cvyuh-token=$CVYUH_SESSION" \
  -H "Content-Type: application/json" \
  -d '{"page": 1, "pageSize": 20, "qbe": {"filter": {"field": "name", "op": "=", "value": "maya-laptop"}}}'
```

| Status | What it means |
|---|---|
| `active` | Connected and reporting |
| `disconnected` | Has reported before, but isn't connected now |
| `pending` | Connecting for the first time |
| `never` | Registered at enrollment, but has never connected |

## Before you begin

- **Who:** an administrator of the realm, in a group holding `RealmOwner` or `RealmViewer` on the realm or a realm
  above it. Fixes that act on a device (restart, configuration) need `RealmOwner`.
- **Where:** the API.

## A device shows no alerts

| Cause | How to tell | Fix |
|---|---|---|
| Nothing happened | The device is `active` and its stats (`GET .../agents/{agent}/stats`) show events read | Nothing to fix: a quiet device raises nothing |
| The range is wrong | Alerts appear when you widen it | Set `from` and `to`; left out, the range is the last day |
| The device isn't connected | Status `disconnected` or `never` | See the next section |
| The events match no rule | The log is read (in its stats) but nothing is raised | Expected: only lines that match a rule become alerts; your own rules are [planned](../detection/whats-next/#custom-detection-rules) |
| The alerts are older than 30 days | They were deleted | Export alerts you need to keep before 30 days |
| You're calling another realm | The call went to a different realm's host name | Call the device's realm: each call answers for one realm |

## A sensor shows disconnected or never

| Cause | How to tell | Fix |
|---|---|---|
| The device is off or offline | [Health and actions](../../endpoint-management/devices/health-and-actions/) says it isn't connected | Bring it back online; its waiting events are sent when it reconnects |
| The device is revoked | Its record shows it revoked | Expected; see [Device revocation](../../endpoint-management/revoke-and-remove/revocation/) |
| The device client isn't running | The device is on the network but not connected | Start the device client on the device (see [Device client](../../endpoint-management/enrollment/device-client/)) |
| The sensor was removed | It's gone from the sensors list | Enroll the device again |

## A configuration hasn't reached a device

| Cause | How to tell | Fix |
|---|---|---|
| The device is offline | Status isn't `active` | It gets the configuration when it reconnects |
| It hasn't reloaded yet | Under two minutes since the write | Wait, then read its `configuration/files` or `configuration/logs` again |
| The folder didn't exist when the sensor started | The folder is in the configuration but reports only at scans | Create the folder, then restart the sensor ([Sensor actions](../sensors/sensor-actions/)) |
| The write was refused | It answered `400`, `412` or `413` | See [Group configuration](../sensors/group-configuration/#what-happens-when-it-fails) |

## A response failed, or didn't take effect

| Symptom | Cause | Fix |
|---|---|---|
| In `failed`, the sensor isn't active | The device is offline; nothing is queued | Send again once it's `active` |
| In `failed`, `not an agent of this realm` | The id isn't your realm's | Check the id in the sensors list |
| `400` | The response, argument or timeout isn't one the realm takes | See [Active response](../response/active-response/#what-happens-when-it-fails) |
| `done`, but nothing changed | The device runs macOS, where responses have no effect; or the service ignores Deny a host | Use Block an IP address, on Linux devices |
| A response needs lifting early | There's no early undo | Wait for its timeout |

## A sensor upgrade failed

Upgrading a sensor from the realm isn't working yet: the device refuses it. Install the new device package on the
device instead (see [Sensor actions](../sensors/sensor-actions/#upgrading-a-sensor)).

## A call answers 403 or 502

- **`403`:** your session's user doesn't administer the realm. Ask for `RealmOwner` or `RealmViewer` on it (see
  [Delegated administration](../../platform/realms/delegated-administration/)).
- **`502`:** the security log couldn't answer just then. Try again; if it persists, contact whoever runs your
  deployment.

## Related

- [Device view](../security-log/device-view/): one device's status, configuration and counters.
- [Security events](../security-log/events/): searching alerts, and their errors.
- [Sensor actions](../sensors/sensor-actions/): restart a sensor.
