Gaspetaahl
Explorer
- Joined
- Sep 13, 2018
- Messages
- 76
They are Arctic P12 PWM 120mm (4Pins) I had 3 Pin Fans before but the X10 cant control 3Pin fans
]# ./PID_fan_control.pl /usr/local/bin/ipmitool raw 0x30 0x45 0x01 1 /usr/local/bin/ipmitool raw 0x30 0x70 0x66 0x01 1 30 /usr/local/bin/ipmitool raw 0x30 0x70 0x66 0x01 0 20 /usr/local/bin/ipmitool raw 0x30 0x45 0 /usr/local/bin/ipmitool raw 0x30 0x45 0x01 1 /usr/local/bin/ipmitool raw 0x30 0x70 0x66 0x01 1 30 /usr/local/bin/ipmitool raw 0x30 0x70 0x66 0x01 0 20 /usr/local/bin/ipmitool raw 0x30 0x70 0x66 0x01 0 16 Unable to send RAW command (channel=0x0 netfn=0x30 lun=0x0 cmd=0x70 rsp=0xcc): Invalid data field in request /usr/local/bin/ipmitool raw 0x30 0x45 0 /usr/local/bin/ipmitool raw 0x30 0x45 0x01 1 /usr/local/bin/ipmitool raw 0x30 0x70 0x66 0x01 1 30 /usr/local/bin/ipmitool raw 0x30 0x70 0x66 0x01 0 16 Unable to send RAW command (channel=0x0 netfn=0x30 lun=0x0 cmd=0x70 rsp=0xcc): Invalid data field in request /usr/local/bin/ipmitool raw 0x30 0x45 0x01 1 No data available Get Device ID command failed No data available Get Device ID command failed: 0xc1 Invalid command Unable to open SDR for reading /usr/local/bin/ipmitool raw 0x30 0x45 0x01 1 /usr/local/bin/ipmitool raw 0x30 0x70 0x66 0x01 1 30 /usr/local/bin/ipmitool raw 0x30 0x70 0x66 0x01 0 16 Unable to send RAW command (channel=0x0 netfn=0x30 lun=0x0 cmd=0x70 rsp=0xcc): Invalid data field in request /usr/local/bin/ipmitool raw 0x30 0x70 0x66 0x01 0 16 Unable to send RAW command (channel=0x0 netfn=0x30 lun=0x0 cmd=0x70 rsp=0xcc): Invalid data field in request /usr/local/bin/ipmitool raw 0x30 0x45 0 /usr/local/bin/ipmitool raw 0x30 0x45 0x01 1 No data available Get Device ID command failed ^C Caught SIGINT: setting fan mode to optimal /usr/local/bin/ipmitool raw 0x30 0x45 0x01 2 No data available Get Device ID command failed Unable to send RAW command (channel=0x0 netfn=0x30 lun=0x0 cmd=0x45 rsp=0xc1): Invalid command
ipmitool bmc reset cold Sent cold reset command to MC [root@freenas ~/nas_fan_control]# ipmitool raw 0x30 0x45 0x01 0x01 No data available Get Device ID command failed Unable to send RAW command (channel=0x0 netfn=0x30 lun=0x0 cmd=0x45 rsp=0xc1): Invalid command
/usr/local/bin/ipmitool raw 0x30 0x45 0x01 1 /usr/local/bin/ipmitool raw 0x30 0x70 0x66 0x01 1 30 /usr/local/bin/ipmitool raw 0x30 0x70 0x66 0x01 0 37 /usr/local/bin/ipmitool raw 0x30 0x45 0 /usr/local/bin/ipmitool raw 0x30 0x70 0x66 0x01 0 20 /usr/local/bin/ipmitool raw 0x30 0x45 0 /usr/local/bin/ipmitool raw 0x30 0x45 0x01 1 /usr/local/bin/ipmitool raw 0x30 0x70 0x66 0x01 1 30 /usr/local/bin/ipmitool raw 0x30 0x70 0x66 0x01 0 20 /usr/local/bin/ipmitool raw 0x30 0x45 0x01 1 No data available Get Device ID command failed No data available Get Device ID command failed: 0xc1 Invalid command Unable to open SDR for reading /usr/local/bin/ipmitool raw 0x30 0x70 0x66 0x01 0 16 /usr/local/bin/ipmitool raw 0x30 0x45 0 /usr/local/bin/ipmitool raw 0x30 0x45 0x01 1 /usr/local/bin/ipmitool raw 0x30 0x70 0x66 0x01 1 30 /usr/local/bin/ipmitool raw 0x30 0x70 0x66 0x01 0 16 /usr/local/bin/ipmitool raw 0x30 0x45 0x01 1 No data available Get Device ID command failed No data available Get Device ID command failed: 0xc1 Invalid command Unable to open SDR for reading /usr/local/bin/ipmitool raw 0x30 0x70 0x66 0x01 0 16 /usr/local/bin/ipmitool raw 0x30 0x45 0 /usr/local/bin/ipmitool raw 0x30 0x70 0x66 0x01 1 60 /usr/local/bin/ipmitool raw 0x30 0x70 0x66 0x01 1 100 /usr/local/bin/ipmitool raw 0x30 0x70 0x66 0x01 1 60 /usr/local/bin/ipmitool raw 0x30 0x70 0x66 0x01 1 100 /usr/local/bin/ipmitool raw 0x30 0x70 0x66 0x01 1 60 /usr/local/bin/ipmitool raw 0x30 0x70 0x66 0x01 1 100 /usr/local/bin/ipmitool raw 0x30 0x70 0x66 0x01 1 60 /usr/local/bin/ipmitool raw 0x30 0x70 0x66 0x01 1 100 /usr/local/bin/ipmitool raw 0x30 0x70 0x66 0x01 1 60 /usr/local/bin/ipmitool raw 0x30 0x70 0x66 0x01 1 100 /usr/local/bin/ipmitool raw 0x30 0x70 0x66 0x01 1 60 /usr/local/bin/ipmitool raw 0x30 0x70 0x66 0x01 1 100 /usr/local/bin/ipmitool raw 0x30 0x45 0x01 1 /usr/local/bin/ipmitool raw 0x30 0x70 0x66 0x01 1 100 /usr/local/bin/ipmitool raw 0x30 0x70 0x66 0x01 0 16 /usr/local/bin/ipmitool raw 0x30 0x70 0x66 0x01 0 16 /usr/local/bin/ipmitool raw 0x30 0x45 0 /usr/local/bin/ipmitool raw 0x30 0x45 0x01 1 /usr/local/bin/ipmitool raw 0x30 0x70 0x66 0x01 1 100 /usr/local/bin/ipmitool raw 0x30 0x70 0x66 0x01 0 16 /usr/local/bin/ipmitool raw 0x30 0x70 0x66 0x01 0 16 /usr/local/bin/ipmitool raw 0x30 0x45 0 ^C Caught SIGINT: setting fan mode to optimal /usr/local/bin/ipmitool raw 0x30 0x45 0x01 2
# ipmitool bmc reset cold Sent cold reset command to MC root@freenas:~/nas_fan_control # ipmitool raw 0x30 0x45 0x01 0x01 No data available Get Device ID command failed No data available No data available No valid response received 20 01 03 88 02 bf 7c 2a 00 01 08 00 00 00 00
It seems strange thatEdit2:
I updated my BMC and BIOS and I think it might have fixed some errors. This is the new stdout. The "Unable to send RAW command" errors do not appear anymore
Code:/usr/local/bin/ipmitool raw 0x30 0x45 0x01 1 /usr/local/bin/ipmitool raw 0x30 0x70 0x66 0x01 1 30 /usr/local/bin/ipmitool raw 0x30 0x70 0x66 0x01 0 37 /usr/local/bin/ipmitool raw 0x30 0x45 0 /usr/local/bin/ipmitool raw 0x30 0x70 0x66 0x01 0 20 /usr/local/bin/ipmitool raw 0x30 0x45 0 /usr/local/bin/ipmitool raw 0x30 0x45 0x01 1 /usr/local/bin/ipmitool raw 0x30 0x70 0x66 0x01 1 30 /usr/local/bin/ipmitool raw 0x30 0x70 0x66 0x01 0 20 /usr/local/bin/ipmitool raw 0x30 0x45 0x01 1 No data available Get Device ID command failed No data available Get Device ID command failed: 0xc1 Invalid command Unable to open SDR for reading /usr/local/bin/ipmitool raw 0x30 0x70 0x66 0x01 0 16 /usr/local/bin/ipmitool raw 0x30 0x45 0 /usr/local/bin/ipmitool raw 0x30 0x45 0x01 1 /usr/local/bin/ipmitool raw 0x30 0x70 0x66 0x01 1 30 /usr/local/bin/ipmitool raw 0x30 0x70 0x66 0x01 0 16 /usr/local/bin/ipmitool raw 0x30 0x45 0x01 1 No data available Get Device ID command failed No data available Get Device ID command failed: 0xc1 Invalid command Unable to open SDR for reading /usr/local/bin/ipmitool raw 0x30 0x70 0x66 0x01 0 16 /usr/local/bin/ipmitool raw 0x30 0x45 0 /usr/local/bin/ipmitool raw 0x30 0x70 0x66 0x01 1 60 /usr/local/bin/ipmitool raw 0x30 0x70 0x66 0x01 1 100 /usr/local/bin/ipmitool raw 0x30 0x70 0x66 0x01 1 60 /usr/local/bin/ipmitool raw 0x30 0x70 0x66 0x01 1 100 /usr/local/bin/ipmitool raw 0x30 0x70 0x66 0x01 1 60 /usr/local/bin/ipmitool raw 0x30 0x70 0x66 0x01 1 100 /usr/local/bin/ipmitool raw 0x30 0x70 0x66 0x01 1 60 /usr/local/bin/ipmitool raw 0x30 0x70 0x66 0x01 1 100 /usr/local/bin/ipmitool raw 0x30 0x70 0x66 0x01 1 60 /usr/local/bin/ipmitool raw 0x30 0x70 0x66 0x01 1 100 /usr/local/bin/ipmitool raw 0x30 0x70 0x66 0x01 1 60 /usr/local/bin/ipmitool raw 0x30 0x70 0x66 0x01 1 100 /usr/local/bin/ipmitool raw 0x30 0x45 0x01 1 /usr/local/bin/ipmitool raw 0x30 0x70 0x66 0x01 1 100 /usr/local/bin/ipmitool raw 0x30 0x70 0x66 0x01 0 16 /usr/local/bin/ipmitool raw 0x30 0x70 0x66 0x01 0 16 /usr/local/bin/ipmitool raw 0x30 0x45 0 /usr/local/bin/ipmitool raw 0x30 0x45 0x01 1 /usr/local/bin/ipmitool raw 0x30 0x70 0x66 0x01 1 100 /usr/local/bin/ipmitool raw 0x30 0x70 0x66 0x01 0 16 /usr/local/bin/ipmitool raw 0x30 0x70 0x66 0x01 0 16 /usr/local/bin/ipmitool raw 0x30 0x45 0 ^C Caught SIGINT: setting fan mode to optimal /usr/local/bin/ipmitool raw 0x30 0x45 0x01 2
ipmitool raw 0x30 0x45 0x01 1
appears to work sometimes, and sometimes it triggers an error. I'm baffled. Maybe there is still some bug in your current version of the BMC. Or maybe the BMC is randomly rebooting for an unknown reason - perhaps a bad BMC, or a flakey power supply, or loose connection somewhere in the system. Is the power supply wattage guaranteed to be adequate for your system?It takes the BMC many seconds to reboot after a cold reset, so it is expected that there would be no valid response for some period of time.This happens when I execute the ipmitool commands without the script after a reset:
Code:# ipmitool bmc reset cold Sent cold reset command to MC root@freenas:~/nas_fan_control # ipmitool raw 0x30 0x45 0x01 0x01 No data available Get Device ID command failed No data available No data available No valid response received 20 01 03 88 02 bf 7c 2a 00 01 08 00 00 00 00
Excellent point - incorrect fan speed thresholds would explain the current behavior. See this thread for details on how to set the fan speed thresholds.You do need to set the fan critical thresholds on the BMC to prevent it resetting or taking over when fans fall below the thresholds.
ipmitool sensor | grep FAN
PID_fan_control.pl &
/etc/rc.d/pid-fan-control
#!/bin/sh # PROVIDE: pid-fan-control # REQUIRE: DAEMON # pidfancontrol_enable="YES" # ... to /etc/rc.conf . /etc/rc.subr name=pidfancontrol rcvar=pidfancontrol_enable command="/usr/sbin/PID_fan_control.pl"; pidfile="/var/run/${name}.pid" load_rc_config $name run_rc_command "$1"
Hi Kevin,I run the script automatically as a Init/Shutdown script of type POSTINIT. I have selected the option to use a config file for the parametres (see Github to get the later versions of the script that have the config file option). The script reads the config file each time around the loop, and picks up the new values if there have been changes.
Another option is to use tmux or screen to run the script, but this adds the risk that the script would not be running if the server had an uncommanded reboot.
tmux new-session -d -s fanscript '/mnt/pool/path/script.pl'
tmux attach -t fanscript
/mnt/pool/path/script.pl
Hi sretalla, thanks for this tip. Currently I'm running the script with tmux as you suggested as a normal process, not yet in the postinit. I didn't want to restart TrueNAS for that, but so far everyting is working as I want. Thanks all for your help!I would recommend running your postinit script like this:
tmux new-session -d -s fanscript '/mnt/pool/path/script.pl'
This way, you can stop and restart your script whenever you want to make changes outside of the "live" config by attaching to the tmux session like this:
tmux attach -t fanscript
CTRL + C to stop the script... make your adjustments... then start it again from that same tmux session/mnt/pool/path/script.pl
Then CTRL + B followed by D to detach again
I run the script automatically as a Init/Shutdown script of type POSTINIT. I have selected the option to use a config file for the parametres (see Github to get the later versions of the script that have the config file option). The script reads the config file each time around the loop, and picks up the new values if there have been changes.
Another option is to use tmux or screen to run the script, but this adds the risk that the script would not be running if the server had an uncommanded reboot.
What sretalla said.I would recommend running your postinit script like this:
tmux new-session -d -s fanscript '/mnt/pool/path/script.pl'
This way, you can stop and restart your script whenever you want to make changes outside of the "live" config by attaching to the tmux session like this:
tmux attach -t fanscript
CTRL + C to stop the script... make your adjustments... then start it again from that same tmux session/mnt/pool/path/script.pl
Then CTRL + B followed by D to detach again
I'm in the midst of a big road trip, driving all day today and most of tomorrow. Hence the delayed reply.I have left the PID config to default for now.
Does this script work with fans with different speeds?
2 x Noctua NF-A12x25 PWM connected to FANA header with max speed of 2000 RPM
1 x Noctua NF-A14 PWM connected to FANB header with max speed of 1500 RPM
I have disabled CPU fan control in the config.
So I'm only doing Zone 1 for HD fan control.
What should I put at $hd_max_fan_speed and $hd_fan_header?
EDIT: This script doesn't work on SCALE it seems. camcontrol isn't available on SCALE / Linux
ipmitool sdr
and determine which header one of your HD fans is connected to. camcontrol
with whatever equivalent utilities are available on Linux. But there must be something that could do the same functions as camcontrolI have 2 different fans that have different max RPM. That's why I wasn't sure if it would work.The required value for $hd_max_fan_speed depends on your fans.
Same here. I have 2 different fans. Not sure how it would work if they are different.For $hd_fan_header, look at the output ofipmitool sdr
and determine which header one of your HD fans is connected to.
Pick one fan, and use the max rpm and header for that fan.I have 2 different fans that have different max RPM. That's why I wasn't sure if it would work.
Same here. I have 2 different fans. Not sure how it would work if they are different.
Yeah, I tried searching for camcontrol equivalent in Linux, didn't get any hits.
Here's how to get the PID fan controller Perl script on TrueNAS SCALE. I started with this script and had it running for years on freeNAS then TrueNAS Core. I originally had it for SATA drives, then moved to SAS and had to customize it for the output of those so I can start tracking the SAS temps. Moving to SCALE was... interesting as all stopped working. Hello there, Linux. I had to further customize mine to fit my setup as I discovered camcontrol is gone and so is sysctl. Joy. But, in the end, it turned out quite okay and the changes were minimal. I keep my folder with the fan controller in /root/nas_fan_control-master and start it in SCALE with the command (in GUI it is command not script): bash /root/start_fan_controller, which a single-liner to start the pl file and log it.I have 2 different fans that have different max RPM. That's why I wasn't sure if it would work.
Same here. I have 2 different fans. Not sure how it would work if they are different.
Yeah, I tried searching for camcontrol equivalent in Linux, didn't get any hits.
#!/bin/bash echo "Starting Fan Controller..." /root/nas_fan_control-master/PID_fan_control.pl &>> /root/nas_fan_control-master/PID_fan_control.log &
$ipmitool = "/usr/local/bin/ipmitool";
$ipmitool = "/usr/bin/ipmitool";
$disk_list = `camcontrol devlist | grep -v "SSD" | grep -v "Verbatim" | grep -v "Kingston" | grep -v "Elements" | sed 's:.*(::;s:).*::;s:,pass[0-9]*::;s:pass[0-9]*,::' | egrep '^[a]*da[0-9]+\$' | tr '\012' ' '`;
$disk_list = `lsblk -d -n -o model,name | grep -v "SSD" | grep -v "Verbatim" | grep -v "Kingston" | grep -v "Elements" | sed 's:YOURDRIVEMODEL .::;' | tr '\012' ' '`;
foreach my $item (@hd_list) { my $disk_dev = "/dev/$item"; my $command = "/usr/local/sbin/smartctl -A $disk_dev | grep Temperature_Celsius"; my $output = `$command`; my @vals = split(" ", $output); # grab 10th item from the output, which is the hard drive temperature (on Seagate NAS HDs) my $temp = "$vals[9]"; chomp $temp;
foreach my $item (@hd_list) { my $disk_dev = "/dev/$item"; my $command = `/usr/sbin/smartctl -A $disk_dev | grep "Current Drive Temperature"`; my $output = $command; my @vals = split(" ", $output); # grab 10th item from the output, which is the hard drive temperature (on Seagate NAS HDs) my $temp = "$vals[3]"; chomp $temp;
my $core_temps = `sysctl -a dev.cpu | egrep -E \"dev.cpu\.[0-9]+\.temperature\" | awk '{print \$2}' | sed 's/.\$//'`;
my $core_temps = `sensors | egrep -E \"Core [0-9]+\" | awk '{print \$3}' | tr -d '+' | sed 's/.0°C//'`; chomp($core_temps);
PID Fan Controller Log --- Target 6 Disk HD Temperature = 39.00 deg C --- PID Control Gains: Kp = 5.333, Ki = 0.000, Kd = 48.0 Max Ave Temp Fan Fan Fan % CPU P I D Fan 2023-01-14 sda sdb sdc sdd sde sdf sdg sdh sdi sdj sdk Temp Temp Err Mode RPM Old/New Temp Corr Corr Corr Duty 19:11:12 36 36 36 36 37 38 37 38 36 39 38 ^39 37.83 -1.17 Full 2800 30/21 41 -9.33 -0.00 0.00 20.67% 19:12:43 36 36 34 36 37 38 37 38 34 39 38 ^39 37.83 -1.17 Full 2300 21/11 40 -9.33 -0.00 0.00 11.33% 19:14:13 36 36 36 36 37 38 37 38 36 39 38 ^39 37.83 -1.17 Full 2200 11/10 41 -9.33 -0.00 0.00 10.00% 19:15:42 36 37 36 36 37 38 38 38 36 39 39 ^39 38.17 -0.83 Full 2400 10/14 40 -6.67 -0.00 10.67 14.00% 19:17:13 36 37 36 37 37 38 38 38 36 39 38 ^39 38.00 -1.00 Full 2200 14/10 42 -8.00 -0.00 -5.33 10.00% 19:18:42 36 37 36 37 37 38 38 38 36 39 39 ^39 38.17 -0.83 Full 2200 10/10 40 -6.67 -0.00 5.33 10.00% 19:20:13 36 37 36 37 37 38 38 38 36 39 39 ^39 38.17 -0.83 Full 2200 10/10 41 -6.67 -0.00 0.00 10.00% 19:21:43 36 37 36 37 37 39 38 39 36 39 39 ^39 38.50 -0.50 Full 2500 10/17 41 -4.00 -0.00 10.67 16.67% 19:23:13 36 37 36 37 37 39 38 38 36 39 39 ^39 38.33 -0.67 Full 2200 17/10 41 -5.33 -0.00 -5.33 10.00% 19:24:43 36 37 36 37 37 39 38 39 36 39 39 ^39 38.50 -0.50 Full 2200 10/11 43 -4.00 -0.00 5.33 11.33% 19:26:12 36 37 36 37 37 39 38 39 36 39 39 ^39 38.50 -0.50 Full 2200 11/10 41 -4.00 -0.00 0.00 10.00% 19:27:43 37 37 37 37 37 39 38 39 36 39 39 ^39 38.50 -0.50 Full 2200 10/10 42 -4.00 -0.00 0.00 10.00% 19:29:12 37 37 36 37 38 39 38 39 37 39 39 ^39 38.67 -0.33 Full 2300 10/13 41 -2.67 0.00 5.33 12.67% 19:30:43 37 38 37 37 38 39 38 39 37 39 39 ^39 38.67 -0.33 Full 2200 13/10 41 -2.67 -0.00 0.00 10.00% 19:32:13 37 38 37 37 38 39 38 39 37 39 39 ^39 38.67 -0.33 Full 2200 10/10 42 -2.67 -0.00 0.00 10.00% 19:33:42 37 38 37 37 38 39 38 39 37 39 39 ^39 38.67 -0.33 Full 2200 10/10 42 -2.67 -0.00 0.00 10.00% PID Fan Controller Log --- Target 6 Disk HD Temperature = 39.00 deg C --- PID Control Gains: Kp = 5.333, Ki = 0.000, Kd = 48.0 Max Ave Temp Fan Fan Fan % CPU P I D Fan 2023-01-14 sda sdb sdc sdd sde sdf sdg sdh sdi sdj sdk Temp Temp Err Mode RPM Old/New Temp Corr Corr Corr Duty 19:36:09 37 38 37 38 38 39 38 39 37 39 39 ^39 38.67 -0.33 Full 3100 30/27 42 -2.67 -0.00 0.00 27.33%