Skip to content

Conversation

@trim21
Copy link

@trim21 trim21 commented Oct 28, 2025

should close #717

scsi smart looks like this:

  "scsi_environmental_reports": {
    "temperature_1": {
      "parameter_code": 0,
      "current": 31,
      "lifetime_maximum": 41,
      "lifetime_minimum": 20,
      "maximum_since_power_on": 36,
      "minimum_since_power_on": 27
    }
  },

Copilot AI review requested due to automatic review settings October 28, 2025 16:22
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for SAS (SCSI) device temperature monitoring by extracting temperature data from SCSI environmental reports and exposing it as a temperature attribute in the smart monitoring system.

  • Adds ScsiTemperatureData struct to capture SCSI temperature information
  • Updates ProcessScsiSmartInfo to accept and process temperature data from environmental reports
  • Implements getScsiTemperature helper function to extract primary temperature reading

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
webapp/backend/pkg/models/collector/smart.go Adds ScsiEnvironmentalReports field and ScsiTemperatureData struct to capture temperature data from SCSI devices
webapp/backend/pkg/models/measurements/smart.go Updates SCSI processing to include temperature attribute and adds helper function to extract temperature value

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@FredHaa
Copy link

FredHaa commented Nov 26, 2025

@AnalogJ please test/merge

Starosdev added a commit to Starosdev/scrutiny that referenced this pull request Nov 30, 2025
Starosdev pushed a commit to Starosdev/scrutiny that referenced this pull request Nov 30, 2025
## [1.1.0](v1.0.0...v1.1.0) (2025-11-30)

### Features

* Add "day" as resolution for temperature graph ([2670af2](2670af2))
* add day resolution for temperature graph (upstream PR [AnalogJ#823](https://github.com/Starosdev/scrutiny/issues/823)) ([2d6ffa7](2d6ffa7))
* add setting to enable/disable SCT temperature history (upstream PR [AnalogJ#557](https://github.com/Starosdev/scrutiny/issues/557)) ([c3692ac](c3692ac))
* Implement device-wise notification mute/unmute ([925e86d](925e86d))
* implement device-wise notification mute/unmute (upstream PR [AnalogJ#822](https://github.com/Starosdev/scrutiny/issues/822)) ([ea7102e](ea7102e))
* implement Prometheus metrics support (upstream PR [AnalogJ#830](https://github.com/Starosdev/scrutiny/issues/830)) ([7384f7d](7384f7d))
* support SAS temperature (upstream PR [AnalogJ#816](https://github.com/Starosdev/scrutiny/issues/816)) ([f954cc8](f954cc8))

### Bug Fixes

* better handling of ata_sct_temperature_history (upstream PR [AnalogJ#825](https://github.com/Starosdev/scrutiny/issues/825)) ([d134ad7](d134ad7))
* **database:** add missing temperature parameter in SCSI migration ([df7da88](df7da88))
* support transient SMART failures (upstream PR [AnalogJ#375](https://github.com/Starosdev/scrutiny/issues/375)) ([601775e](601775e))
* **ui:** fix temperature conversion in temperature.pipe.ts (upstream PR [AnalogJ#815](https://github.com/Starosdev/scrutiny/issues/815)) ([e0f2781](e0f2781))

### Refactoring

* use limit() instead of tail() for fetching smart attributes (upstream PR [AnalogJ#829](https://github.com/Starosdev/scrutiny/issues/829)) ([2849531](2849531))
@BoGs
Copy link

BoGs commented Nov 30, 2025

This does not seem to populate the data for me, for some reason the ui still shows infinite symbol. 🤔

  "scsi_environmental_reports": {
    "temperature_1": {
      "parameter_code": 0,
      "current": 28,
      "lifetime_maximum": 28,
      "lifetime_minimum": 25,
      "maximum_since_power_on": 28,
      "minimum_since_power_on": 25
    },
    "relative_humidity_1": {
      "parameter_code": 256,
      "current": 0,
      "lifetime_maximum": 0,
      "lifetime_minimum": 0,
      "maximum_since_power_on": 0,
      "minimum_since_power_on": 0
    }
  },

// generate SmartScsiAttribute entries from Scrutiny Collector Smart data.
func (sm *Smart) ProcessScsiSmartInfo(defectGrownList int64, scsiErrorCounterLog collector.ScsiErrorCounterLog, temperature map[string]collector.ScsiTemperatureData) {
sm.Attributes = map[string]SmartAttribute{
"temperature": (&SmartNvmeAttribute{AttributeId: "temperature", Value: getScsiTemperature(temperature), Threshold: -1}).PopulateAttributeStatus(),
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this not be SmartScsiAttribute? Unsure since the attributes seem similar properties.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like it might be parsing it as unknown attribute name

passed	Unknown Attribute Name
	27 		
Unknown
Type
Value
Worst/Thresh
Failure %
Scrutiny
27
--
--
Normalized
27
--/
--
Raw
--
--```

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah .... so I do not think this will work as intended. This seems to store the value into InfluxDB as metrics -> smart -> attr.temperature.value -> device_wwn -> device_protocol but the web app seems to be missing the bits to tie into everything which is why it is still showing as infinite.

It gets the data from Influx here

https://github.com/AnalogJ/scrutiny/blob/master/webapp/backend/pkg/web/handler/get_device_details.go#L28

and since this is a SCSI drive it will popolate the metadata

https://github.com/AnalogJ/scrutiny/blob/master/webapp/backend/pkg/web/handler/get_device_details.go#L41

and I think the web is temp from the smart attribute

,,0,2025-11-30T20:54:37.872729924Z,2025-11-30T21:54:37.872729924Z,2025-11-30T21:10:20Z,0,attr.temperature.status,smart,SCSI,xxxxxxxxx
,,1,2025-11-30T20:54:37.872729924Z,2025-11-30T21:54:37.872729924Z,2025-11-30T21:10:20Z,28,attr.temperature.value,smart,SCSI,xxxxxxxxx
,,2,2025-11-30T20:54:37.872729924Z,2025-11-30T21:54:37.872729924Z,2025-11-30T21:10:20Z,1,power_on_hours,smart,SCSI,xxxxxxxxx
,,3,2025-11-30T20:54:37.872729924Z,2025-11-30T21:54:37.872729924Z,2025-11-30T21:10:20Z,0,temp,smart,SCSI,xxxxxx

(here is the influx data for the device I removed the WWN deice id)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you for testing this, can you point out how should I change it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Missing temperature and power-on-count for SCSI drives

3 participants