Add missing error handling

This commit is contained in:
Conrad Hoffmann 2023-03-13 17:02:33 +01:00
parent 3f9993a9b2
commit 9b3ecbaf0c
1 changed files with 8 additions and 0 deletions

View File

@ -61,7 +61,15 @@ func (c ChassisCollector) Args() []string {
func (c ChassisCollector) Collect(result freeipmi.Result, ch chan<- prometheus.Metric, target ipmiTarget) (int, error) {
currentChassisPowerState, err := freeipmi.GetChassisPowerState(result)
if err != nil {
level.Error(logger).Log("msg", "Failed to collect chassis data", "target", targetName(target.host), "error", err)
return 0, err
}
currentChassisDriveFault, err := freeipmi.GetChassisDriveFault(result)
if err != nil {
level.Error(logger).Log("msg", "Failed to collect chassis data", "target", targetName(target.host), "error", err)
return 0, err
}
currentChassisCoolingFault, err := freeipmi.GetChassisCoolingFault(result)
if err != nil {
level.Error(logger).Log("msg", "Failed to collect chassis data", "target", targetName(target.host), "error", err)