@@ -123,7 +123,7 @@ func (sm *Smart) FromCollectorSmartInfo(cfg config.Interface, wwn string, info c
123123 } else if sm .DeviceProtocol == pkg .DeviceProtocolNvme {
124124 sm .ProcessNvmeSmartInfo (info .NvmeSmartHealthInformationLog )
125125 } else if sm .DeviceProtocol == pkg .DeviceProtocolScsi {
126- sm .ProcessScsiSmartInfo (info .ScsiGrownDefectList , info .ScsiErrorCounterLog )
126+ sm .ProcessScsiSmartInfo (info .ScsiGrownDefectList , info .ScsiErrorCounterLog , info . ScsiEnvironmentalReports )
127127 }
128128
129129 return nil
@@ -200,8 +200,10 @@ func (sm *Smart) ProcessNvmeSmartInfo(nvmeSmartHealthInformationLog collector.Nv
200200}
201201
202202// generate SmartScsiAttribute entries from Scrutiny Collector Smart data.
203- func (sm * Smart ) ProcessScsiSmartInfo (defectGrownList int64 , scsiErrorCounterLog collector.ScsiErrorCounterLog ) {
203+ func (sm * Smart ) ProcessScsiSmartInfo (defectGrownList int64 , scsiErrorCounterLog collector.ScsiErrorCounterLog , temperature map [ string ]collector. ScsiTemperatureData ) {
204204 sm .Attributes = map [string ]SmartAttribute {
205+ "temperature" : (& SmartNvmeAttribute {AttributeId : "temperature" , Value : getScsiTemperature (temperature ), Threshold : - 1 }).PopulateAttributeStatus (),
206+
205207 "scsi_grown_defect_list" : (& SmartScsiAttribute {AttributeId : "scsi_grown_defect_list" , Value : defectGrownList , Threshold : 0 }).PopulateAttributeStatus (),
206208 "read_errors_corrected_by_eccfast" : (& SmartScsiAttribute {AttributeId : "read_errors_corrected_by_eccfast" , Value : scsiErrorCounterLog .Read .ErrorsCorrectedByEccfast , Threshold : - 1 }).PopulateAttributeStatus (),
207209 "read_errors_corrected_by_eccdelayed" : (& SmartScsiAttribute {AttributeId : "read_errors_corrected_by_eccdelayed" , Value : scsiErrorCounterLog .Read .ErrorsCorrectedByEccdelayed , Threshold : - 1 }).PopulateAttributeStatus (),
@@ -224,3 +226,12 @@ func (sm *Smart) ProcessScsiSmartInfo(defectGrownList int64, scsiErrorCounterLog
224226 }
225227 }
226228}
229+
230+ func getScsiTemperature (s map [string ]collector.ScsiTemperatureData ) int64 {
231+ temp , ok := s ["temperature_1" ]
232+ if ! ok {
233+ return 0
234+ }
235+
236+ return temp .Current
237+ }
0 commit comments