Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should not wakeup hdd from standby/idle (spinned down) to active status #61

Closed
EcceGratum opened this issue Aug 28, 2022 · 5 comments · Fixed by #74
Closed

Should not wakeup hdd from standby/idle (spinned down) to active status #61

EcceGratum opened this issue Aug 28, 2022 · 5 comments · Fixed by #74

Comments

@EcceGratum
Copy link

I am trying to monitor the temperature and the device state of my HDDs.
Most of them go into sleep mode and have small periods of activity from time to time.

The behaviour i see on win10 is by having the exporter running, it will keep the HDDs in active mode (making exporting "smartctl_device_state" useless). I didn't check on linux, but would expect a similar behaviour.

I would like a new command line option (or the default behaviour changed) so that the exporter would not wake up sleeping drives.
It will probably not collect most of the stats on sleeping drives but that makes sense and is acceptable.

smartmontools has the "-n POWERMODE[,STATUS[,STATUS2]], --nocheck=POWERMODE[,STATUS[,STATUS2]]" command to prevent waking sleeping drives

@EcceGratum
Copy link
Author

EcceGratum commented Aug 28, 2022

Starting to realize that even if the option was available, once the HDD becomes active, the exporter will prevent it to go back to sleep...

Is there a way to collect only stats that won't affect disk's activity changes ?

@Daryes
Copy link

Daryes commented Sep 9, 2022

According to the man page : https://linux.die.net/man/8/smartctl
the desired parameter would be : -n standby (or --nocheck=standby

About having the disks able to sleep, given another monitoring agent I'm using (telegraf) which does not block the drive in active state, 2 things seems required :

  • retrieving the existing drives: --scan should be used, and not --scan-open that is causing a wake event.
  • getting the drive informations: the full list of used arguments is: --info --health --attributes --tolerance=verypermissive -nocheck=standby --format=brief

With that the drives are able to sleep while still being monitored.
Beware that when scanning a sleeping drive, smartctl will exit with the error code 2, which obviously must be ignored.

SuperQ added a commit that referenced this issue Oct 3, 2022
Update smartctl command arguments to reduce device wakeup from
standby/idle.
* Ignore exit code of 2 for sleeping devices.

Fixes: #61

Signed-off-by: SuperQ <[email protected]>
@SuperQ SuperQ closed this as completed in #74 Oct 3, 2022
SuperQ added a commit that referenced this issue Oct 3, 2022
Update smartctl command arguments to reduce device wakeup from
standby/idle.
* Ignore exit code of 2 for sleeping devices.

Fixes: #61

Signed-off-by: SuperQ <[email protected]>

Signed-off-by: SuperQ <[email protected]>
@EcceGratum
Copy link
Author

EcceGratum commented Oct 8, 2022

Tested 0.8.0 .

It doesn't wake up sleeping drives (yeah !) but for the drives that are not sleeping (or wake up after), it will prevent them from going to sleep.

NB: No "smartctl_device_status" will be present for sleeping drives, should the exporter send 0 for those ?

I use this command to check if drive is sleeping or not "smartctl.exe -n standby o: --nocheck=standby"

@Daryes
Copy link

Daryes commented Oct 9, 2022

@EcceGratum
Get a look here : https://github.com/adelolmo/hd-idle
Basically, you can't have both monitoring and drive able to sleep without external assistance. Hd-idle will take care of this.

Careful tho : drives consume much more power when spinning up. If you have many drive, your power supply might not like it.
Due to this, I suggest to put a sleep timer to at least 15 mins, if not more. Dunno what is your setup, but I've set mine to 1h delay, which is enough to have them down most of the time when nobody is around to make use of them.

Regarding the missing smartctl_device_status when drive are sleeping : having a missing status or a status = 0 is the side effect of sleeping drives, as for smartctl, while it is not a real error, it will still return an error code that you have to handle one way or another.

@EcceGratum
Copy link
Author

EcceGratum commented Oct 9, 2022

@Daryes
The drives are already configured to go to sleep after 5 mins in the windows power plan but what you seem to imply is that windows will consider monitoring as activity and prevent them going to sleep & hd-idle won't or doesn't care ?

I have plenty of headroom on the PSU side. Currently only 4x 3"5 Internal HDDs are concerned by this, peak power usage should be around 10 watts each, i think.

I can live with no smartctl_device_status when hdd is sleeping.
I will take a look at what you recommended, hd-idle and perhaps telegraf too.

Thank you.

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 a pull request may close this issue.

2 participants