Scripts/R710-IPMI-TEMP/R710-IPMITemp.sh
NoLooseEnds de9c1fca80 Added healthchecks.io to the script instead
Added healthchecks.io to the script instead of cron command. That way I get a notification if the script triggers the dynamic fans.
2018-04-12 23:47:14 +02:00

38 lines
No EOL
1.5 KiB
Bash
Executable file
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env bash
# ----------------------------------------------------------------------------------
# Script for checking the temperature reported by the ambient temperature sensor,
# and if deemed to high send the raw IPMI command to enable dynamic fan control.
#
# Requires ipmitool  apt-get install ipmitool
# Tested on Ubuntu 17.04
# ----------------------------------------------------------------------------------
# IPMI DEFAULT R710 SETTINGS
# Modify to suit your needs.
IPMIHOST=192.168.0.120
IPMIUSER=root
IPMIPW=calvin
# TEMPERATURE
# Change this to the temperature in celcius you are comfortable with.
# If it goes above it will send raw IPMI command to enable dynamic fan control
MAXTEMP=27
# This variable sends a IPMI command to get the temperature, and outputs it as two digits.
# Do not edit unless you know what you do.
TEMP=$(ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW sdr type temperature |grep Ambient |grep degrees |grep -Po '\d{2}' | tail -1)
if [[ $TEMP > $MAXTEMP ]];
then
printf "Temperature is too high! Activating dynamic fan control! ($TEMP C)" | systemd-cat -t R710-IPMI-TEMP
echo "Temperature is too high! Activating dynamic fan control! ($TEMP C)"
ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW raw 0x30 0x30 0x01 0x01
else
# healthchecks.io
curl -fsS --retry 3 https://hchk.io/8470021f-33f3-4a31-b2cd-741f28c47164 >/dev/null 2>&1
printf "Temperature is OK ($TEMP C)" | systemd-cat -t R710-IPMI-TEMP
echo "Temperature is OK ($TEMP C)"
fi