HowTo: monitor Synology NAS

Others (MiLight, Hue, Toon etc...)

Moderator: leecollings

rvmourik
Posts: 17
Joined: Tuesday 07 January 2014 22:39
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: HowTo: monitor Synology NAS

Post by rvmourik »

@mbliek Nice!
rvmourik
Posts: 17
Joined: Tuesday 07 January 2014 22:39
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: HowTo: monitor Synology NAS

Post by rvmourik »

mbliek wrote:I made a Wiki page for the NAS monitoring.
I added the link in the first post.

http://www.domoticz.com/wiki/NAS_Monitoring

I edited your script a bit @rvmourik
There is a small typo in the synology part of the wiki. You Copied the enabling SNMP on QNAP to the synology part :-)
User avatar
mbliek
Posts: 194
Joined: Friday 12 July 2013 14:08
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: the Netherlands
Contact:

Re: HowTo: monitor Synology NAS

Post by mbliek »

rvmourik wrote:
mbliek wrote:I made a Wiki page for the NAS monitoring.
I added the link in the first post.

http://www.domoticz.com/wiki/NAS_Monitoring

I edited your script a bit @rvmourik
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 ;)
rvmourik
Posts: 17
Joined: Tuesday 07 January 2014 22:39
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: HowTo: monitor Synology NAS

Post by rvmourik »

I know, but currently using the smartphone. with all the stupid auto correct not very nice while editing a wiki :-)
Nixta
Posts: 9
Joined: Thursday 13 February 2014 16:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: HowTo: monitor Synology NAS

Post 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
User avatar
mbliek
Posts: 194
Joined: Friday 12 July 2013 14:08
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: the Netherlands
Contact:

Re: HowTo: monitor Synology NAS

Post 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
Nixta
Posts: 9
Joined: Thursday 13 February 2014 16:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: HowTo: monitor Synology NAS

Post 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?
rvmourik
Posts: 17
Joined: Tuesday 07 January 2014 22:39
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: HowTo: monitor Synology NAS

Post 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 :-)
Nixta
Posts: 9
Joined: Thursday 13 February 2014 16:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: HowTo: monitor Synology NAS

Post 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
??????
rvmourik
Posts: 17
Joined: Tuesday 07 January 2014 22:39
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: HowTo: monitor Synology NAS

Post 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
Nixta
Posts: 9
Joined: Thursday 13 February 2014 16:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: HowTo: monitor Synology NAS

Post by Nixta »

i ran
snmpwalk -c public -v2c localhost synoDisk

didn't try your numbers
i will keep searching
rvmourik
Posts: 17
Joined: Tuesday 07 January 2014 22:39
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: HowTo: monitor Synology NAS

Post by rvmourik »

Good luck!
Nixta
Posts: 9
Joined: Thursday 13 February 2014 16:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: HowTo: monitor Synology NAS

Post by Nixta »

thank you and thank you for trying to help me..

I'll let you know if i find a solution
Nixta
Posts: 9
Joined: Thursday 13 February 2014 16:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: HowTo: monitor Synology NAS

Post by Nixta »

Upgraded synology dsm 4.3 3210 to 4.3 3810 and vola... there it is
rvmourik
Posts: 17
Joined: Tuesday 07 January 2014 22:39
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: HowTo: monitor Synology NAS

Post by rvmourik »

Nice!
Nixta
Posts: 9
Joined: Thursday 13 February 2014 16:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: HowTo: monitor Synology NAS

Post by Nixta »

Hi
Just wanted to show you the result.

Cheers

/Niklas
User avatar
mbliek
Posts: 194
Joined: Friday 12 July 2013 14:08
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: the Netherlands
Contact:

Re: HowTo: monitor Synology NAS

Post by mbliek »

Looking good ;)
Glad it's solved.
BigDog
Posts: 82
Joined: Tuesday 17 September 2013 13:59
Target OS: Raspberry Pi / ODroid
Domoticz version: V3.9269
Location: The Netherlands
Contact:

Re: HowTo: monitor Synology NAS

Post 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
1X Raspberry4B : Domoticz Version 2023.1 [Linux 5.10.63-v7l+ armv7l]
1X Conbee II : 2.25.3 - 26720700
1X RFXtrx433 USB Firmware:183
1X Mysensors Gateway 1.5 -3
6X ESP8266: Tosmota firmware
Zigbee : 6 Operators, 13 Sensors
Nixta
Posts: 9
Joined: Thursday 13 February 2014 16:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

HowTo: monitor Synology NAS

Post 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&param=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&param=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&param=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&param=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&param=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&param=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&param=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&param=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&param=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&param=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&param=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&param=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&param=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&param=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&param=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&param=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&param=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&param=switchlight&idx=$NAS_IDX&switchcmd=Off"
fi

fi
Last edited by Nixta on Sunday 16 February 2014 22:10, edited 1 time in total.
ThaBoo
Posts: 4
Joined: Saturday 15 February 2014 17:38
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: HowTo: monitor Synology NAS

Post 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
Synology Domotics.gif (99.86 KiB) Viewed 3486 times
Domoticz, Raspberry Pi, RFXCom, Plugwise Stretch & Smile, KlikaanKlikuit, EQ3 Max!, Foscam, Harmony Hub, Oregon Scientific
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest