Backend will add invalid data to the database if smartctl returns a json-formatted error
Author: kaysondCreated Feb 27, 2026Updated Feb 28, 2026
Labelscontributor friendlygo
smartctl will return a non-zero exit code under a number of conditions, defined in their source here.
If the collector gets a non-zero exit code for a smartctl --xall, it will still send the data to the backend:
which will happily unmarshall it into our model and push it (with a bunch of uninitialized struct fields) into the database:
We should update the exit_status field in our model to match the bitmask from the smartctl source:
and in the backend handler shown above, skip pushing data if any of bits 2-0 are set.
Note that some error codes are shared! Smartctl exits 2 for a variety of reasons including a drive being in standby.
Source: AnalogJ/scrutiny