HowTo: monitor Synology NAS

Compatibility (hardware, devices and OS)
rtna
Posts: 66
Joined: Monday 06 April 2015 12:18
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: HowTo: monitor Synology NAS

Post by rtna » Saturday 11 April 2015 10:50

I can't get the script working with a password protected Domoticz setup. Keep getting 401 unauthorized messages.

KoenVanduffel
Posts: 8
Joined: Saturday 14 February 2015 15:50
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: HowTo: monitor Synology NAS

Post by KoenVanduffel » Thursday 09 July 2015 20:38

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 8072 times

User avatar
ThinkPad
Posts: 1754
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 » Sunday 09 August 2015 14:48

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
ThinkTheme - theme for Domoticz
My (Dutch) blog: http://thinkpad.tweakblogs.net - My Domoticz scripts: Bitbucket
I'm not (very) active anymore on this forum as i don't use Domoticz anymore.

dressie
Posts: 108
Joined: Monday 25 May 2015 22:44
Target OS: Linux
Domoticz version: V3.8153
Location: Netherlands
Contact:

Re: HowTo: monitor Synology NAS

Post by dressie » Sunday 09 August 2015 20:52

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: 88
Joined: Monday 12 October 2015 15:46
Target OS: Raspberry Pi
Domoticz version: V3.8275
Contact:

Re: HowTo: monitor Synology NAS

Post by raymond » Friday 30 October 2015 18:30

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: 88
Joined: Monday 12 October 2015 15:46
Target OS: Raspberry Pi
Domoticz version: V3.8275
Contact:

Re: HowTo: monitor Synology NAS

Post by raymond » Monday 02 November 2015 15:48

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
Domoticz version:
Contact:

Re: HowTo: monitor Synology NAS

Post by NewFolk » Saturday 07 November 2015 23:11

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: 52
Joined: Wednesday 20 January 2016 21:21
Target OS: Raspberry Pi
Domoticz version: Stable
Location: Netherlands
Contact:

Re: HowTo: monitor Synology NAS

Post by Martijn85 » Monday 25 January 2016 0:28

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: 52
Joined: Wednesday 20 January 2016 21:21
Target OS: Raspberry Pi
Domoticz version: Stable
Location: Netherlands
Contact:

Re: HowTo: monitor Synology NAS

Post by Martijn85 » Wednesday 27 January 2016 22:07

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: 769
Joined: Wednesday 05 March 2014 14:16
Target OS: Linux
Domoticz version:
Location: France
Contact:

Re: HowTo: monitor Synology NAS

Post by epierre » Thursday 28 January 2016 19:08

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: 52
Joined: Friday 22 January 2016 23:14
Target OS: Raspberry Pi
Domoticz version: beta
Location: France
Contact:

Re: HowTo: monitor Synology NAS

Post by papoo » Sunday 14 February 2016 22:50

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: 450
Joined: Friday 27 February 2015 14:21
Target OS: Raspberry Pi
Domoticz version: beta
Location: Budapest, Hungary
Contact:

Re: HowTo: monitor Synology NAS

Post by LouiS22 » Sunday 14 February 2016 23:01

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: 52
Joined: Friday 22 January 2016 23:14
Target OS: Raspberry Pi
Domoticz version: beta
Location: France
Contact:

Re: HowTo: monitor Synology NAS

Post by papoo » Sunday 14 February 2016 23:42

it's not for synology, it's for domoticz. to get snmp alarm of an other device

raymond
Posts: 88
Joined: Monday 12 October 2015 15:46
Target OS: Raspberry Pi
Domoticz version: V3.8275
Contact:

Re: HowTo: monitor Synology NAS

Post by raymond » Thursday 18 February 2016 17:56

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: 88
Joined: Monday 12 October 2015 15:46
Target OS: Raspberry Pi
Domoticz version: V3.8275
Contact:

Re: HowTo: monitor Synology NAS

Post by raymond » Wednesday 24 February 2016 10:05

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: 8
Joined: Sunday 28 February 2016 20:39
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: HowTo: monitor Synology NAS

Post by Jochem » Sunday 28 February 2016 22:00

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 7289 times
Nas.sh run.tiff
Nas.sh run.tiff (156.71 KiB) Viewed 7289 times
Nas.sh text.tiff
Nas.sh text.tiff (155.88 KiB) Viewed 7289 times

raymond
Posts: 88
Joined: Monday 12 October 2015 15:46
Target OS: Raspberry Pi
Domoticz version: V3.8275
Contact:

Re: HowTo: monitor Synology NAS

Post by raymond » Thursday 03 March 2016 16:58

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: 10
Joined: Thursday 19 May 2016 11:39
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: HowTo: monitor Synology NAS

Post by mickeyr61 » Wednesday 25 May 2016 13:15

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: 88
Joined: Monday 12 October 2015 15:46
Target OS: Raspberry Pi
Domoticz version: V3.8275
Contact:

Re: HowTo: monitor Synology NAS

Post by raymond » Wednesday 25 May 2016 13:29

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: 10
Joined: Thursday 19 May 2016 11:39
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: HowTo: monitor Synology NAS

Post by mickeyr61 » Wednesday 25 May 2016 23:17

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: No registered users and 4 guests