From 704c8619a622ef9f67c469053d214442430b7ac8 Mon Sep 17 00:00:00 2001 From: Marko Korhonen Date: Tue, 18 Feb 2020 15:44:17 +0200 Subject: [PATCH] Move ipmi scripts to mqtt --- home/Scripts/ipmi/fans.sh | 12 ++++++------ home/Scripts/ipmi/temp.sh | 2 +- secrets/env | 1 + secrets/secrets.sh | 1 + 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/home/Scripts/ipmi/fans.sh b/home/Scripts/ipmi/fans.sh index 3649a0ca..17dc4b08 100755 --- a/home/Scripts/ipmi/fans.sh +++ b/home/Scripts/ipmi/fans.sh @@ -11,9 +11,9 @@ DATA=`ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW -y $IPMIEK sdr ge 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 +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)" diff --git a/home/Scripts/ipmi/temp.sh b/home/Scripts/ipmi/temp.sh index 72caa949..e9b47d47 100755 --- a/home/Scripts/ipmi/temp.sh +++ b/home/Scripts/ipmi/temp.sh @@ -9,7 +9,7 @@ TEMP=$(ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW -y $IPMIEK sdr t mkdir -p /tmp/ipmi -echo $TEMP > /tmp/ipmi/temp +mosquitto_pub -u reekynet -P {{@@ env['PASS_MQTT'] @@}} -t "ipmi/temp" -m "$TEMP" if [[ $TEMP > $MAXTEMP ]]; diff --git a/secrets/env b/secrets/env index 1883ef69..73aa9fed 100755 --- a/secrets/env +++ b/secrets/env @@ -7,6 +7,7 @@ export PASS_ARIA2="$(pass linux/aria2 | head -n 1)" export PASS_MPD="$(pass linux/mpd | head -n 1)" export PASS_MPD_ADMIN="$(pass linux/mpd-admin | head -n 1)" export PASS_IPMI="$(pass reekynet/idrac | head -n 1)" +export PASS_MQTT="$(pass reekynet/mqtt.reekynet.com | head -n 1)" export ME_FULLNAME="$(pass me | head -n 1)" export ME_ADDRESS="$(pass me | rg 'address' | cut -d' ' -f2-)" diff --git a/secrets/secrets.sh b/secrets/secrets.sh index c1ae535f..78c68db6 100755 --- a/secrets/secrets.sh +++ b/secrets/secrets.sh @@ -11,6 +11,7 @@ export PASS_ARIA2="$PASS_ARIA2" export PASS_MPD="$PASS_MPD" export PASS_MPD_ADMIN="$PASS_MPD_ADMIN" export PASS_IPMI="$PASS_IPMI" +export PASS_MQTT="$PASS_MQTT" export ME_FULLNAME="$ME_FULLNAME" export ME_ADDRESS="$ME_ADDRESS"