Make the serial port and disk glob per host

The shelf moved from iz-pve1 to iz-pve0, which has two SAS HBAs and an
internal backplane that is itself behind an expander. The default
"*-sas-exp*" glob matched all 17 drives there, so the shelf's fans would
have been set from the server's own drive temperatures.

PORT and DISK_GLOB are now overridable from the unit. Documents that the
host holding the shelf also needs the mirror-image DISK_EXCLUDE_PATTERN
in fan_speed.service - it was counting 17 disks until that was set.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Zeb Hering
2026-08-30 16:36:15 -07:00
parent 24d53e832e
commit 0fe728e28a
2 changed files with 20 additions and 5 deletions

View File

@@ -7,7 +7,7 @@
source /root/fan_speed/functions.sh
PORT=/dev/ttyS1
PORT=${PORT:-/dev/ttyS1}
LOG=/root/fan_speed/log/das_fan.log
CHECK_INTERVAL=30 # seconds between temperature readings
KEEPALIVE_INTERVAL=5 # re-send _shutup this often, the DAS forgets it otherwise
@@ -16,7 +16,11 @@ HIGH_FAN_SPEED=60
# Disks in the enclosure - anything behind the DAS SAS expander. The server's own
# drives hang off pci-...-scsi-* instead, so this glob does not pick them up.
DISK_GLOB='/dev/disk/by-path/*-sas-exp*-lun-0'
# Drives in THIS shelf. "-sas-exp" alone is not enough to identify an enclosure:
# a server's own backplane is often behind an expander too, and on iz-pve0 the
# internal drives sit on pci-0000:02:00.0 while the shelf is on 04:00.0. Name the
# shelf's HBA explicitly on any host with more than one.
DISK_GLOB=${DISK_GLOB:-/dev/disk/by-path/*-sas-exp*-lun-0}
DISK_LOW_TEMPERATURE_THRESHOLD=40 # at/below this -> LOW_FAN_SPEED (idle spread is 32-39c)
DISK_HIGH_TEMPERATURE_THRESHOLD=50 # at/above this -> HIGH_FAN_SPEED