Fan Scripts for Supermicro Boards Using PID Logic

Fan Scripts for Supermicro Boards Using PID Logic 2020-08-20, previous one was missing a file

Glorious1

Guru
Joined
Nov 23, 2014
Messages
1,211
Post-init scripts start after the server finishes booting. So, to test whether the post-init script call is working, you have to reboot your FreeNAS. Is that what you're doing?

Are you sure the post-init settings point to where the script actually is? And the type is set to Script, not Command?

I don't know how to make it append when you're doing log file only. You can't use -a with the tee command because there is no tee command.
 

nasnice

Explorer
Joined
Jul 14, 2014
Messages
82
Post-init scripts start after the server finishes booting. So, to test whether the post-init script call is working, you have to reboot your FreeNAS. Is that what you're doing?

Yes it is holiday time here so I get to play around with stuff without annoying anyone... I am actually rebooting several times ... Even tried a cold reboot...

Are you sure the post-init settings point to where the script actually is? And the type is set to Script, not Command?
AFAIK it points to the right place... in the menu you have a browse button... I assume that does the trick..., Yes Script.

I think it must have something to do with rights... The Script dir is in the root of the main share... Could be that the rights of the share override the rights of the file? I can try to make a Scripts dir in the root of the mount... and then share that one to root wheel only...
 

Glorious1

Guru
Joined
Nov 23, 2014
Messages
1,211
Not sure about the root permissions, if they could be preventing it. I would try putting it somewhere else, like /usr/local/bin, then of course change the post-init settings accordingly. I have mine in a subdirectory of my user directory.
 

nasnice

Explorer
Joined
Jul 14, 2014
Messages
82
What log do i need to look into to check if this script gets started at all?
Browsed through var/log/messages ... No mention.. What should I be looking for?

Ok do not know what I did (stopped and started some services) and poof it works... Now for the if its not broken... adagio.. THANKS!
 
Last edited:

Glorious1

Guru
Joined
Nov 23, 2014
Messages
1,211
By default your spinpid2.log will be in the parent directory of the directory spinpid2.sh is in.

Glad you got it working. Did you move the script out of root?
 

nasnice

Explorer
Joined
Jul 14, 2014
Messages
82
I was not looking for the script log ... I was looking for the system log to find out why the script did not autostart... Did not find anything BTW..

So script stayed in the same directory in the root of the mnt... Still do not quite understand why it did not work at first...
 

nasnice

Explorer
Joined
Jul 14, 2014
Messages
82
So the last thing I did was removing the console output bij commenting out one line and removing the comment on the line that only gives the log file... I did that using edit on an ssh session

Also since the Chassis/Motherboard info led was blinking me a failing fan... I reconnected some fans on FAN2 and FAN3...

Next thing that happens is that i lost my console...

Last lines on the console are:

Code:
Starting zfsd.
Configuring syscons: blanktime.
Starting cron.


No more menu on the console neither does it respond to input....

What did I do wrong?
 

nasnice

Explorer
Joined
Jul 14, 2014
Messages
82
Meanwhile I have been using the script in Tmux and NOT as a startup post init script... BUT

It fails to cool my 16 drives in a SMC836 housing sufficiently with respect to the ambient variables, it is warm in the south of Portugal..

So unfortunately there is no difference with the Supermicro propietarity solution... Main Problem also stays.. Noise from fans and drive temps.

I have played around with the IPMI raw commands to set the modes for the fans... I would now like to reverse that.. Is there a simple IPMI command to return to defaults settings?
 

Glorious1

Guru
Joined
Nov 23, 2014
Messages
1,211
Next thing that happens is that i lost my console...

Last lines on the console are:

Code:
Starting zfsd.
Configuring syscons: blanktime.
Starting cron.


No more menu on the console neither does it respond to input....
I have no idea what's going on there. Doesn't seem script related. Did you get the console back?

Meanwhile I have been using the script in Tmux and NOT as a startup post init script... BUT

It fails to cool my 16 drives in a SMC836 housing sufficiently with respect to the ambient variables, it is warm in the south of Portugal..

So unfortunately there is no difference with the Supermicro propietarity solution... Main Problem also stays.. Noise from fans and drive temps.

I have played around with the IPMI raw commands to set the modes for the fans... I would now like to reverse that.. Is there a simple IPMI command to return to defaults settings?
You can change fan mode in the IPMI GUI, or using raw commands. The script should be stopped if necessary, before you do that.

When the drives weren't cooling to your setpoint while using the script, were the PER fans at the maximum duty setting you had in the config file? If so, yes, the fans are not capable of cooling enough in your warm environment. No script can fix that.
 

nasnice

Explorer
Joined
Jul 14, 2014
Messages
82
I have no idea what's going on there. Doesn't seem script related. Did you get the console back?


You can change fan mode in the IPMI GUI, or using raw commands. The script should be stopped if necessary, before you do that.

When the drives weren't cooling to your setpoint while using the script, were the PER fans at the maximum duty setting you had in the config file? If so, yes, the fans are not capable of cooling enough in your warm environment. No script can fix that.

Disabled the script through the GUI and after a restart got my console back... on to Tmux...

Yes the script maxed out the fans, it tried to lower them every now and then, but basically you are right... The fans (not original, came with the chassis) are not up to cooling down my drives enough on ambient 30 Celsius.. Temperature rose to 42 C. (on some drives)

Split up the pools to cater for two (silent and cool) other housings.

Thanks anyway!
 

D-7

Dabbler
Joined
Apr 8, 2017
Messages
14
@nasnice and others having proplems starting this as post-init script:

The post-init scripts want a timeout setting, so you have to start a script to start your script.:smile:

I did something like this:
Code:
#!/bin/bash
/path/to/your/spinpid2.sh &


Save as start_spinpid2.sh and then use this as the post-init script. I set the timeout for this to 30 sec in the gui but I think less will do.
 

Glorious1

Guru
Joined
Nov 23, 2014
Messages
1,211
I haven't found it necessary to create another script to start the script. My postinit task looks like this:
Screen Shot 2020-09-11 at 3.41.46 PM.png
 

Glorious1

Guru
Joined
Nov 23, 2014
Messages
1,211
Interesting. Didn't get it to work this way...
Maybe related to permissions? My permissions (755) of the containing directory:
drwxr-xr-x 2 jim wheel 14B Sep 9 08:04 bin/
and the script itself:
-rwxr-xr-x 1 jim wheel 16K Jun 16 15:14 spinpid.sh
 

D-7

Dabbler
Joined
Apr 8, 2017
Messages
14
All files look like this:
Code:
-rwxrwx---+  1 d-7  d-7   21535 Aug 20 19:44 spinpid2.sh


Well, I didn't invest too much time in this. Just tried two times and also with "timeout = 0" to eventuellay skip the timeout. Didn't work so I wrote this "wrapper script" which worked instantly and then I forgot about it. :wink:
 

JohnnyGrey

Dabbler
Joined
Jul 1, 2017
Messages
45
I haven't updated your script on my machine since the beginning of 2018, so I am super happy you are still maintaining it! I noticed something in spinpid2.config, is this worded right? Shouldn't the "My system" be commented out, and "Your system" be uncommented? I just feel like "My" refers to the script's creator, aka you.

Regardless, thank you so much for an amazing script that has kept my drives nice and cool for 2-3 years!

Code:
# Using spintest.sh, measure fan RPMs at 30% duty cycle and 100% duty cycle.
# RPM_CPU is for FANA if ZONE_CPU=1 or FAN1 if ZONE_CPU=0
# RPM_PER is for the other fan.
# RPM_CPU_30=400   # Your system
# RPM_CPU_MAX=1500
# RPM_PER_30=600
# RPM_PER_MAX=1800
RPM_CPU_30=500   # My system
RPM_CPU_MAX=1400
RPM_PER_30=500
RPM_PER_MAX=1400


Stupid question: If I have logging to the console disabled, is it no longer necessary to run this script inside a tmux session? Does it still technically "tie up" the console interface?
 

Glorious1

Guru
Joined
Nov 23, 2014
Messages
1,211
Yes, My system is mine, and I probably should have reversed the commenting. But it doesn't really matter, you have to replace one set of values with your measured values either way.

If logging to console is disabled, it should not tie up the console. But you need to run it in a tmux session or as a startup script. Otherwise, when your SSH session or shell session ends, I think the script will stop.
 

lmannyr

Contributor
Joined
Oct 11, 2015
Messages
198
First...happy to see this script has been updated over the years. Thank you.

I have been using a 201801 version until today. The latest version does not actually change the fan RPM based not the new requested duty cycle on CPU. FANA stays at 200rpm despite temps rising and duty cycle requests. Ideas? Thanks.

Code:
***** SETTINGS ******
CPU zone 1; Peripheral zone 0
CPU fans min/max duty cycle: 15/100
PER fans min/max duty cycle: 15/100
CPU fans - measured RPMs at 30% and 100% duty cycle: 500/1500
PER fans - measured RPMs at 30% and 100% duty cycle: 900/2500
Drive temperature setpoint (C): 35
Kp=4, Kd=40
Drive check interval (main cycle; minutes): 5
CPU check interval (seconds): 3
CPU reference temperature (C): 40
CPU scalar: 6
Reading fan duty from board
Getting CPU temperatures via sysctl

Key to drive status symbols:  * spinning;  _ standby;  ? unknown                              Version 2020-08-20

Wednesday, Oct 28                                                                            CPU         New_Fan%  New_RPM_____________________
          da0  da1  da2  da3  da4  da5  da6  da7  ada0 ada1 Tmax Tmean   ERRc      P      D TEMP MODE    CPU PER   FANA  FAN1  FAN2  FAN3  FAN4
07:49:17  *30  *30  *30  *33  *33  *33  *33  *36  *37  *33  ^37  32.80  -2.20  -8.80 -17.60   29 Full     24  24    800   800   ---   ---   900
Mismatch between CPU Duty and RPMs -- DUTY_CPU=24; RPM_CPU=800
Attempting to fix CPU mismatch 

07:54:37  *30  *30  *31  *33  *35  *34  *33  *37  *37  *34  ^37  33.40  -1.60  -6.40   4.80   34 Full     15  15    200   500   ---   ---   500
07:59:51  *31  *31  *32  *35  *36  *36  *35  *37  *39  *36  ^39  34.80  -0.20  -0.80  11.20   35 Full     25  25    200   800   ---   ---   900
08:05:05  *32  *32  *33  *36  *37  *37  *36  *37  *39  *36  ^39  35.50   0.50   2.00   5.60   34 Full     33  33    200  1000   ---   ---  1100
08:10:20  *32  *32  *33  *36  *37  *37  *36  *38  *39  *36  ^39  35.60   0.60   2.40   0.80   35 Full     36  36    200  1100   ---   ---  1200
08:15:35  *32  *32  *33  *36  *37  *37  *36  *38  *39  *36  ^39  35.60   0.60   2.40   0.00   34 Full     38  38    200  1200   ---   ---  1300
08:20:48  *32  *32  *33  *36  *37  *37  *36  *38  *39  *36  ^39  35.60   0.60   2.40   0.00   34 Full     40  40    200  1200   ---   ---  1300
08:26:02  *32  *32  *33  *36  *37  *37  *36  *38  *39  *36  ^39  35.60   0.60   2.40   0.00   34 Full     42  42    200  1300   ---   ---  1400
08:31:17  *32  *32  *33  *36  *37  *37  *35  *38  *39  *36  ^39  35.50   0.50   2.00  -0.80   34 Full     43  43    200  1300   ---   ---  1400
08:36:30  *32  *32  *33  *36  *37  *37  *35  *38  *39  *36  ^39  35.50   0.50   2.00   0.00   34 Full     45  45    200  1300   ---   ---  1500
 

lmannyr

Contributor
Joined
Oct 11, 2015
Messages
198
I changed the "How duty" to 0 and the RPMs are now reading correctly. Problem solved. Just had to reread the comments in the config file. Thanks again.
 

Glorious1

Guru
Joined
Nov 23, 2014
Messages
1,211
I'm glad you got it working, but to be honest that log doesn't make sense to me. Your CPU temp never got up to the reference point, so it shouldn't have been increasing the CPU duty. But if it is increasing CPU duty, FANA should spin faster. It's also funny that duty cycles remain the same for CPU and PER. I'll have to look at the script and see how that all could possibly happen if the board is giving bogus or no duty data.
 
Top