We love IoT and edge at Netdata, we also love machine learning. Even better if we can combine the two to ease the pain of monitoring increasingly complex systems.
We recently explored what might be involved in enabling our Python-based anomalies collector on a Raspberry Pi. To our delight, it's actually quite straightforward!
Read on to learn all the steps and enable unsupervised anomaly detection on your on Raspberry Pi(s).
Spoiler: It's just a couple of extra commands that will make you feel like a pro.
- A Raspberry Pi running Raspbian, which we'll call a node.
- The open-source Netdata monitoring agent. If you don't have it installed on your node yet, get started now.
First make sure Netdata is using Python 3 when it runs Python-based data collectors.
Next, install some of the underlying libraries used by the Python packages the collector depends upon.
Now you're ready to install the Python packages used by the collector itself. First, become the
Then pass in the location to find
llvm as an environment variable for
Now you're ready to enable the collector and restart Netdata.
And that should be it! Wait a minute or two, refresh your Netdata dashboard, you should see the default anomalies charts under the Anomalies section in the dashboard's menu.
Of course one of the most important considerations when trying to do anomaly detection at the edge (as opposed to in a centralized cloud somewhere) is the resource utilization impact of running a monitoring tool.
With the default configuration, the anomalies collector uses about 6.5% of CPU at each run. During the retraining step, CPU utilization jumps to between 20-30% for a few seconds, but you can configure retraining to happen less often if you wish.
In terms of the runtime of the collector, it was averaging around 250ms during each prediction step, jumping to about 8-10 seconds during a retraining step. This jump equates only to a small gap in the anomaly charts for a few seconds.
The last consideration then is the amount of RAM the collector needs to store both the models and some of the data during training. By default, the anomalies collector, along with all other running Python-based collectors, uses about 100MB of system memory.
So, all in all, with a small little bit of extra set up and a small overhead on the Pi itself, the anomalies collector looks like a potentially useful addition to enable unsupervised anomaly detection on your Pi.
See our two-part guide series for a more complete picture of configuring the anomalies collector, plus some best practices on using the charts it automatically generates:
If you're using your Raspberry Pi for other purposes, like blocking ads/trackers with Pi-hole, check out our companions Pi guide: Monitor Pi-hole (and a Raspberry Pi) with Netdata.
Once you've had a chance to give unsupervised anomaly detection a go, share your use cases and let us know of any feedback on our community forum.