Local iDRAC management

This commit is contained in:
tigerblue77 2022-04-11 19:01:44 +02:00
parent 885e899222
commit 82d94b6733
3 changed files with 25 additions and 10 deletions

View File

@ -21,8 +21,9 @@ 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 IDRAC_HOST 192.168.1.100
ENV IDRAC_HOST local
#ENV IDRAC_USER root
#ENV IDRAC_PW calvin
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

@ -1,3 +1,5 @@
#!/bin/bash
IPMIHOST=`cat /host.txt`
IPMIUSER=`cat /user.txt`
IPMIPW=`cat /pw.txt`
@ -5,15 +7,22 @@ FANSPEED=`cat /fanspeed.txt`
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"
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
ipmitool -I $LOGIN_STRING 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
ipmitool -I $LOGIN_STRING raw 0x30 0x30 0x01 0x00
ipmitool -I $LOGIN_STRING raw 0x30 0x30 0x02 0xff $FANSPEED
fi

View File

@ -1,9 +1,14 @@
#!/bin/bash
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`"
if [[ $IDRAC_HOST != "local" ]]
then
echo "User: `cat /user.txt`"
echo "PW: `cat /pw.txt`"
fi
echo "Fan speed `cat /fanspeed.txt`"