Added key unraid.temperatures to get system temperatures. Note that this only works if you have the Dynamix System Temperature plugin installed.

This commit is contained in:
Fabian Schlenz 2020-08-12 05:44:33 +02:00
parent a13fe545a1
commit 1b97010de8
2 changed files with 38 additions and 0 deletions

View File

@ -27,3 +27,4 @@ UserParameter=unraid.disk[*],/usr/local/emhttp/plugins/zabbix_agent/scripts/disk
UserParameter=unraid.disks.totals,/usr/local/emhttp/plugins/zabbix_agent/scripts/disks.totals.sh
UserParameter=unraid.qemu.discovery,/usr/local/emhttp/plugins/zabbix_agent/scripts/qemu.discovery.sh
UserParameter=unraid.qemu[*],/usr/local/emhttp/plugins/zabbix_agent/scripts/qemu.sh "$1"
UserParameter=unraid.temperatures,/usr/local/emhttp/plugins/zabbix_agent/scripts/temperatures.sh

View File

@ -0,0 +1,37 @@
#!/bin/bash
result=$( sensors )
error="$?"
if [ "$error" -gt 0 ]; then
echo '{"error": "sensors is not installed"}'
exit 1
fi
echo -n "{"
# CPU temp
line=$( grep 'CPU Temp:' <<< "$result" )
error="$?"
echo -n '"cpu": '
if [ "$error" -eq 0 ]; then
read _ _ temp _ <<< "$line"
temp="${temp#+}"
temp="${temp%°C}"
echo -n "$temp"
else
echo -n "null"
fi
# MB
line=$(grep 'MB Temp:' <<< "$result" )
error="$?"
echo -n ', "mainboard": '
if [ "$error" -eq 0 ]; then
read _ _ temp _ <<< "$line"
temp="${temp#+}"
temp="${temp%°C}"
echo -n "$temp"
else
echo -n "null"
fi
echo "}"