i recently set up my hp micro server with open media vault 4. now i wanted to log the hdd temperatures on pimatic and found this https://forum.pimatic.org/topic/2134/values-from-synology that @Stokstaart wrote which i now want to adopt for omv 4 servers.
first step is get the devices
you find the device names under “Storage -> Disks”
next step is to install curl and write the script for getting temperatures.
so ssh into your server. i did this using the root user.
then install curl using
apt-get install -y curl.
i then created a script folder and the script itself.
mkdir /usr/scripts nano /usr/scripts/get_hdd_temp.sh
in nano enter the following script (adopt it to your needs [user, pass, pimaticip, devices])
#!/bin/sh TEMP1=$(smartctl -n standby -d sat -A /dev/sda | grep -i Temperature_Celsius | tr -s ' ' | cut -d\ -f 10) TEMP2=$(smartctl -n standby -d sat -A /dev/sdb | grep -i Temperature_Celsius | tr -s ' ' | cut -d\ -f 10) TEMP3=$(smartctl -n standby -d sat -A /dev/sdc | grep -i Temperature_Celsius | tr -s ' ' | cut -d\ -f 10) if ( ! test -z $TEMP1 ); then curl --user USER:PASS -X PATCH "http://PIMATICIP/api/variables/nas_temp_disk_1?type=value&valueOrExpression=$TEMP1"; fi if ( ! test -z $TEMP2 ); then curl --user USER:PASS -X PATCH "http://PIMATICIP/api/variables/nas_temp_disk_2?type=value&valueOrExpression=$TEMP2"; fi if ( ! test -z $TEMP3 ); then curl --user USER:PASS -X PATCH "http://PIMATICIP/api/variables/nas_temp_disk_3?type=value&valueOrExpression=$TEMP3"; fi
what’s the difference to the thread linked on the top? here the drive status is considered. i had the problems that getting the temperature woke up the drives. so if a drive is in standby no temp is received and no temp will be sent to pimatic.
as you can see the devices from the first image are back here. you can duplicate those lines for each device you have.
finally the script needs to be marked as executable:
chmod +x /usr/scripts/get_hdd_temp.sh
and a little test run
next step is to execute the script regularly. i configured this via the omv webinterface (System -> Scheduled Jobs).
here comes the important part: smartctl prevents the drives from spinning down into standby (at least for me). i have configured the drives to spin down after 5 minutes, so the interval for the script needs to be higher that the spindown interval.
thats it for the server side.
at first you have to generate the variables used in the script.
and repeat this for all hdds you have so that it looks something linke this
now pimatic is already able to receive the temperatures.
if you want to display them you have to create a new device
and in the variables section (again for each single hdd / created variable)
after this it should look something ike this: