PSteward Posted May 17, 2023 Share Posted May 17, 2023 (edited) Hello! I've been trying to find a solution to the issue of linux and reading/controlling fans, I stumbled upon liquidctl and the existing docker got me on the path to build something myself that reads hard drive temps, averages them and sets fan speed based on that. I am using the NZXT RGB & Fan Controller - AC-CRFR0-B1-6 and focusing only on controlling the fan speed (fan1, fan2, fan3). Here is a docker: pstewardyul/liquidtemp:latest Variables needed to set are: THRESHOLDS_ENV - Set the temperature thresholds that will change the fan speeds - DEFAULT "20,25,30,35,40,45" FAN_SPEEDS_ENV - Set the speeds that will change with the threshold temperatures - DEFAULT "20,30,40,50,60,100" EXCLUDED_DRIVES_ENV - If you need to exclude drives from the average calculation - NO DEFAULT - EXAMPLE "/dev/sda,/dev/sdb" FAN_QUANTITY_ENV - Set to 1, 2, 3 (how many you are connecting to your controller) - DEFAULT "3" The container requires "privileged" to read/control related hardware. Also recommend to set "--log-opt max-size=50m" in extra parameters to limit the log size as every minute the script will run to check/update fan speed, these changes are viewable in the log. If you don't set any variables - no worries - it will load defaults (except the log limit). This an AMD64 docker image, not sure how to work with the other platforms, and just started with making scripts and building docker this afternoon so even though it works on my system, not sure of others! FYI - The script just works with /dev/sdX not NVME, also some /dev/sdX don't produce the smart output compatible (like my kingston MSATA). The script can be found at "/usr/local/bin/fan_control.sh". EDIT: Changed from hddtemp (causing issues with spun down drives) to smartctl and added more error checking. --Phil Edited June 2, 2023 by PSteward Quote Link to comment
ginhead Posted June 20, 2023 Share Posted June 20, 2023 Hi, was just looking for something like this, Dynamix Auto Fan Control is not working with my mb. I dont see this in the docker section on Unraid and dont understand your link above. can you advise on how to install? thanks! Quote Link to comment
PSteward Posted June 27, 2023 Author Share Posted June 27, 2023 (edited) Hey Ginhead, Do you have NZXT RGB & Fan Controller or equiv that works with the liquidctl docker? If you do: Go to the docker tab, click Add Container. Name: liquidtemp Repository: pstewardyul/liquidtemp:latest Privileged: ON Click on Add another Path, Port, Variable, Label or Device: Config Type: Variable Name: Thresholds Key: THRESHOLDS_ENV Value: 20,25,30,35,40,45 Save. Click on Add another Path, Port, Variable, Label or Device: Config Type: Variable Name: Fan Speeds Key: FAN_SPEEDS_ENV Value: 20,30,40,50,60,100 Save. Click on Add another Path, Port, Variable, Label or Device: Config Type: Variable Name: Excluded Drives from temp calc Key: EXCLUDED_DRIVES_ENV Value: {ENTER WHAT EVER DRIVES YOU DON'T WANT TO CHECK TEMP,. example "/dev/sda" } Save. Click on Add another Path, Port, Variable, Label or Device: Config Type: Variable Name: Fans Key: FAN_QUANTITY_ENV Value: {ENTER QUANTITY OF FANS UNDER CONTROL, example "3" } Save. Click Done, after it loads, check the logs for its run status. Edited August 19, 2023 by PSteward 1 Quote Link to comment
ginhead Posted August 15, 2023 Share Posted August 15, 2023 hi, thanks for that great detail, I was just able to successfully pull and install. going to order that fan controller, thanks for the help! Quote Link to comment
MicroGenius Posted December 2, 2023 Share Posted December 2, 2023 On 6/27/2023 at 3:15 PM, PSteward said: Hey Ginhead, Do you have NZXT RGB & Fan Controller or equiv that works with the liquidctl docker? If you do: Go to the docker tab, click Add Container. Name: liquidtemp Repository: pstewardyul/liquidtemp:latest Privileged: ON Click on Add another Path, Port, Variable, Label or Device: Config Type: Variable Name: Thresholds Key: THRESHOLDS_ENV Value: 20,25,30,35,40,45 Save. Click on Add another Path, Port, Variable, Label or Device: Config Type: Variable Name: Fan Speeds Key: FAN_SPEEDS_ENV Value: 20,30,40,50,60,100 Save. Click on Add another Path, Port, Variable, Label or Device: Config Type: Variable Name: Excluded Drives from temp calc Key: EXCLUDED_DRIVES_ENV Value: {ENTER WHAT EVER DRIVES YOU DON'T WANT TO CHECK TEMP,. example "/dev/sda" } Save. Click on Add another Path, Port, Variable, Label or Device: Config Type: Variable Name: Fans Key: FAN_QUANTITY_ENV Value: {ENTER QUANTITY OF FANS UNDER CONTROL, example "3" } Save. Click Done, after it loads, check the logs for its run status. I just wanted to thank you! This was a pretty great workaround for my setup which is ran out of a dual bay HDD enclosure. The only option for cooling the drives was a on board temp sensor which wouldn't go off until the drives were well into their 50's This way I don't need to run on max 24x7 Thanks again! Quote Link to comment
Made2Fix Posted January 15 Share Posted January 15 Thanks @PSteward for this nicely working script and docker image. I noticed that every time the cron job triggers the fan-control script, the `liquidctl initialize all` will ramp up the fan speed to 100% before continuing to set it to e.g. 60%. It seems like to occur with the `NZXT RGB & Fan Controller` of mine. I did not test it on other devices, so this might be just specific to this one. An improvement would be to perform the `liquidctl initialize all` only once at the startup (before cron is setup), instead of the periodically triggered fan-control script. Thanks a lot! Greg Quote Link to comment
PSteward Posted February 13 Author Share Posted February 13 Hey Greg, Never noticed! I put that in because I noticed sometimes when I rebooted or started the server not all fans would work (showing 0 RPM) - honestly it doesn't really fix that issue though. It is REALLY important to check the logs at reboot to ensure that all fans are reporting more than 0 RPM and if not shutdown - then start again (reboot doesn't always resolve). I never had the issue once all fans are running but only on the occasional startup or reboot (I may do that every few months, so definitely important to verify). I'll review the coding and see if I can make some improvements based on how its been working of late - in addition at one point I'd like to extract the data into a plugin and show it on the interface (% + Speed). Quote Link to comment
PSteward Posted February 13 Author Share Posted February 13 (edited) Updated to add a check for the liquidctl initialize, and fixed it so it doesn't set speed if already correct, plus additional checks for zero RPM. Just update your docker. Edited February 13 by PSteward 1 Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.