Initial commit
This commit is contained in:
commit
b78154d176
2
.dockerignore
Normal file
2
.dockerignore
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
publish.sh
|
||||||
|
README.md
|
||||||
28
Dockerfile
Normal file
28
Dockerfile
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
FROM ubuntu:latest
|
||||||
|
|
||||||
|
RUN apt-get update
|
||||||
|
|
||||||
|
RUN apt-get install ipmitool cron -y
|
||||||
|
|
||||||
|
COPY crontab /etc/cron.d/fan-control
|
||||||
|
|
||||||
|
RUN chmod 0777 /etc/cron.d/fan-control
|
||||||
|
|
||||||
|
RUN touch /var/log/cron.log
|
||||||
|
|
||||||
|
ADD check-temp.sh /opt/check-temp.sh
|
||||||
|
|
||||||
|
ADD startup.sh /startup.sh
|
||||||
|
|
||||||
|
RUN chmod 0777 /opt/check-temp.sh
|
||||||
|
|
||||||
|
RUN chmod 0777 /startup.sh
|
||||||
|
|
||||||
|
RUN /usr/bin/crontab /etc/cron.d/fan-control
|
||||||
|
|
||||||
|
# you should override these when running. See README.md
|
||||||
|
ENV IDRAC_HOST 192.168.1.100
|
||||||
|
ENV IDRAC_USER root
|
||||||
|
ENV IDRAC_PW calvin
|
||||||
|
ENV FANSPEED 0x05
|
||||||
|
CMD /startup.sh && cron && tail -f /var/log/cron.log
|
||||||
22
README.md
Normal file
22
README.md
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
# IDRAC Fan Controller Docker Image
|
||||||
|
|
||||||
|
To use,
|
||||||
|
|
||||||
|
`docker run -e IDRAC_HOST=<host ip> -e IDRAC_USER=<username> -e IDRAC_PW=<password> -e FANSPEED=<hex fan speed> alombardo4/idrac-fan-control:latest`
|
||||||
|
|
||||||
|
`FANSPEED` should be set as a hex value, e.g. `0x05`
|
||||||
|
|
||||||
|
Example `docker-compose.yml`:
|
||||||
|
|
||||||
|
```yml
|
||||||
|
version: '3'
|
||||||
|
|
||||||
|
services:
|
||||||
|
fan-controller:
|
||||||
|
image: alombardo4/idrac-fan-control
|
||||||
|
environment:
|
||||||
|
- IDRAC_HOST=192.168.1.100 # override to the IP of your IDRAC
|
||||||
|
- IDRAC_USER=root # set to your IPMI username
|
||||||
|
- IDRAC_PW=calvin # set to your IPMI password
|
||||||
|
- FANSPEED=0x05 # set to the hex value you want to set the fans to (from 0 to 100)
|
||||||
|
```
|
||||||
19
check-temp.sh
Executable file
19
check-temp.sh
Executable file
@ -0,0 +1,19 @@
|
|||||||
|
IPMIHOST=`cat /host.txt`
|
||||||
|
IPMIUSER=`cat /user.txt`
|
||||||
|
IPMIPW=`cat /pw.txt`
|
||||||
|
FANSPEED=`cat /fanspeed.txt`
|
||||||
|
|
||||||
|
MAXTEMP=32
|
||||||
|
|
||||||
|
TEMP=$(ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW sdr type temperature |grep Ambient |grep degrees |grep -Po '\d{2}' | tail -1)
|
||||||
|
|
||||||
|
echo "Current Temp is $TEMP C"
|
||||||
|
if [ $TEMP -gt $MAXTEMP ];
|
||||||
|
then
|
||||||
|
echo "Temp is too high. Activating dynamic fan control"
|
||||||
|
ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW raw 0x30 0x30 0x01 0x01
|
||||||
|
else
|
||||||
|
echo "Temp is OK. Using manual fan control"
|
||||||
|
ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW raw 0x30 0x30 0x01 0x00
|
||||||
|
ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW raw 0x30 0x30 0x02 0xff $FANSPEED
|
||||||
|
fi
|
||||||
1
crontab
Normal file
1
crontab
Normal file
@ -0,0 +1 @@
|
|||||||
|
* * * * * /bin/bash -c "/opt/check-temp.sh &> /var/log/cron.log"
|
||||||
2
publish.sh
Executable file
2
publish.sh
Executable file
@ -0,0 +1,2 @@
|
|||||||
|
docker build . -t alombardo4/idrac-fan-control:latest && \
|
||||||
|
docker push alombardo4/idrac-fan-control
|
||||||
9
startup.sh
Normal file
9
startup.sh
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
echo $IDRAC_HOST >> /host.txt
|
||||||
|
echo $IDRAC_USER >> /user.txt
|
||||||
|
echo $IDRAC_PW >> /pw.txt
|
||||||
|
echo $FANSPEED >> /fanspeed.txt
|
||||||
|
|
||||||
|
echo "Host: `cat /host.txt`"
|
||||||
|
echo "User: `cat /user.txt`"
|
||||||
|
echo "PW: `cat /pw.txt`"
|
||||||
|
echo "Fan speed `cat /fanspeed.txt`"
|
||||||
Loading…
Reference in New Issue
Block a user