Page 2 of 10
Re: HowTo: monitor Synology NAS
Posted: Wednesday 12 February 2014 22:21
by rvmourik
@mbliek Nice!
Re: HowTo: monitor Synology NAS
Posted: Wednesday 12 February 2014 22:25
by rvmourik
There is a small typo in the synology part of the wiki. You Copied the enabling SNMP on QNAP to the synology part
Re: HowTo: monitor Synology NAS
Posted: Wednesday 12 February 2014 22:27
by mbliek
rvmourik wrote:
There is a small typo in the synology part of the wiki. You Copied the enabling SNMP on QNAP to the synology part
Oeps
changed.
You can also edit the wiki page if you want
Re: HowTo: monitor Synology NAS
Posted: Wednesday 12 February 2014 22:29
by rvmourik
I know, but currently using the smartphone. with all the stupid auto correct not very nice while editing a wiki
Re: HowTo: monitor Synology NAS
Posted: Thursday 13 February 2014 16:17
by Nixta
Hi
I was trying this script.
I got some weird numbers from it? Any id?
How can i add all my hdd from my synology nas. I've got 4 drives. need temp and space
Thanks for a great script.
/Niklas
Re: HowTo: monitor Synology NAS
Posted: Thursday 13 February 2014 16:42
by mbliek
I'm sorry, can't help you really with this.
Since I don't have a sinology.
But I think its caused by the snmp numbers.
You should look on the internet for the right snmp numbers for your NAS.
It's the last number of:
snmpget -v 2c -c $PASSWORD -O qv $NASIP 1.3.6.1.4.1.6574.2.1.1.6.0
this you need to change:
1.3.6.1.4.1.6574.2.1.1.6.0
Re: HowTo: monitor Synology NAS
Posted: Thursday 13 February 2014 18:54
by Nixta
Ok. Thank you for your input
I Read this document on mib from synology:
http://www.synology.com/en-global/support/snmp_mib
Looks like the Numbers in the example on this forum and the doc in the attached link is the same.
Could anyone please verify?
Re: HowTo: monitor Synology NAS
Posted: Thursday 13 February 2014 19:23
by rvmourik
The "easy" way is to use snmpwalk, using this you can find out the right numbers.
For example if this is a number of a disk:
1.3.6.1.4.1.6574.2.1.1.6.0
You can use snmpwalk with:
1.3.6.1.4.1.6574.2.1.1.6
To find out al underlaying possibilities.
I know its not a complete how-to but i hope it helps you
Re: HowTo: monitor Synology NAS
Posted: Thursday 13 February 2014 19:33
by Nixta
Hmmmm
This is what i get when running it direct on synology
SYNOLOGY-DISK-MIB::DiskTemperature.0 = INTEGER: -1
SYNOLOGY-DISK-MIB::DiskTemperature.1 = INTEGER: -1
SYNOLOGY-DISK-MIB::DiskTemperature.2 = INTEGER: -1
SYNOLOGY-DISK-MIB::DiskTemperature.3 = INTEGER: -1
??????
Re: HowTo: monitor Synology NAS
Posted: Thursday 13 February 2014 19:36
by rvmourik
The sequence i gave was just an example. But as you can see this sequence contains 4 disks.
I don't know why it outputs -1
But this way you can find out which sequence you need to use to get the right information
Re: HowTo: monitor Synology NAS
Posted: Thursday 13 February 2014 19:41
by Nixta
i ran
snmpwalk -c public -v2c localhost synoDisk
didn't try your numbers
i will keep searching
Re: HowTo: monitor Synology NAS
Posted: Thursday 13 February 2014 20:08
by rvmourik
Good luck!
Re: HowTo: monitor Synology NAS
Posted: Thursday 13 February 2014 20:11
by Nixta
thank you and thank you for trying to help me..
I'll let you know if i find a solution
Re: HowTo: monitor Synology NAS
Posted: Thursday 13 February 2014 20:39
by Nixta
Upgraded synology dsm 4.3 3210 to 4.3 3810 and vola... there it is
Re: HowTo: monitor Synology NAS
Posted: Thursday 13 February 2014 20:40
by rvmourik
Nice!
Re: HowTo: monitor Synology NAS
Posted: Friday 14 February 2014 8:27
by Nixta
Hi
Just wanted to show you the result.
Cheers
/Niklas
Re: HowTo: monitor Synology NAS
Posted: Friday 14 February 2014 8:29
by mbliek
Looking good
Glad it's solved.
Re: HowTo: monitor Synology NAS
Posted: Friday 14 February 2014 11:44
by BigDog
Nixta can you post your script here so we can have a look how you add the other HD's into the script
Greetz Bob
HowTo: monitor Synology NAS
Posted: Friday 14 February 2014 12:42
by Nixta
Ok here it is!
--------------------------------
What should i now do with Domoticz? Any idees?
RPI, Domoticz, telldus and tellestick
*got 10 switches, 2 inwall.
*got 2 scenes: Home And away. Would like to have raspbmc on my second Rpi turn light off when startin Movie. But don't know how?
Should i buy razberry and go with Z-wave Products? pros and Cons?
-------------------------------------------------
#!/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: Saturday 15 February 2014 19:28
by ThaBoo
@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 (99.86 KiB) Viewed 3498 times