Add better error logging on smartctl exec failure

We will now log a warning if smartctl path passed via command line is invalid.

Signed-off-by: Piotr Dobrowolski <admin@tastycode.pl>
This commit is contained in:
Piotr Dobrowolski 2024-07-14 20:30:32 +02:00
parent 2cc2249821
commit 1c9c6943e8

View file

@ -85,6 +85,9 @@ func readSMARTctlDevices(logger log.Logger) gjson.Result {
level.Warn(logger).Log("msg", "S.M.A.R.T. output reading error", "err", err)
return gjson.Result{}
}
} else if err != nil {
level.Warn(logger).Log("msg", "S.M.A.R.T. output reading error", "err", err)
return gjson.Result{}
}
return parseJSON(string(out))
}