All posts

Health: device observability at scale

Lars Wikman
Founder and Core Committer · · 8 min read

When you set up a Nerves device with NervesHub, you can have it report health data: metrics for the values we can pull off the board. The defaults are the usual memory, CPU, disk, network usage and load average. That's the starting point.

These are reported at an interval and we keep a time-limited history for you. That lets you see whether an update made CPU usage go up or down, or why a device might have rebooted. If the reboot follows memory rising over a long period, you probably have a memory leak. Typical, useful metrics stuff.

A day of CPU, memory, disk and temperature charts for one device, with warning and alert thresholds drawn across each chart A day of CPU, memory, disk and temperature charts for one device, with warning and alert thresholds drawn across each chart
A day of history for one device. The CPU temperature and cold room charts cross their alert lines in the last hour.

It gets more interesting when you add your own metrics. Does your device have a battery backup and a solar panel, like the construction cameras Evercam ships? And a separate disk for footage? Best track its usage. Evercam also use network identities for VPN access and more. They use the platform well, and there is still more they could do that I'll hassle them about. Customer success, it's called. They could pull drive stats to track drive health, for one. I'm not sure they report dropped frames yet. Things like that.

The device health view showing CPU, memory, disk, CPU temperature, load average and a custom cold room temperature metric, with an active alarm The device health view showing CPU, memory, disk, CPU temperature, load average and a custom cold room temperature metric, with an active alarm
Custom metrics, like this cold room temperature, sit next to the built-in ones.

You can then set up your own health profiles for your product. We ship defaults that are rough guesses at typically risky levels, but you know your product. If it lives its life at 90% CPU because it has work to do, you probably don't want that flagged. For other devices, staying over 10% CPU for an hour means something is weird. Our customers span many industries and their devices do very different jobs. The profile is how you turn numbers over time into a signal the platform can use to help you.

The health profile settings with warning and unhealthy thresholds and measurement periods per metric, and a bar showing how many devices are healthy, in warning or unhealthy right now The health profile settings with warning and unhealthy thresholds and measurement periods per metric, and a bar showing how many devices are healthy, in warning or unhealthy right now
A health profile. The bar at the top shows how the fleet looks against these thresholds right now.

The Insights page shows which devices are in a warning or unhealthy state according to these profiles. In an industrial fleet of 10 high-value devices, a single unhealthy one is a concern. In a fleet of 100,000 devices, statistically something will always be weird, wrong or broken. Then it is more about the numbers. Which issues point to a systemic problem?

The Insights page with bars for connection, health and firmware across a fleet of 54 devices, and a check for whether unhealthy devices cluster on one firmware version The Insights page with bars for connection, health and firmware across a fleet of 54 devices, and a check for whether unhealthy devices cluster on one firmware version
Insights breaks the fleet down by connection, health and firmware, and checks whether unhealthy devices cluster on one version.

You can filter devices by status to find the ones to investigate. On a single device, the health view shows when it crossed the thresholds in its profile. Was it after that update? Has it been offline a lot? Has it been rebooting? We try to give you as much information as possible, whether it is for you, for an agent or for some other automated system. We aren't too particular. We just want to help you act when something in your fleet goes wrong.

The devices list filtered to devices that need attention, each showing why it is unhealthy, with one device open in a side panel The devices list filtered to devices that need attention, each showing why it is unhealthy, with one device open in a side panel
Filtering to the devices that need attention, each with the reason it was flagged.

Josh has been reworking a lot of the UI, and that work includes one change I'd call game-changing: serious mobile support. Being able to check on devices on the move is a blessing when you're on site at a large installation. Did the device come up right after the install? Did the new configuration take? If you use NervesHub and think a mobile app is in order too, let us know. Right now we mostly plug into the platforms you already use: Slack, Teams, Discord and custom webhooks.

The device health view on a phone The device health view on a phone Device health history charts on a phone Device health history charts on a phone

Next on the horizon is bringing health into deployment workflows. Right now a workflow can gate on your canaries coming back from an update. We also want a gate for them coming back healthy. By what definition of healthy? Yours. Your profile.

We have taken a lot of care to make health reporting scale and hold up when a fleet misbehaves. For the extensions where it makes sense, health included, the server requests data from the device. That means we can ask less often if reporting ever threatens the more critical parts, such as firmware updates. You (and by extension we) can also turn off extensions for a fleet where something is misbehaving. Many of the nice features are extensions because they matter less than being able to ship an update. In a bad scenario you want to disable anything extraneous that could distract a device from updating. And you can.

We also have error reporting. It isn't necessarily there to replace Sentry or whatever you use, but reporting every device error to Sentry can blow your budget quickly on a large fleet. It is also useful to have one view of the errors across your fleet, and to look at a device's errors next to its health.

The Errors page listing open error issues for a product, each with a 14-day trend, event and device counts, and the firmware version it was last seen on The Errors page listing open error issues for a product, each with a 14-day trend, event and device counts, and the firmware version it was last seen on
Errors from across the fleet, grouped into issues.
One error issue: first seen on firmware 2.4.2, 64 events on 9 devices, events per day rising over the last few days, the devices hit most and the latest stack trace One error issue: first seen on firmware 2.4.2, 64 events on 9 devices, events per day rising over the last few days, the devices hit most and the latest stack trace
One issue: new in 2.4.2, the devices it hits most, and the latest stack trace with uptime and free memory.

Several other extensions don't fall under health. Geo-location, logging and network identity all make life on the platform more pleasant, as powerful features or as conveniences.

For additional observability on devices I also suggest you check out Mobius. I did not build this on-device metrics machinery but I have improved it and do maintain it. It stores metrics in as compact a way as possible on device while being respectful of your flash storage and managing granularity over time to save on memory and disk usage. There is also a relatively new histogram feature which I think is genuinely very cool using DataDog's DDSketch to keep compact histograms with control of the accuracy versus storage size tradeoff. The local-first of device metrics.

The core of what we do is firmware updates. Health is a piece Josh and I have worked heavily on, to bring it into NervesHub and really flesh it out. There is another thing we consider a pillar of the service, closely related to health but quite separate, that we should probably share more about. Support.

Thanks for reading.

Lars Wikman
Founder and Core Committer

Member of the Nerves core team. 10x talker in the Elixir community and Edge disruptor on LinkedIn.

Put your fleet's health front and center

Connect your first device in minutes.

The Hobby plan is free forever. No credit card, no sales call.