-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
102 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2024 pdiddy973 | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
function get_temp { | ||
local TEMP=$(ipmitool -I lanplus -H $IDRAC_HOST -U $IDRAC_USER -P $IDRAC_PW sdr type temperature | grep Exhaust | grep -o -e '[0-9][0-9] degrees' | grep -o -e '[0-9][0-9]') | ||
echo $TEMP | ||
} | ||
|
||
function set_speed { | ||
ipmitool -I lanplus -H $IDRAC_HOST -U $IDRAC_USER -P $IDRAC_PW raw 0x30 0x30 0x02 0xff $HEX > /dev/null | ||
} | ||
|
||
TEMP=$(get_temp) | ||
if [ "$TEMP" -ge 0 ] && [ "$TEMP" -lt 35 ]; then | ||
echo "Exhaust Temperature is $TEMP : Setting fan speed to 20%" | ||
HEX=0x14 | ||
set_speed | ||
elif [ "$TEMP" -ge 35 ] && [ "$TEMP" -lt 40 ]; then | ||
echo "Exhaust Temperature is $TEMP : Setting fan speed to 30%" | ||
HEX=0x1e | ||
set_speed | ||
elif [ "$TEMP" -ge 40 ] && [ "$TEMP" -lt 45 ]; then | ||
echo "Exhaust Temperature is $TEMP : Setting fan speed to 40%" | ||
HEX=0x28 | ||
set_speed | ||
elif [ "$TEMP" -ge 45 ] && [ "$TEMP" -lt 50 ]; then | ||
echo "Exhaust Temperature is $TEMP : Setting fan speed to 50%" | ||
HEX=0x32 | ||
set_speed | ||
elif [ "$TEMP" -ge 50 ] && [ "$TEMP" -lt 55 ]; then | ||
echo "Exhaust Temperature is $TEMP : Setting fan speed to 60%" | ||
HEX=0x3c | ||
set_speed | ||
elif [ "$TEMP" -ge 55 ] && [ "$TEMP" -lt 60 ]; then | ||
echo "Exhaust Temperature is $TEMP : Setting fan speed to 70%" | ||
HEX=0x46 | ||
set_speed | ||
elif [ "$TEMP" -ge 60 ] && [ "$TEMP" -lt 70 ]; then | ||
echo "Exhaust Temperature is $TEMP : Setting fan speed to 80%" | ||
HEX=0x50 | ||
set_speed | ||
elif [ "$TEMP" -ge 70 ] && [ "$TEMP" -lt 80 ]; then | ||
echo "Exhaust Temperature is $TEMP : Setting fan speed to 90%" | ||
HEX=0x5a | ||
set_speed | ||
elif [ "$TEMP" -ge 80 ] && [ "$TEMP" -le 100 ]; then | ||
echo "Exhaust Temperature is $TEMP : Setting fan speed to 100%" | ||
HEX=0x64 | ||
set_speed | ||
else | ||
echo "Temperature $TEMP: Was not able to get proper tempature" | ||
fi | ||
|
||
sleep "$CHECK_INTERVAL"s | ||
exec "/opt/adaptivefancontrol.sh" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* * * * * /opt/adaptivefancontrol.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
version: '3' | ||
services: | ||
dell-idrac-fancontrol: | ||
image: pdiddy973/dell-idrac-fancontrol:latest | ||
container_name: dell-idrac-fancontrol | ||
restart: unless-stopped | ||
environment: | ||
- IDRAC_HOST= | ||
- IDRAC_USER= | ||
- IDRAC_PW= | ||
- CHECK_INTERVAL= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
FROM alpine:edge | ||
|
||
RUN apk --no-cache add ipmitool apk-cron | ||
|
||
COPY crontab /etc/cron.d/fan-control | ||
COPY adaptivefancontrol.sh /opt/adaptivefancontrol.sh | ||
RUN chmod 0777 /etc/cron.d/fan-control && \ | ||
chmod 0777 /opt/*.sh && \ | ||
/usr/bin/crontab /etc/cron.d/fan-control | ||
|
||
# These can be overridden at runtime | ||
ENV IDRAC_HOST=192.168.0.240 \ | ||
IDRAC_USER=root \ | ||
IDRAC_PW=calvin \ | ||
CHECK_INTERVAL=30 | ||
|
||
CMD /opt/adaptivefancontrol.sh && crond |