Skip to content

Commit

Permalink
Add better error logging on smartctl exec failure
Browse files Browse the repository at this point in the history
We will now log a warning if smartctl path passed via command line is invalid.

Signed-off-by: Piotr Dobrowolski <admin@tastycode.pl>
  • Loading branch information
Informatic committed Jul 14, 2024
1 parent 2cc2249 commit 1c9c694
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions readjson.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
Expand Down

0 comments on commit 1c9c694

Please sign in to comment.