Merge pull request #4 from tigerblue77/1-enable-local-idrac-management

Enable local iDRAC management
This commit is contained in:
Tigerblue77 2022-04-11 19:37:39 +02:00 committed by GitHub
commit d6499109d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 47 additions and 13 deletions

View File

@ -21,8 +21,9 @@ RUN chmod 0777 /startup.sh
RUN /usr/bin/crontab /etc/cron.d/fan-control RUN /usr/bin/crontab /etc/cron.d/fan-control
# you should override these when running. See README.md # you should override these when running. See README.md
ENV IDRAC_HOST 192.168.1.100 #ENV IDRAC_HOST 192.168.1.100
ENV IDRAC_USER root ENV IDRAC_HOST local
ENV IDRAC_PW calvin #ENV IDRAC_USER root
#ENV IDRAC_PW calvin
ENV FANSPEED 0x05 ENV FANSPEED 0x05
CMD /startup.sh && cron && tail -f /var/log/cron.log CMD /startup.sh && cron && tail -f /var/log/cron.log

View File

@ -6,17 +6,36 @@ To use,
`FANSPEED` should be set as a hex value, e.g. `0x05` `FANSPEED` should be set as a hex value, e.g. `0x05`
Example `docker-compose.yml`: `docker-compose.yml` examples:
1. to use with local iDRAC:
```yml ```yml
version: '3' version: '3'
services: services:
fan-controller: Dell_iDRAC_fan_controller:
image: alombardo4/idrac-fan-control image: alombardo4/idrac-fan-control
restart: unless-stopped
environment:
- IDRAC_HOST=local # can be omitted as it is the default value
- FANSPEED=0x05 # set to the hex value you want to set the fans to (from 0 to 100%)
devices:
- /dev/ipmi0:/dev/ipmi0
```
2. to use with LAN iDRAC:
```yml
version: '3'
services:
Dell_iDRAC_fan_controller:
image: alombardo4/idrac-fan-control
restart: unless-stopped
environment: environment:
- IDRAC_HOST=192.168.1.100 # override to the IP of your IDRAC - IDRAC_HOST=192.168.1.100 # override to the IP of your IDRAC
- IDRAC_USER=root # set to your IPMI username - IDRAC_USER=root # set to your IPMI username
- IDRAC_PW=calvin # set to your IPMI password - 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) - FANSPEED=0x05 # set to the hex value you want to set the fans to (from 0 to 100%)
``` ```

View File

@ -1,3 +1,5 @@
#!/bin/bash
IPMIHOST=`cat /host.txt` IPMIHOST=`cat /host.txt`
IPMIUSER=`cat /user.txt` IPMIUSER=`cat /user.txt`
IPMIPW=`cat /pw.txt` IPMIPW=`cat /pw.txt`
@ -5,15 +7,22 @@ FANSPEED=`cat /fanspeed.txt`
MAXTEMP=32 MAXTEMP=32
TEMP=$(ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW sdr type temperature |grep Inlet |grep degrees |grep -Po '\d{2}' | tail -1) if [[ $IPMIHOST == "local" ]]
then
LOGIN_STRING='open'
else
LOGIN_STRING="lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW"
fi
TEMP=$(ipmitool -I $LOGIN_STRING sdr type temperature |grep Inlet |grep degrees |grep -Po '\d{2}' | tail -1)
echo "Current Temp is $TEMP C" echo "Current Temp is $TEMP C"
if [ $TEMP -gt $MAXTEMP ]; if [ $TEMP -gt $MAXTEMP ];
then then
echo "Temp is too high. Activating dynamic fan control" echo "Temp is too high. Activating dynamic fan control"
ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW raw 0x30 0x30 0x01 0x01 ipmitool -I $LOGIN_STRING raw 0x30 0x30 0x01 0x01
else else
echo "Temp is OK. Using manual fan control" echo "Temp is OK. Using manual fan control"
ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW raw 0x30 0x30 0x01 0x00 ipmitool -I $LOGIN_STRING raw 0x30 0x30 0x01 0x00
ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW raw 0x30 0x30 0x02 0xff $FANSPEED ipmitool -I $LOGIN_STRING raw 0x30 0x30 0x02 0xff $FANSPEED
fi fi

View File

@ -1,9 +1,14 @@
#!/bin/bash
echo $IDRAC_HOST >> /host.txt echo $IDRAC_HOST >> /host.txt
echo $IDRAC_USER >> /user.txt echo $IDRAC_USER >> /user.txt
echo $IDRAC_PW >> /pw.txt echo $IDRAC_PW >> /pw.txt
echo $FANSPEED >> /fanspeed.txt echo $FANSPEED >> /fanspeed.txt
echo "Host: `cat /host.txt`" echo "Host: `cat /host.txt`"
echo "User: `cat /user.txt`" if [[ $IDRAC_HOST != "local" ]]
echo "PW: `cat /pw.txt`" then
echo "User: `cat /user.txt`"
echo "PW: `cat /pw.txt`"
fi
echo "Fan speed `cat /fanspeed.txt`" echo "Fan speed `cat /fanspeed.txt`"