Page 6 of 10

Re: HowTo: monitor Synology NAS

Posted: Saturday 11 April 2015 10:50
by rtna
I can't get the script working with a password protected Domoticz setup. Keep getting 401 unauthorized messages.

Re: HowTo: monitor Synology NAS

Posted: Thursday 09 July 2015 20:38
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.

Re: HowTo: monitor Synology NAS

Posted: Sunday 09 August 2015 14:48
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

Re: HowTo: monitor Synology NAS

Posted: Sunday 09 August 2015 20:52
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.

Re: HowTo: monitor Synology NAS

Posted: Friday 30 October 2015 17:30
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

Re: HowTo: monitor Synology NAS

Posted: Monday 02 November 2015 14:48
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

Re: HowTo: monitor Synology NAS

Posted: Saturday 07 November 2015 22:11
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 ?

Re: HowTo: monitor Synology NAS

Posted: Sunday 24 January 2016 23:28
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?

Re: HowTo: monitor Synology NAS

Posted: Wednesday 27 January 2016 21:07
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"

Re: HowTo: monitor Synology NAS

Posted: Thursday 28 January 2016 18:08
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:

Re: HowTo: monitor Synology NAS

Posted: Sunday 14 February 2016 21:50
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

Re: HowTo: monitor Synology NAS

Posted: Sunday 14 February 2016 22:01
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.

Re: HowTo: monitor Synology NAS

Posted: Sunday 14 February 2016 22:42
by papoo
it's not for synology, it's for domoticz. to get snmp alarm of an other device

Re: HowTo: monitor Synology NAS

Posted: Thursday 18 February 2016 16:56
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

Re: HowTo: monitor Synology NAS

Posted: Wednesday 24 February 2016 9:05
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

Re: HowTo: monitor Synology NAS

Posted: Sunday 28 February 2016 21:00
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 ???

Re: HowTo: monitor Synology NAS

Posted: Thursday 03 March 2016 15:58
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

Re: HowTo: monitor Synology NAS

Posted: Wednesday 25 May 2016 13:15
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?

Re: HowTo: monitor Synology NAS

Posted: Wednesday 25 May 2016 13:29
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

Re: HowTo: monitor Synology NAS

Posted: Wednesday 25 May 2016 23:17
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.