foodotfiles/scripts/ipmi/fans.sh

18 lines
1022 B
Bash
Raw Normal View History

2020-02-13 23:11:23 +00:00
#!/bin/bash
IPMIHOST=10.0.0.82
2020-02-13 23:11:23 +00:00
IPMIUSER=ReekyMarko
IPMIPW={{@@ env['PASS_IPMI'] @@}}
IPMIEK=0000000000000000000000000000000000000000
2020-02-17 13:09:09 +00:00
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 }'`
2020-02-13 23:11:23 +00:00
2020-02-17 13:09:09 +00:00
echo "$DATA"
2020-02-18 13:44:17 +00:00
mosquitto_pub -u reekynet -P {{@@ env['PASS_MQTT'] @@}} -t "ipmi/fan1" -m "$(echo "$DATA" | head -1 | tail -1)"
mosquitto_pub -u reekynet -P {{@@ env['PASS_MQTT'] @@}} -t "ipmi/fan2" -m "$(echo "$DATA" | head -2 | tail -1)"
mosquitto_pub -u reekynet -P {{@@ env['PASS_MQTT'] @@}} -t "ipmi/fan3" -m "$(echo "$DATA" | head -3 | tail -1)"
mosquitto_pub -u reekynet -P {{@@ env['PASS_MQTT'] @@}} -t "ipmi/fan4" -m "$(echo "$DATA" | head -4 | tail -1)"
mosquitto_pub -u reekynet -P {{@@ env['PASS_MQTT'] @@}} -t "ipmi/fan5" -m "$(echo "$DATA" | head -5 | tail -1)"
mosquitto_pub -u reekynet -P {{@@ env['PASS_MQTT'] @@}} -t "ipmi/fan6" -m "$(echo "$DATA" | head -6 | tail -1)"