Health: device observability at scale
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.

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.

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 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?

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.

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.
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.


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.
Member of the Nerves core team. 10x talker in the Elixir community and Edge disruptor on LinkedIn.



