From fb06f8f26457b6cd97106c002bd327bd2f1ed9e5 Mon Sep 17 00:00:00 2001 From: Marko Korhonen Date: Mon, 17 Feb 2020 15:09:09 +0200 Subject: [PATCH] Add more ipmi stuff --- config-root.yaml | 6 +----- docker/homeautomation/docker-compose.yml | 2 +- home/Scripts/ipmi/fans.sh | 20 +++++++++---------- home/Scripts/ipmi/temp.sh | 4 +++- .../systemd/system/ipmi/ipmi-static.service | 2 +- .../etc/systemd/system/ipmi/ipmi-temp.service | 2 +- 6 files changed, 17 insertions(+), 19 deletions(-) diff --git a/config-root.yaml b/config-root.yaml index 23d66cb..200d311 100644 --- a/config-root.yaml +++ b/config-root.yaml @@ -120,11 +120,6 @@ dotfiles: src: etc/systemd/system/ipmi dst: /etc/systemd/system/ipmi profiles: - IPMI: - dotfiles: - - f_ipmi-temp.timer - - f_ipmi-temp.service - - f_ipmi-static.service Locale: dotfiles: - f_locale.conf @@ -184,3 +179,4 @@ profiles: dotfiles: - f_sshd_config - f_99-sysctl.conf + - d_ipmi diff --git a/docker/homeautomation/docker-compose.yml b/docker/homeautomation/docker-compose.yml index 946b5e7..9d2ccbc 100644 --- a/docker/homeautomation/docker-compose.yml +++ b/docker/homeautomation/docker-compose.yml @@ -7,7 +7,7 @@ services: - TZ=Europe/Helsinki volumes: - /docker/homeautomation/home-assistant:/config - - /tmp/idrac-temp:/idrac-temp + - /tmp/ipmi:/ipmi - /etc/localtime:/etc/localtime:ro restart: always networks: diff --git a/home/Scripts/ipmi/fans.sh b/home/Scripts/ipmi/fans.sh index b25f111..3649a0c 100755 --- a/home/Scripts/ipmi/fans.sh +++ b/home/Scripts/ipmi/fans.sh @@ -4,16 +4,16 @@ IPMIHOST=10.0.0.82 IPMIUSER=ReekyMarko IPMIPW={{@@ env['PASS_IPMI'] @@}} IPMIEK=0000000000000000000000000000000000000000 -MAXTEMP=27 -TEMP=$(ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW -y $IPMIEK sdr type temperature |grep Ambient |grep degrees |grep -Po '\d{2}' | tail -1) -echo $TEMP > /tmp/idrac-temp +mkdir -p /tmp/ipmi +DATA=`ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW -y $IPMIEK sdr get "FAN 1 RPM" "FAN 2 RPM" "FAN 3 RPM" "FAN 4 RPM" "FAN 5 RPM" "FAN 6 RPM" | grep "Sensor Reading" | awk '{ print $4 }'` -if [[ $TEMP > $MAXTEMP ]]; - then - printf "Warning: Temperature is too high! Activating dynamic fan control! ($TEMP C)" - ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW -y $IPMIEK raw 0x30 0x30 0x01 0x01 - else - printf "Temperature is OK ($TEMP C)" -fi +echo "$DATA" + +echo "$DATA" | head -1 | tail -1> /tmp/ipmi/fan1 +echo "$DATA" | head -2 | tail -1> /tmp/ipmi/fan2 +echo "$DATA" | head -3 | tail -1> /tmp/ipmi/fan3 +echo "$DATA" | head -4 | tail -1> /tmp/ipmi/fan4 +echo "$DATA" | head -5 | tail -1> /tmp/ipmi/fan5 +echo "$DATA" | head -6 | tail -1> /tmp/ipmi/fan6 diff --git a/home/Scripts/ipmi/temp.sh b/home/Scripts/ipmi/temp.sh index b25f111..72caa94 100755 --- a/home/Scripts/ipmi/temp.sh +++ b/home/Scripts/ipmi/temp.sh @@ -7,7 +7,9 @@ IPMIEK=0000000000000000000000000000000000000000 MAXTEMP=27 TEMP=$(ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW -y $IPMIEK sdr type temperature |grep Ambient |grep degrees |grep -Po '\d{2}' | tail -1) -echo $TEMP > /tmp/idrac-temp +mkdir -p /tmp/ipmi + +echo $TEMP > /tmp/ipmi/temp if [[ $TEMP > $MAXTEMP ]]; diff --git a/root/etc/systemd/system/ipmi/ipmi-static.service b/root/etc/systemd/system/ipmi/ipmi-static.service index 9588c2a..fb5c1bf 100644 --- a/root/etc/systemd/system/ipmi/ipmi-static.service +++ b/root/etc/systemd/system/ipmi/ipmi-static.service @@ -3,7 +3,7 @@ Description=Set fan speed [Service] Type=simple -ExecStart=/home/balrog/Scripts/ipmi-static.sh +ExecStart=/home/balrog/Scripts/ipmi/static.sh [Install] WantedBy=multi-user.target diff --git a/root/etc/systemd/system/ipmi/ipmi-temp.service b/root/etc/systemd/system/ipmi/ipmi-temp.service index fc231cb..64a9615 100644 --- a/root/etc/systemd/system/ipmi/ipmi-temp.service +++ b/root/etc/systemd/system/ipmi/ipmi-temp.service @@ -3,7 +3,7 @@ Description=Watch server temperature [Service] Type=simple -ExecStart=/home/balrog/Scripts/ipmi-temp.sh +ExecStart=/home/balrog/Scripts/ipmi/temp.sh [Install] WantedBy=multi-user.target