Page 3 of 10
Re: HowTo: monitor Synology NAS
Posted: Saturday 15 February 2014 23:02
by mbliek
ThaBoo wrote:@rvmourik Thanx for the script!
Got it all set up within 30 minutes.
Configuration: DS1010+ DSM 4.3-3810, Raspberry PI Domoticz V1.1492 ( and a Plugwise Circle for the power consumption)
Synology Domotics.gif
What device do you use for the free HD space?
Re: HowTo: monitor Synology NAS
Posted: Sunday 16 February 2014 0:34
by rvmourik
It looks like a virtual meter device
Re: HowTo: monitor Synology NAS
Posted: Sunday 16 February 2014 0:35
by rvmourik
ThaBoo wrote:@rvmourik Thanx for the script!
Got it all set up within 30 minutes.
Configuration: DS1010+ DSM 4.3-3810, Raspberry PI Domoticz V1.1492 ( and a Plugwise Circle for the power consumption)
Synology Domotics.gif
You're welcome, good to hear you got it setup so quickly
Re: HowTo: monitor Synology NAS
Posted: Sunday 16 February 2014 10:01
by mbliek
rvmourik wrote:It looks like a virtual meter device
It does, but there are more kinds of counters
Re: HowTo: monitor Synology NAS
Posted: Sunday 16 February 2014 17:51
by BigDog
i have a little problem with the new script it wont Work
if i run the script with the new settings it shows nothing only this below
Code: Select all
pi@raspberrypi ~/domoticz/scripts $ ./nas3.sh
1.342
./nas3.sh: line 161: syntax error: unexpected end of file
have anyone the same problem ? or do's anyone know what the problem is?
Re: HowTo: monitor Synology NAS
Posted: Sunday 16 February 2014 17:57
by mbliek
There is a fault on line 161 in your file. Can you post you script?
Re: HowTo: monitor Synology NAS
Posted: Sunday 16 February 2014 18:43
by BigDog
i have copy paste the script with my own settings like below
i only have altered the nasip and idx and stuff thats all
Code: Select all
#!/bin/bash
# Settings
NASIP="192.168.0.190" # NAS IP Address
PASSWORD="password" # SNMP Password
DOMO_IP="192.168.0.182" # Domoticz IP Address
DOMO_PORT="1111" # Domoticz Port
NAS_IDX="15" # NAS Switch IDX
NAS_HD1_TEMP_IDX="12" # NAS HD1 Temp IDX
NAS_HD2_TEMP_IDX="13" # NAS HD2 Temp IDX
NAS_HD3_TEMP_IDX="16" # NAS HD3 Temp IDX
NAS_HD4_TEMP_IDX="17" # NAS HD4 Temp IDX
NAS_HD1_SPACE_IDX="14" # NAS HD1 Temp IDX
NAS_HD2_SPACE_IDX="18" # NAS HD2 Temp IDX
NAS_HD3_SPACE_IDX="19" # NAS HD3 Temp IDX
NAS_HD4_SPACE_IDX="20" # NAS HD4 Temp IDX
# Check if NAS in online
PINGTIME=`ping -c 1 -q $NASIP | awk -F"/" '{print $5}' | xargs`
echo $PINGTIME
if expr "$PINGTIME" '>' 0
then
curl -s "http://$DOMO_IP:$DOMO_PORT/json.htm?type=devices&rid=$NAS_IDX" | grep "Status" | grep "On" > /dev/null
if [ $? -eq 0 ] ; then
echo "NAS already ON"
# Temperature HD1
HDtemp1=`snmpget -v 2c -c $PASSWORD -O qv $NASIP .1.3.6.1.4.1.6574.2.1.1.6.0`
# Send data
curl -s -i -H "Accept: application/json" "http://$DOMO_IP:$DOMO_PORT/json.htm?type=command¶m=udevice&idx=$NAS_HD1_TEMP_IDX&nvalue=0&svalue=$HDtemp1"
# Temperature HD2
HDtemp2=`snmpget -v 2c -c $PASSWORD -O qv $NASIP .1.3.6.1.4.1.6574.2.1.1.6.1`
# Send data
curl -s -i -H "Accept: application/json" "http://$DOMO_IP:$DOMO_PORT/json.htm?type=command¶m=udevice&idx=$NAS_HD2_TEMP_IDX&nvalue=0&svalue=$HDtemp2"
# Temperature HD3
HDtemp3=`snmpget -v 2c -c $PASSWORD -O qv $NASIP .1.3.6.1.4.1.6574.2.1.1.6.2`
# Send data
curl -s -i -H "Accept: application/json" "http://$DOMO_IP:$DOMO_PORT/json.htm?type=command¶m=udevice&idx=$NAS_HD3_TEMP_IDX&nvalue=0&svalue=$HDtemp3"
# Temperature HD4
HDtemp4=`snmpget -v 2c -c $PASSWORD -O qv $NASIP .1.3.6.1.4.1.6574.2.1.1.6.3`
# Send data
curl -s -i -H "Accept: application/json" "http://$DOMO_IP:$DOMO_PORT/json.htm?type=command¶m=udevice&idx=$NAS_HD4_TEMP_IDX&nvalue=0&svalue=$HDtemp4"
# Free space Volym1
HDUnit=`snmpget -v 2c -c $PASSWORD -O qv $NASIP .1.3.6.1.2.1.25.2.3.1.4.36`
HDTotal=`snmpget -v 2c -c $PASSWORD -O qv $NASIP .1.3.6.1.2.1.25.2.3.1.5.36`
HDUsed=`snmpget -v 2c -c $PASSWORD -O qv $NASIP .1.3.6.1.2.1.25.2.3.1.6.36`
HDFree=$((($HDTotal - $HDUsed) * $HDUnit / 1024 / 1024 / 1024))
# Send data
curl -s -i -H "Accept: application/json" "http://$DOMO_IP:$DOMO_PORT/json.htm?type=command¶m=udevice&idx=$NAS_HD1_SPACE_IDX&nvalue=0&svalue=$HDFree"
# Free space Volym 2
HDUnit=`snmpget -v 2c -c $PASSWORD -O qv $NASIP .1.3.6.1.2.1.25.2.3.1.4.37`
HDTotal=`snmpget -v 2c -c $PASSWORD -O qv $NASIP .1.3.6.1.2.1.25.2.3.1.5.37`
HDUsed=`snmpget -v 2c -c $PASSWORD -O qv $NASIP .1.3.6.1.2.1.25.2.3.1.6.37`
HDFree=$((($HDTotal - $HDUsed) * $HDUnit / 1024 / 1024 / 1024))
# Send data
curl -s -i -H "Accept: application/json" "http://$DOMO_IP:$DOMO_PORT/json.htm?type=command¶m=udevice&idx=$NAS_HD2_SPACE_IDX&nvalue=0&svalue=$HDFree"
# Free space Volym 3
HDUnit=`snmpget -v 2c -c $PASSWORD -O qv $NASIP .1.3.6.1.2.1.25.2.3.1.4.38`
HDTotal=`snmpget -v 2c -c $PASSWORD -O qv $NASIP .1.3.6.1.2.1.25.2.3.1.5.38`
HDUsed=`snmpget -v 2c -c $PASSWORD -O qv $NASIP .1.3.6.1.2.1.25.2.3.1.6.38`
HDFree=$((($HDTotal - $HDUsed) * $HDUnit / 1024 / 1024 / 1024))
# Send data
curl -s -i -H "Accept: application/json" "http://$DOMO_IP:$DOMO_PORT/json.htm?type=command¶m=udevice&idx=$NAS_HD3_SPACE_IDX&nvalue=0&svalue=$HDFree"
# Free space volymusb1
HDUnit=`snmpget -v 2c -c $PASSWORD -O qv $NASIP .1.3.6.1.2.1.25.2.3.1.4.39`
HDTotal=`snmpget -v 2c -c $PASSWORD -O qv $NASIP .1.3.6.1.2.1.25.2.3.1.5.39`
HDUsed=`snmpget -v 2c -c $PASSWORD -O qv $NASIP .1.3.6.1.2.1.25.2.3.1.6.39`
HDFree=$((($HDTotal - $HDUsed) * $HDUnit / 1024 / 1024 / 1024))
# Send data
curl -s -i -H "Accept: application/json" "http://$DOMO_IP:$DOMO_PORT/json.htm?type=command¶m=udevice&idx=$NAS_HD4_SPACE_IDX&nvalue=0&svalue=$HDFree"
else
echo "NAS ON"
# Send data
curl -s -i -H "Accept: application/json" "http://$DOMO_IP:$DOMO_PORT/json.htm?type=command¶m=switchlight&idx=$NAS_IDX&switchcmd=On"
# Temperature HD1
HDtemp1=`snmpget -v 2c -c $PASSWORD -O qv $NASIP .1.3.6.1.4.1.6574.2.1.1.6.0`
# Send data
curl -s -i -H "Accept: application/json" "http://$DOMO_IP:$DOMO_PORT/json.htm?type=command¶m=udevice&idx=$NAS_HD1_TEMP_IDX&nvalue=0&svalue=$HDtemp1"
# Temperature HD2
HDtemp2=`snmpget -v 2c -c $PASSWORD -O qv $NASIP .1.3.6.1.4.1.6574.2.1.1.6.1`
# Send data
curl -s -i -H "Accept: application/json" "http://$DOMO_IP:$DOMO_PORT/json.htm?type=command¶m=udevice&idx=$NAS_HD2_TEMP_IDX&nvalue=0&svalue=$HDtemp2"
# Temperature HD3
HDtemp3=`snmpget -v 2c -c $PASSWORD -O qv $NASIP .1.3.6.1.4.1.6574.2.1.1.6.2`
# Send data
curl -s -i -H "Accept: application/json" "http://$DOMO_IP:$DOMO_PORT/json.htm?type=command¶m=udevice&idx=$NAS_HD3_TEMP_IDX&nvalue=0&svalue=$HDtemp3"
# Temperature HD4
HDtemp4=`snmpget -v 2c -c $PASSWORD -O qv $NASIP .1.3.6.1.4.1.6574.2.1.1.6.3`
# Send data
curl -s -i -H "Accept: application/json" "http://$DOMO_IP:$DOMO_PORT/json.htm?type=command¶m=udevice&idx=$NAS_HD4_TEMP_IDX&nvalue=0&svalue=$HDtemp4"
# Free space Volym 1
HDUnit=`snmpget -v 2c -c $PASSWORD -O qv $NASIP .1.3.6.1.2.1.25.2.3.1.4.36`
HDTotal=`snmpget -v 2c -c $PASSWORD -O qv $NASIP .1.3.6.1.2.1.25.2.3.1.5.36`
HDUsed=`snmpget -v 2c -c $PASSWORD -O qv $NASIP .1.3.6.1.2.1.25.2.3.1.6.36`
HDFree=$((($HDTotal - $HDUsed) * $HDUnit / 1024 / 1024 / 1024))
# Send data
curl -s -i -H "Accept: application/json" "http://$DOMO_IP:$DOMO_PORT/json.htm?type=command¶m=udevice&idx=$NAS_HD1_SPACE_IDX&nvalue=0&svalue=$HDFree"
# Free space Volym 2
HDUnit=`snmpget -v 2c -c $PASSWORD -O qv $NASIP .1.3.6.1.2.1.25.2.3.1.4.37`
HDTotal=`snmpget -v 2c -c $PASSWORD -O qv $NASIP .1.3.6.1.2.1.25.2.3.1.5.37`
HDUsed=`snmpget -v 2c -c $PASSWORD -O qv $NASIP .1.3.6.1.2.1.25.2.3.1.6.37`
HDFree=$((($HDTotal - $HDUsed) * $HDUnit / 1024 / 1024 / 1024))
# Send data
curl -s -i -H "Accept: application/json" "http://$DOMO_IP:$DOMO_PORT/json.htm?type=command¶m=udevice&idx=$NAS_HD2_SPACE_IDX&nvalue=0&svalue=$HDFree"
# Free space Volym 3
HDUnit=`snmpget -v 2c -c $PASSWORD -O qv $NASIP .1.3.6.1.2.1.25.2.3.1.4.38`
HDTotal=`snmpget -v 2c -c $PASSWORD -O qv $NASIP .1.3.6.1.2.1.25.2.3.1.5.38`
HDUsed=`snmpget -v 2c -c $PASSWORD -O qv $NASIP .1.3.6.1.2.1.25.2.3.1.6.38`
HDFree=$((($HDTotal - $HDUsed) * $HDUnit / 1024 / 1024 / 1024))
# Send data
curl -s -i -H "Accept: application/json" "http://$DOMO_IP:$DOMO_PORT/json.htm?type=command¶m=udevice&idx=$NAS_HD3_SPACE_IDX&nvalue=0&svalue=$HDFree"
# Free space volymusb1
HDUnit=`snmpget -v 2c -c $PASSWORD -O qv $NASIP .1.3.6.1.2.1.25.2.3.1.4.39`
HDTotal=`snmpget -v 2c -c $PASSWORD -O qv $NASIP .1.3.6.1.2.1.25.2.3.1.5.39`
HDUsed=`snmpget -v 2c -c $PASSWORD -O qv $NASIP .1.3.6.1.2.1.25.2.3.1.6.39`
HDFree=$((($HDTotal - $HDUsed) * $HDUnit / 1024 / 1024 / 1024))
# Send data
curl -s -i -H "Accept: application/json" "http://$DOMO_IP:$DOMO_PORT/json.htm?type=command¶m=udevice&idx=$NAS_HD4_SPACE_IDX&nvalue=0&svalue=$HDFree"
fi
else
curl -s "http://$DOMO_IP:$DOMO_PORT/json.htm?type=devices&rid=$NAS_IDX" | grep "Status" | grep "Off" > /dev/null
if [ $? -eq 0 ] ; then
echo "NAS already OFF"
exit
else
echo "NAS OFF"
# Send data
curl -s -i -H "Accept: application/json" "http://$DOMO_IP:$DOMO_PORT/json.htm?type=command¶m=switchlight&idx=$NAS_IDX&switchcmd=Off"
fi
Fi
Re: HowTo: monitor Synology NAS
Posted: Sunday 16 February 2014 19:34
by mbliek
I think you should replace the very last "Fi" for "fi" so without capital.
Re: HowTo: monitor Synology NAS
Posted: Sunday 16 February 2014 19:40
by Nixta
Hi. I don't know if you use a USB disk? I do.
Volyme 1 = 2 hdd
Volume 2 = 1 hdd
Volyme 3 = 1 hdd
4 hdd together
+ 1 usb hdd
Try removing the lines with free space volumeusb1
$nasip .1.3.6.1.2.1.25.2.3.1.6.39 is for My usb volume
/Niklas
Re: HowTo: monitor Synology NAS
Posted: Sunday 16 February 2014 19:47
by mbliek
Nixta wrote:Hi. I don't know if you use a USB disk? I do.
Volyme 1 = 2 hdd
Volume 2 = 1 hdd
Volyme 3 = 1 hdd
4 hdd together
+ 1 usb hdd
Try removing the lines with free space volumeusb1
$nasip .1.3.6.1.2.1.25.2.3.1.6.39 is for My usb volume
/Niklas
I don't think it's that what cause the error.
He should see other error about that is he doesn't has an usb disk.
The bash file is unexpected closed, so this has something to do with that fi statement I think.
Re: HowTo: monitor Synology NAS
Posted: Sunday 16 February 2014 20:36
by BigDog
ahh! damn its working now its indeed de Fi it has to be fi didnt see that as a problem
thanks for the help
mbliek and niklas
have also deleted the volymusb1 and the hd3 and 4
was wondering i have sometimes a usb inserted can it be if i isterted the usb drive it see how many GB is free on it when the scripts run and if the usb is out it register nothing and if its insertd again its starts to register again?
Re: HowTo: monitor Synology NAS
Posted: Sunday 16 February 2014 20:53
by mbliek
Your welcome
It should be possible. You need to exclude the usb lookup if there is an error report back when usb is not connected.
I could try to make this work when I have time.
Re: HowTo: monitor Synology NAS
Posted: Friday 14 March 2014 16:29
by bierlaagh
Hope someone can help me.
got 2 questions:
1. wich port should i use in the nas.sh? the port used for web (in my case 8080) or the application port (6144).
2. i got as far as making nas.sh executable and it runs, (giving me a few HTTP/1.0 200 OK), but how do i get the data show up in domoticz?
Re: HowTo: monitor Synology NAS
Posted: Friday 14 March 2014 18:16
by BigDog
The poort us for the web login port 8080
The script puts the info in the dummy switches you only need to put the device id in the top of the script
Have you already add the dummy switches?
Re: HowTo: monitor Synology NAS
Posted: Friday 14 March 2014 20:09
by bierlaagh
hmz...ok, i added a dummy device just like i added my rfxcom
but from there on i am lost.
i presume the ID's in the script are the IDX="15" etc.
what do i have to add more?
sorry for all the questions, started with my RBpi and domoticz two days agoo, still a lot to learn
Re: HowTo: monitor Synology NAS
Posted: Saturday 15 March 2014 8:39
by BigDog
The dummy switch devices must be added at the dummy hardware
Make temprate dummys and a switch on the switch page and add a switch witch protocol that isnt used thats the indicator for the nas is on or not and the temprature is for the free space and temp of the hd.s
Re: HowTo: monitor Synology NAS
Posted: Saturday 15 March 2014 11:59
by bierlaagh
Finally!
Thanks bigdog...
Now I know where I went wrong.
I had to adjust the nas.sh so the IDX in the device tab, will match the one in nas.sh
Temperature and power are working now.
Next step is free space and the cronjob to work!!
- image.jpg (130.94 KiB) Viewed 4035 times
Re: HowTo: monitor Synology NAS
Posted: Saturday 15 March 2014 17:14
by BigDog
Your welcome
and good luck with setting the other things up
Re: HowTo: monitor Synology NAS
Posted: Saturday 15 March 2014 21:13
by mbliek
epierre wrote:would be interresting in the wi'i ?
It's already in the wiki
Re: HowTo: monitor Synology NAS
Posted: Saturday 15 March 2014 22:51
by bierlaagh
well ok, still have some strange issues.
free space is not giving the right counters so still have to adjust that:shock:
so still try to get that ok.
for those who also want the system temp in domoticz
Code: Select all
# Temperature SYSTEM .1.3.6.1.4.1.6574.1.2.0
SYStemp=`snmpget -v 2c -c $PASSWORD -O qv $NASIP .1.3.6.1.4.1.6574.1.2.0`
# Send data
curl -s -i -H "Accept: application/json" "http://$DOMO_IP:$DOMO_PORT/json.htm?type=command¶m=udevice&idx=$NAS_SYS_TEMP_IDX&nvalue=0&svalue=$SYStemp"
ofcourse you need to put de IDX code on top where the other codes are
Code: Select all
NAS_SYS_TEMP_IDX="44" #NAS SYSTEM Temp IDX
if someone can help me with the code for power consumption (in Watt)
- temperatuur sensor system.jpg (12.7 KiB) Viewed 4146 times