add raid_controller_battery_temp, and ensure MegaCli doesn't continuously log

This commit is contained in:
Tim Connors 2025-11-18 00:49:50 +11:00
parent 8ea6df0eb3
commit 8614648388
2 changed files with 23 additions and 3 deletions

View file

@ -48,7 +48,7 @@ sub custom_temperature_calculation {
# at least one fan speed. Note that drivetemp devices may already # at least one fan speed. Note that drivetemp devices may already
# be included via $*_drives averages below. # be included via $*_drives averages below.
my $gpu = $sensors_ref->{"amdgpu-pci-0400"}{"edge"}{"temp1_input"}; # 0.2*fan3 + 0.5*fan4 + 0.3*fan5 my $gpu = $sensors_ref->{"amdgpu-pci-0400"}{"edge"}{"temp1_input"}; # 0.2*fan3 + 0.5*fan4 + 0.3*fan5
my $raid_card = raid_controller_temp(); # fan4+fan5; my $raid_card = max(raid_controller_temp(),raid_controller_battery_temp()); # fan4+fan5;
my $left_cpu = $sensors_ref->{"coretemp-isa-0000"}{"Package id 0"}{"temp1_input"}; # fan2; my $left_cpu = $sensors_ref->{"coretemp-isa-0000"}{"Package id 0"}{"temp1_input"}; # fan2;
my $right_cpu = $sensors_ref->{"coretemp-isa-0001"}{"Package id 1"}{"temp1_input"}; # fan4; my $right_cpu = $sensors_ref->{"coretemp-isa-0001"}{"Package id 1"}{"temp1_input"}; # fan4;

View file

@ -8,7 +8,6 @@
# background information: # background information:
# https://www.dell.com/community/PowerEdge-Hardware-General/T130-Fan-Speed-Algorithm/td-p/5052692 # https://www.dell.com/community/PowerEdge-Hardware-General/T130-Fan-Speed-Algorithm/td-p/5052692
# https://serverfault.com/questions/715387/how-do-i-stop-dell-r730xd-fans-from-going-full-speed-when-broadcom-qlogic-netxtr/733064#733064 # https://serverfault.com/questions/715387/how-do-i-stop-dell-r730xd-fans-from-going-full-speed-when-broadcom-qlogic-netxtr/733064#733064
# could monitor H710 temperature with sudo env /opt/MegaRAID/MegaCli/MegaCli64 -AdpAllInfo -aALL | grep -i temperature
use strict; use strict;
use warnings; use warnings;
@ -251,7 +250,7 @@ sub raid_controller_temp {
# getting stuck in the D state, holding STDERR open despite a kill # getting stuck in the D state, holding STDERR open despite a kill
# -9, so instead just send it to a tempfile, and read from that # -9, so instead just send it to a tempfile, and read from that
# tempfile # tempfile
system("timeout -k 1 20 /opt/MegaRAID/MegaCli/MegaCli64 -AdpAllInfo -aALL | grep -i ^ROC.temperature | awk '{print \$4}' > $tempfilename"); system("timeout -k 1 20 /opt/MegaRAID/MegaCli/MegaCli64 -AdpAllInfo -aALL -NoLog | grep -i ^ROC.temperature | awk '{print \$4}' > $tempfilename");
my $val = `cat < $tempfilename`; chomp $val; my $val = `cat < $tempfilename`; chomp $val;
if ($val ne "") { if ($val ne "") {
@ -263,6 +262,27 @@ sub raid_controller_temp {
return $raid_controller_cache_temp; return $raid_controller_cache_temp;
} }
my $raid_controller_battery_temp;
my $raid_controller_battery_time;
sub raid_controller_battery_temp {
if (!defined $raid_controller_battery_time or
$raid_controller_battery_time > $raid_controller_poll_interval) {
# could just be a simple pipe, but protect against something
# getting stuck in the D state, holding STDERR open despite a kill
# -9, so instead just send it to a tempfile, and read from that
# tempfile
system("timeout -k 1 20 /opt/MegaRAID/MegaCli/MegaCli64 -AdpBbuCmd -GetBbuStatus -aALL -NoLog | grep -i ^ROC.temperature | awk '{print \$4}' > $tempfilename");
my $val = `cat < $tempfilename`; chomp $val;
if ($val ne "") {
$raid_controller_battery_temp = $val;
$raid_controller_battery_time = time;
}
}
return $raid_controller_battery_temp;
}
my $ambient_cache_temp = 20; my $ambient_cache_temp = 20;
my $ambient_cache_time; my $ambient_cache_time;
sub ambient_temp { sub ambient_temp {