Update power.inc.sh

This commit is contained in:
2025-08-12 21:06:17 -05:00
parent 5dc26d0e2c
commit 40f48d34b5

View File

@@ -1475,22 +1475,6 @@ POWERLOGGER_SERVICE(){
KYLE_AMP=0
KYLE_WATT=0
fi
KYLE_INFO=$(curl -m 3 -s http://${PW_REMOTE_SENSORS['KP-SAS']}:8888/status/${PW_SENSOR_DEVICEID['KP-SAS']} | jq '.dps')
if [ "${KYLE_INFO}" != "" ]; then
KYLE_AMP=$(echo "${KYLE_INFO}" | grep '"18":' | cut -d' ' -f 4 | sed 's/,//g' | tr -d $'\r')
KYLE_AMP=$(ROUND_NUMBER $(echo "scale=3; ${KYLE_AMP}/1000" | tr -d $'\r' | bc -l) 2)
KYLE_WATT=$(echo "${KYLE_INFO}" | grep '"19":' | cut -d' ' -f 4 | sed 's/,//g' | tr -d $'\r')
KYLE_WATT=$(echo "scale=1; ${KYLE_WATT}/10" | tr -d $'\r' | bc -l)
KYLE_VOLT=$(echo "${KYLE_INFO}" | grep '"20":' | cut -d' ' -f 4 | sed 's/,//g' | tr -d $'\r')
KYLE_VOLT=$(echo "scale=3; ${KYLE_VOLT}/10" | tr -d $'\r' | bc -l)
QRY="INSERT INTO power_data (sensorid, date, volt, amp, watt) VALUES ('${PW_POWERSENSOR_ID['KP-SAS']}',CONVERT_TZ('${LogDataTime}', 'America/Chicago', 'UTC'),'${KYLE_VOLT}','${KYLE_AMP}','${KYLE_WATT}')"
${mysql_conn} -e "USE servermonitor; ${QRY}"
else
KYLE_AMP=0
KYLE_WATT=0
fi
[ "${PW_OFFSITE_MONITOR}" == "${IP}" ] && upsinfo=$(upsc offsite-ups 2>&1) || upsinfo=$(${SSHCMD} root@${PW_OFFSITE_MONITOR} 'upsc offsite-ups' 2>&1)