# Device fleet monitoring

> How to keep a fleet of guard devices working with Vigil. Track battery, signal, charging and location for every device, and have an agent flag problems.

Source: https://vigilsecure.net/docs/examples/device-fleet-monitoring/

**The scenario.** You have forty devices across twenty sites. A device that is flat, lost
or left in a drawer means a guard with no patrols and no way to reach the control room, and
you usually find out too late.

## How Vigil represents it

| The real world                          | In Vigil                                                                               |
| --------------------------------------- | -------------------------------------------------------------------------------------- |
| A handset                               | A [device](https://vigilsecure.net/docs/concepts/devices.md), identified by its serial number and named by you  |
| "Is it working?"                        | The device's **status**: last report, battery, signal, location and app version        |
| What happened to it                     | The device's **event log**: sign-ins, charger on and off, Wi-Fi, movement, app updates |
| How it has been doing                   | The device's **state log**: battery and signal charts and its track on a map           |
| The daily check                         | An [agent](https://vigilsecure.net/docs/concepts/agents.md) with a schedule                                     |
| "Tell me when a device leaves or joins" | An agent **trigger** on device linked and unlinked                                     |

Every device reports its battery, signal and position every ten minutes, and records events
as they happen, with no action from the guard.

## Check a device yourself

Open **Infrastructure → Devices** and choose a device.

- **Status** shows the signed-in user, battery, signal and location now. A device that has
  missed its reports shows **Silent for** and how long.
- **Events** answers "when was it last on a charger?" and "who had it on Tuesday night?".
- **State log** shows the battery draining and charging over the past 24 hours or 7 days,
  and where the device went.

The [Overview](https://vigilsecure.net/docs/concepts/overview.md) map shows every device at once. Devices that have
not reported in the past hour are drawn faded.

## Have an agent watch the fleet

Give an agent the job, with a role that can view devices and see device locations:

```text
Every day at 17:00, before the night shift, check all our devices and tell me in our chat
about any that:
- have not reported for more than an hour,
- have a battery below 30% and are not on a charger,
- are more than a kilometre from every site,
- are running an older app version than the rest.

List them by name with the problem and the last time they reported. If everything is
fine, say so in one line.

When a device is linked to or unlinked from our organization, tell me.
```

Then message the agent once: "Set up your schedule and triggers from your instructions."
The first part becomes a schedule and the last line a trigger, which wakes the agent when
the change happens. Both are created by the agent itself, so nothing happens until you ask.

## What it looks like

**17:00.** The agent posts in your chat:

> 3 of 40 devices need attention before tonight.
> Depot gate: silent since 09:12, last battery 4%.
> Clinic patrol: battery 22%, not charging.
> Mall gate 2: 6 km from any site, last seen on the N3 at 16:40.

You phone the depot about the charger, and ask the agent a follow-up: "Who was signed in on
Mall gate 2 when it left the mall?"

## Good habits

- **Name every device** after where it lives: `Rosebank gate`, `Depot patrol`. A serial
  number means nothing at two in the morning.
- **Keep devices on site** with a charger at the post. The event log shows whether they are
  being charged.
- **Unlink devices you retire or send for repair**, so they do not show as silent.
- **Limit who can see locations.** The **See device locations** permission is separate from
  viewing devices, and by default only admins and owners have it.

## Related

- [Devices](https://vigilsecure.net/docs/concepts/devices.md)
- [Guard check-ins](https://vigilsecure.net/docs/examples/guard-check-ins.md)
