HowTo: monitor Synology NAS

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

Moderator: leecollings

Post Reply
rtna
Posts: 17
Joined: Monday 06 April 2015 12:18
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: HowTo: monitor Synology NAS

Post by rtna »

I can't get the script working with a password protected Domoticz setup. Keep getting 401 unauthorized messages.
KoenVanduffel
Posts: 5
Joined: Saturday 14 February 2015 14:50
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: HowTo: monitor Synology NAS

Post by KoenVanduffel »

Have added this to my Domoticz, works like a charm :)

I added Volume2 to the list by just changing the .38 (Volume 1 on DSM 5.2) into .40
I also added the Syno system temperature from one of the earlier posts here.
To get free space I had however to do 100- the value calculated as the value calculated is the used space.
Attachments
Knipsel.PNG
Knipsel.PNG (150.8 KiB) Viewed 17155 times
ThinkPad
Posts: 890
Joined: Tuesday 30 September 2014 8:49
Target OS: Linux
Domoticz version: beta
Location: The Netherlands
Contact:

Re: HowTo: monitor Synology NAS

Post by ThinkPad »

Very useful topic, i had just created a simple script to get the temperature of the disk:

Code: Select all

#!/bin/bash
# This script retrieves the temperature of the HDD in your Synology and sends it to a virtual sensor in Domoticz
# Be sure to create virtual sensor (Type: 'Temperature') and fill in the IDX below (and of course the other settings)

# Fill in variables
DOMO_IP="192.168.4.4"
DOMO_PORT="8084"
DOMO_IDX="248"

temp=`smartctl -A /dev/hda1 | grep Temperature_Celsius | awk '{print $10}'`
curl --silent "http://$DOMO_IP:$DOMO_PORT/json.htm?type=command&param=udevice&idx=$DOMO_IDX&nvalue=0&svalue=$temp" > /dev/null
But i also wanted the CPU-temperature and then i suddenly found this topic :mrgreen:

Some useful documents:
https://global.download.synology.com/do ... _Guide.pdf - Synology MIB Guide (see chapter 'Useful OIDs' for example)
http://ukdl.synology.com/download/Docum ... B_File.zip - MIB files for Synology, contain everything!
http://www.paessler.com/tools/mibimporter - Paessler MIB to OID converter, with this you can convert the above file to OID you can use with the script from this topic
https://www.paessler.com/tools/snmptester - SNMP Tester, retrieve values from specific OID with a Windows PC

But one thing i don't understand, i am reading the CPU-temperature with the SNMP Tester (at OID 1.3.6.1.4.1.6574.1.2.0), but the temperature reported is a little bit off from what i am seeing in the webinterface (Control Panel > Info center > Thermal status, hover over the green dot). Webinterface says 50 / 51 degrees Celsius, SNMP says 46 / 47 ?

And i also have a little problem, i can't use 'snmpget' on my NAS (i run Domoticz on the NAS), because i haven't bootstrapped it (not going to do that either). I was hoping that i could read the CPU-temperature through a shellscript with utilities already available on the NAS, just like the HDD-temperature, but i don't think that is possible. Luckily i also have a Pi running which i could let do this SNMP monitoring if i should reaaaaally want this :D

I also found this script for measuring CPU-temperature: http://www.synology-forum.nl/firmware-a ... 2#msg42682 but it is not working on my DS114
I am not active on this forum anymore.
dressie
Posts: 156
Joined: Monday 25 May 2015 22:44
Target OS: Raspberry Pi / ODroid
Domoticz version: V2020.2
Location: Netherlands
Contact:

Re: HowTo: monitor Synology NAS

Post by dressie »

globalassist wrote:Is there a way to monitor this in a windows-installation of Domoticz?
Is there going to be a follow-up for Windows users? I would like to use this too.
raymond
Posts: 71
Joined: Monday 12 October 2015 15:46
Target OS: Raspberry Pi / ODroid
Domoticz version: V4.10232
Contact:

Re: HowTo: monitor Synology NAS

Post by raymond »

I got this error, I must be overlooking something simple here.
Disk Space Used lines is what gives the syntax error.

./NAS.sh: line 82: syntax error: (384838 - 2) * 4096 Bytes / 1024 / 1024 / 1024

The percentage Disk Used do not trigger an error, although they do not update the virtual device either.

Any clues?

Cheers
raymond
Posts: 71
Joined: Monday 12 October 2015 15:46
Target OS: Raspberry Pi / ODroid
Domoticz version: V4.10232
Contact:

Re: HowTo: monitor Synology NAS

Post by raymond »

Upgraded to the latest V2.3532 and now my scripts folder is gone?
Did it move? What am I missing?

Edit: Got it. Scripts folder should be ./domoticz/var/scripts not ./domoticz/scripts at least for Synology
NewFolk
Posts: 39
Joined: Wednesday 02 September 2015 11:47
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: HowTo: monitor Synology NAS

Post by NewFolk »

Hi all,

It`s a mistake in wiki about Memory

Code: Select all

 # Free Memory Used in %
    MemAvailable=`snmpget -v 2c -c $PASSWORD -O qv $NASIP 1.3.6.1.4.1.2021.4.6.0`
    Memtotal=`snmpget -v 2c -c $PASSWORD -O qv $NASIP 1.3.6.1.4.1.2021.4.5.0`
    MemShared=`snmpget -v 2c -c $PASSWORD -O qv $NASIP 1.3.6.1.4.1.2021.4.13.0`
    MemBuffer=`snmpget -v 2c -c $PASSWORD -O qv $NASIP 1.3.6.1.4.1.2021.4.14.0`
    MemCached=`snmpget -v 2c -c $PASSWORD -O qv $NASIP 1.3.6.1.4.1.2021.4.15.0`
    MemFREE=$(($MemAvailable + $MemShared + $MemBuffer + $MemCached))
    MemUsepercent=$(((($Memtotal - $MemFREE) * 100) / $Memtotal)) // For Available use MemUsepercent=$(((($MemFREE) * 100) / $Memtotal)) 
    # Send data
    curl -s -i -H "Accept: application/json" "http://$DOMO_IP:$DOMO_PORT/json.htm?type=command&param=udevice&idx=$NAS_MEM_IDX&nvalue=0&svalue=$MemUsepercent"
 

What is the best sensor type for HDD usage in GB ?
Martijn85
Posts: 53
Joined: Wednesday 20 January 2016 20:21
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: Netherlands
Contact:

Re: HowTo: monitor Synology NAS

Post by Martijn85 »

With the Free Memory Useage on my Synology NAS i get this error:

./domoticz/scripts/ds214plus.sh: line 144: syntax error: 15004 kB / 1024

Anybod got a solusion for this?
Martijn85
Posts: 53
Joined: Wednesday 20 January 2016 20:21
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: Netherlands
Contact:

Re: HowTo: monitor Synology NAS

Post by Martijn85 »

I have it working now. The error is comming from the memory part, this is a working solution on my Synology nas with the memory:

Code: Select all

# Free Memory Used in %
tmpMemAvailable=`snmpwalk -v 2c -c $COMMUNITY -O qv $NASIP 1.3.6.1.4.1.2021.4.6.0`
MemAvailable=${tmpMemAvailable%% *}
tmpMemtotal=`snmpwalk -v 2c -c $COMMUNITY -O qv $NASIP 1.3.6.1.4.1.2021.4.5.0`
Memtotal=${tmpMemtotal%% *}
tmpMemShared=`snmpwalk -v 2c -c $COMMUNITY -O qv $NASIP 1.3.6.1.4.1.2021.4.13.0`
MemShared=${tmpMemShared%% *}
tmpMemBuffer=`snmpwalk -v 2c -c $COMMUNITY -O qv $NASIP 1.3.6.1.4.1.2021.4.14.0`
MemBuffer=${tmpMemBuffer%% *}
tmpMemCached=`snmpwalk -v 2c -c $COMMUNITY -O qv $NASIP 1.3.6.1.4.1.2021.4.15.0`
MemCached=${tmpMemCached%% *}
MemFREE=$(($MemAvailable + $MemShared + $MemBuffer + $MemCached))
MemUsepercent=$(((($Memtotal - $MemFREE) * 100) / $Memtotal)) 
#// For Available use MemUsepercent=$(((($MemFREE) * 100) / $Memtotal))	   
 # Send data
 curl -s -i -H "Accept: application/json" "http://$DOMO_IP:$DOMO_PORT/json.htm?type=command&param=udevice&idx=$NAS_MEM_IDX&nvalue=0&svalue=$MemUsepercent"
User avatar
epierre
Posts: 522
Joined: Wednesday 05 March 2014 13:16
Target OS: Linux
Domoticz version:
Location: France
Contact:

Re: HowTo: monitor Synology NAS

Post by epierre »

Hello,

With a newbee approach, I have corrected the wiki to explain which device to create and how to change value inside the script based on DSM version(maybe putting it to DSM 5.1+ directly would be a good idea now ?). Could you update your first post here to avoid mistakes on this ? thanks for sharing this interresting script !

* 1 dummy hardware to create devices below:
* 1 virtual switch (Nas status on/off)
* 2 virtual temperature sensors (for two disks temp)
* 3 virtual percentage (cpu, ram and disk amount available)
* 1 virtual counter, and edit it to be a counter (available space in Mo)
The script[edit]
Remember to modify the OID for a DSM >=5.1 as indicated below:
ImperiHome & MyDomoAtHome on top of:
868.42Mhz - Vera Lite - Fibaro SS-101, S-211, K-101, FWP - Fortress SSA2
433Mhz - Cubie Domoticz + RFXtrx + Oregon || Foscam 9821W
2,4Ghz - Cubie MySensors Gateway + COV + TempHumidity + Pressure + WaterMeter
User avatar
papoo
Posts: 126
Joined: Friday 22 January 2016 22:14
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.10
Location: France
Contact:

Re: HowTo: monitor Synology NAS

Post by papoo »

hi all
thank you for this
how can i use snmp trap target with domoticz? for instantly know when an event occurs without waiting for the crontab execution
User avatar
LouiS22
Posts: 433
Joined: Friday 27 February 2015 13:21
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Budapest, Hungary
Contact:

Re: HowTo: monitor Synology NAS

Post by LouiS22 »

papoo wrote:hi all
thank you for this
how can i use snmp trap target with domoticz? for instantly know when an event occurs without waiting for the crontab execution
You can't. Synology DSM doesn't support trap.
User avatar
papoo
Posts: 126
Joined: Friday 22 January 2016 22:14
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.10
Location: France
Contact:

Re: HowTo: monitor Synology NAS

Post by papoo »

it's not for synology, it's for domoticz. to get snmp alarm of an other device
raymond
Posts: 71
Joined: Monday 12 October 2015 15:46
Target OS: Raspberry Pi / ODroid
Domoticz version: V4.10232
Contact:

Re: HowTo: monitor Synology NAS

Post by raymond »

Using this for quite some time for watching temperatures of disks and the NAS itself, and runs fine. I've added this to the cron to run for every 5 min.
Something changed as now the cron runs, but my temperatures go back to 0C every time. If I run this script manually, temperatures are fine.
I've added the Memory Usage from Martijn85 above here, which still updates both through the cron and manually.

Am I overlooking something? Did something change in updating virtual temp sensors, but only through the cron?

Someone else have the same probs?

Thanks,

Ray
raymond
Posts: 71
Joined: Monday 12 October 2015 15:46
Target OS: Raspberry Pi / ODroid
Domoticz version: V4.10232
Contact:

Re: HowTo: monitor Synology NAS

Post by raymond »

raymond wrote:Using this for quite some time for watching temperatures of disks and the NAS itself, and runs fine. I've added this to the cron to run for every 5 min.
Something changed as now the cron runs, but my temperatures go back to 0C every time. If I run this script manually, temperatures are fine.
I've added the Memory Usage from Martijn85 above here, which still updates both through the cron and manually.

Am I overlooking something? Did something change in updating virtual temp sensors, but only through the cron?

Someone else have the same probs?

Thanks,

Ray
Anyone else having this problem, I have found the "solution"
The script uses snmpget which runs fine manually, and used to run fine in the cron too. Some update (I guess Synology DSM) caused the cron to run the script correctly, but gave 0C numbers in return.

Changing the script replacing all snmpget to snmpwalk did the trick, both manually and in cron it works again.
I have to thank Martijn85 above, as he made me aware of this in his correction of the script, where I finally sportted the use of snmpwalk instead snmpget.

Cheers,

Ray
Jochem
Posts: 19
Joined: Sunday 28 February 2016 19:39
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.10181
Location: Noordwijk
Contact:

Re: HowTo: monitor Synology NAS

Post by Jochem »

Hello,

i'm quite new to domoticz, and im trying to put mij snmp data from my synology NAS into domoticz.

But i'm getting some errors..

can anyone tell me what I've done wrong ???
Attachments
crontab.tiff
crontab.tiff (119.17 KiB) Viewed 16372 times
Nas.sh run.tiff
Nas.sh run.tiff (156.71 KiB) Viewed 16372 times
Nas.sh text.tiff
Nas.sh text.tiff (155.88 KiB) Viewed 16372 times
Raspberry P3, RF-Link FW version 48, lots of KAKU switches, Sonos connected, LG TV switching, a lot of weather switches.
raymond
Posts: 71
Joined: Monday 12 October 2015 15:46
Target OS: Raspberry Pi / ODroid
Domoticz version: V4.10232
Contact:

Re: HowTo: monitor Synology NAS

Post by raymond »

Jochem wrote:Hello,

i'm quite new to domoticz, and im trying to put mij snmp data from my synology NAS into domoticz.

But i'm getting some errors..

can anyone tell me what I've done wrong ???
I can't see your attachments I'm afraid, so what's the problem?
I have changed the all the lines with the command snmpget to snmpwalk in the script as stated above. This way it runs mannually and also in the cron again.

Ray
mickeyr61
Posts: 22
Joined: Thursday 19 May 2016 11:39
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: HowTo: monitor Synology NAS

Post by mickeyr61 »

Thank you for this nice script! It alsmost is working. I get Temperature-1 en 2, CPU, but NAS free space is 0Mo, and Disk space also. I have read the parameters en they are the following values: HDUnit=4096, HDtotal= 64239, HDUsed=1, HDFree=0, HDFreePerc=0.

When I try to manual read the line
HDUsed=`snmpget -v 2c -c fliermouse $PASSWORD -O qv $NASIP 1.3.6.1.2.1.25.2.3.1.6.38

I get no results.

Is the OID correct?
raymond
Posts: 71
Joined: Monday 12 October 2015 15:46
Target OS: Raspberry Pi / ODroid
Domoticz version: V4.10232
Contact:

Re: HowTo: monitor Synology NAS

Post by raymond »

mickeyr61 wrote:Thank you for this nice script! It alsmost is working. I get Temperature-1 en 2, CPU, but NAS free space is 0Mo, and Disk space also. I have read the parameters en they are the following values: HDUnit=4096, HDtotal= 64239, HDUsed=1, HDFree=0, HDFreePerc=0.

When I try to manual read the line
HDUsed=`snmpget -v 2c -c fliermouse $PASSWORD -O qv $NASIP 1.3.6.1.2.1.25.2.3.1.6.38

I get no results.

Is the OID correct?
I recall from my mind that although some say the OID in the end is .38 I used .36 and it worked again.
Try your command with it:
HDUsed=`snmpget -v 2c -c fliermouse $PASSWORD -O qv $NASIP 1.3.6.1.2.1.25.2.3.1.6.36

Ray
mickeyr61
Posts: 22
Joined: Thursday 19 May 2016 11:39
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: HowTo: monitor Synology NAS

Post by mickeyr61 »

Ray, thanks for yoyr reply. I have changed the last two digits to .36 and now the Parameter HDUsed is 116. But HDFree and HDFreePerc stay 0.
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 1 guest