add caching, minor improvements
parent
06533ceba4
commit
16ea60a4fb
|
@ -16,6 +16,10 @@ use List::Util qw[min max];
|
||||||
`ipmitool sensor thresh FAN4 lower 0 100 200`;
|
`ipmitool sensor thresh FAN4 lower 0 100 200`;
|
||||||
`ipmitool sensor thresh FAN5 lower 0 100 200`;
|
`ipmitool sensor thresh FAN5 lower 0 100 200`;
|
||||||
|
|
||||||
|
# cache SDR data for faster access
|
||||||
|
`rm /opt/ipmi-cache.sdr`;
|
||||||
|
`while ipmitool sdr dump /opt/ipmi-cache.sdr; [ $? != 0 ]; do sleep 2; done`;
|
||||||
|
|
||||||
my $min_temp_change = 2; # °C minimum change to actually cause a fan speed update
|
my $min_temp_change = 2; # °C minimum change to actually cause a fan speed update
|
||||||
my $seconds_to_sleep = 2; # Number of seconds to sleep between update loops
|
my $seconds_to_sleep = 2; # Number of seconds to sleep between update loops
|
||||||
|
|
||||||
|
@ -54,8 +58,8 @@ my $g_last_set_cpu_temp = 0;
|
||||||
my $g_last_set_sys_temp = 0;
|
my $g_last_set_sys_temp = 0;
|
||||||
|
|
||||||
sub UpdateFanSpeed {
|
sub UpdateFanSpeed {
|
||||||
# Gather statistics for fan speed and CPU Temp and stuch
|
# Gather statistics for fan speed and CPU Temp
|
||||||
my $ipmi_output = `ipmitool sdr list full`;
|
my $ipmi_output = `ipmitool sdr list full -S /opt/ipmi-cache.sdr`;
|
||||||
my @vals = split( "\n", $ipmi_output );
|
my @vals = split( "\n", $ipmi_output );
|
||||||
|
|
||||||
my $current_cpu_temp = 0;
|
my $current_cpu_temp = 0;
|
||||||
|
|
Loading…
Reference in New Issue