Page 5 of 10

Re: HowTo: monitor Synology NAS

Posted: Thursday 18 December 2014 22:00
by MAidEN
Yes we can add this tip on Wiki. How do that?

@zaadstra : I think if you monitor your synology (cpu, mem, temp, ping) from your domoticz, synology can't be sleep mode...

Anybody has a idea for my problem with HDD space monitor? :|

Re: HowTo: monitor Synology NAS

Posted: Friday 19 December 2014 10:51
by Luuc_a
MAidEN wrote:
Image
I have the solution for the Disk monitoring of my NAS with the screenshot above. The OID of Volume1 is 38.

The code for Free Space in GB

Code: Select all

 # Free space volume1 (GB)
                                HDUnit=`snmpget -c $PASSWORD -v2c -O qv $NASIP .1.3.6.1.2.1.25.2.3.1.4.38`
                                HDTotal=`snmpget -c $PASSWORD -v2c -O qv $NASIP .1.3.6.1.2.1.25.2.3.1.5.38`
                                HDUsed=`snmpget -c $PASSWORD -v2c -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_HD_SPACE_IDX&nvalue=$0&svalue=$HDFree"
The code for Free Space in Percent

Code: Select all

 # Free space volume1 (Percentage)
                                HDTotal=`snmpget -c $PASSWORD -v2c -O qv $NASIP .1.3.6.1.2.1.25.2.3.1.5.38`
                                HDUsed=`snmpget -c $PASSWORD -v2c -O qv $NASIP .1.3.6.1.2.1.25.2.3.1.6.38`
                                HDFreePerc=$((($HDUsed * 100) / $HDTotal))

                                # Send data
                                curl -s -i -H "Accept: application/json" "http://$DOMO_IP:$DOMO_PORT/json.htm?type=command&param=udevice&idx=$NAS_HD_SPACE_PERC_IDX&nvalue=0&svalue=$HDFreePerc"

Re: HowTo: monitor Synology NAS

Posted: Friday 19 December 2014 14:35
by roblom
The above seems to work indeed.

Re: HowTo: monitor Synology NAS

Posted: Friday 19 December 2014 14:36
by roblom
MAidEN wrote:Yes we can add this tip on Wiki. How do that?
Just login here and you can edit the wiki page.

Re: HowTo: monitor Synology NAS

Posted: Saturday 20 December 2014 8:34
by MAidEN
Luuc_a wrote: I have the solution for the Disk monitoring of my NAS with the screenshot above. The OID of Volume1 is 38.

The code for Free Space in GB

Code: Select all

 # Free space volume1 (GB)
                                HDUnit=`snmpget -c $PASSWORD -v2c -O qv $NASIP .1.3.6.1.2.1.25.2.3.1.4.38`
                                HDTotal=`snmpget -c $PASSWORD -v2c -O qv $NASIP .1.3.6.1.2.1.25.2.3.1.5.38`
                                HDUsed=`snmpget -c $PASSWORD -v2c -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_HD_SPACE_IDX&nvalue=$0&svalue=$HDFree"
The code for Free Space in Percent

Code: Select all

 # Free space volume1 (Percentage)
                                HDTotal=`snmpget -c $PASSWORD -v2c -O qv $NASIP .1.3.6.1.2.1.25.2.3.1.5.38`
                                HDUsed=`snmpget -c $PASSWORD -v2c -O qv $NASIP .1.3.6.1.2.1.25.2.3.1.6.38`
                                HDFreePerc=$((($HDUsed * 100) / $HDTotal))

                                # Send data
                                curl -s -i -H "Accept: application/json" "http://$DOMO_IP:$DOMO_PORT/json.htm?type=command&param=udevice&idx=$NAS_HD_SPACE_PERC_IDX&nvalue=0&svalue=$HDFreePerc"
Thanks is ok now, but I don't understand why I have a value "7" on title :

Image

The good value is 5901 Go.

The percent monitor is ok.

Re: HowTo: monitor Synology NAS

Posted: Saturday 20 December 2014 8:48
by MAidEN
decrxgarage wrote:
MAidEN wrote:Yes we can add this tip on Wiki. How do that?
Just login here and you can edit the wiki page.
It's good I had update the wiki page with this news :

Cpu monitor
Memory monitor
Disk usage in %
And I add a coment with new OID for disk usage to DSM 5.1 (.38)

Re: HowTo: monitor Synology NAS

Posted: Monday 22 December 2014 13:00
by SwordFish
Hello, i'm new with this, using domoticz for a few days know.
So I have questing, how do i make a virtual Switch en the virtual temperature sensors?
I have the script running on the Pi. But when I test it i get this.

Re: HowTo: monitor Synology NAS

Posted: Monday 22 December 2014 13:59
by roblom
SwordFish wrote:So I have questing, how do i make a virtual Switch en the virtual temperature sensors?
  • Go to "Hardware"
  • Choose for type "Dummy (does nothing, use for virtual switches only"
  • Give it a name, like "NAS"
  • Click on "add"
  • Now in the device list there is a new hardware created. In this line of "NAS" is a button with "create virtual sensors"
  • When you click on this, choose what kind of device you need. For the NAS Script you need a counter for example.
  • Click "ok"
  • Now in the devices tab there is a new device created. Click on the green arrow behind it and give it a name.
  • Now there is a device created on the tab "Several" (or other if you choose a different type of device).
Look in the device tab in the column IDX for the IDX number of the device, then change this in the NAS script. Create more devices if you need more.

Re: HowTo: monitor Synology NAS

Posted: Monday 22 December 2014 14:23
by sincze
Excellent . ;-)

Re: HowTo: monitor Synology NAS

Posted: Monday 22 December 2014 14:43
by SwordFish
decrxgarage wrote:
SwordFish wrote:So I have questing, how do i make a virtual Switch en the virtual temperature sensors?
  • Go to "Hardware"
  • Choose for type "Dummy (does nothing, use for virtual switches only"
  • Give it a name, like "NAS"
  • Click on "add"
  • Now in the device list there is a new hardware created. In this line of "NAS" is a button with "create virtual sensors"
  • When you click on this, choose what kind of device you need. For the NAS Script you need a counter for example.
  • Click "ok"
  • Now in the devices tab there is a new device created. Click on the green arrow behind it and give it a name.
  • Now there is a device created on the tab "Several" (or other if you choose a different type of device).
Look in the device tab in the column IDX for the IDX number of the device, then change this in the NAS script. Create more devices if you need more.
Thanks for the quick reply. I will give it a try

Re: HowTo: monitor Synology NAS

Posted: Monday 22 December 2014 15:57
by SwordFish
I've managed to get the virtual switches but when i test the script i'll still get this?

Re: HowTo: monitor Synology NAS

Posted: Monday 22 December 2014 16:22
by roblom
Did you make the script executable:

Code: Select all

sudo chmod +x nas.sh
Is this a windows machine?

Re: HowTo: monitor Synology NAS

Posted: Sunday 28 December 2014 15:31
by SwordFish
I've managed to get it work. But there are a few things that i don't get to work.
- Memory use is allways 1%?
- Its seems that the crontab is not working, because it doesn't update?
But when I run nas.sh in the terminal its working. ( I've another crontab running what is working)
- On dashboard the free HD space doesn't show the right free space.
running nas.sh
running nas.sh
running sh.PNG (24.79 KiB) Viewed 6277 times
dashboard
dashboard
dashboard.PNG (88.58 KiB) Viewed 6277 times
crontab
crontab
crontab.PNG (4.01 KiB) Viewed 6277 times
#!/bin/bash

# Settings

NASIP="192.168.1.11" # NAS IP Address
PASSWORD="public" # SNMP Password
DOMO_IP="192.168.1.216" # Domoticz IP Address
DOMO_PORT="8080" # Domoticz Port
NAS_IDX="28" # NAS Switch IDX
NAS_HD1_TEMP_IDX="29" # NAS HD1 Temp IDX
NAS_HD_SPACE_IDX="30" # NAS HD Space IDX in Go
NAS_CPU_IDX="35" # NAS CPU IDX
NAS_MEM_IDX="36" # NAS MEM 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"

# Free space volume in Go
HDUnit=`snmpget -v 2c -c $PASSWORD -O qv $NASIP 1.3.6.1.2.1.25.2.3.1.4.36` # Change OID to .38 on DSM 5.1
HDTotal=`snmpget -v 2c -c $PASSWORD -O qv $NASIP 1.3.6.1.2.1.25.2.3.1.5.36` # Change OID to .38 on DSM 5.1
HDUsed=`snmpget -v 2c -c $PASSWORD -O qv $NASIP 1.3.6.1.2.1.25.2.3.1.6.36` # Change OID to .38 on DSM 5.1
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_HD_SPACE_IDX&nvalue=0&svalue=$HDFree"

# Free space volume in percent
HDTotal=`snmpget -c $PASSWORD -v2c -O qv $NASIP .1.3.6.1.2.1.25.2.3.1.5.36` # Change OID to .38 on DSM 5.1
HDUsed=`snmpget -c $PASSWORD -v2c -O qv $NASIP .1.3.6.1.2.1.25.2.3.1.6.36` # Change OID to .38 on DSM 5.1
HDFreePerc=$((($HDUsed * 100) / $HDTotal))
# Send data
curl -s -i -H "Accept: application/json" "http://$DOMO_IP:$DOMO_PORT/json.htm?type=command&param=udevice&idx=$NAS_HD_SPACE_PERC_IDX&nvalue=0&svalue=$HDFreePerc"

# CPU utilisation
CpuUser=`snmpget -v 2c -c $PASSWORD -O qv $NASIP 1.3.6.1.4.1.2021.11.9.0`
CpuSystem=`snmpget -v 2c -c $PASSWORD -O qv $NASIP 1.3.6.1.4.1.2021.11.10.0`
CpuUse=$(($CpuUser + $CpuSystem))
# Send data
curl -s -i -H "Accept: application/json" "http://$DOMO_IP:$DOMO_PORT/json.htm?type=command&param=udevice&idx=$NAS_CPU_IDX&nvalue=0&svalue=$CpuUse"

# Free Memory Available in %
MemAvailable=`snmpget -v 2c -c $PASSWORD -O qv $NASIP 1.3.6.1.4.1.2021.4.6.0`
MemAvailableinMo=$(($MemAvailable / 1024))
MemUsepercent=$((($MemAvailableinMo * 100) / 1024))
# 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"

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"

# Free space volume in Go
HDUnit=`snmpget -v 2c -c $PASSWORD -O qv $NASIP 1.3.6.1.2.1.25.2.3.1.4.36` # Change OID to .38 on DSM 5.1
HDTotal=`snmpget -v 2c -c $PASSWORD -O qv $NASIP 1.3.6.1.2.1.25.2.3.1.5.36` # Change OID to .38 on DSM 5.1
HDUsed=`snmpget -v 2c -c $PASSWORD -O qv $NASIP 1.3.6.1.2.1.25.2.3.1.6.36` # Change OID to .38 on DSM 5.1
HDFree=$((($HDTotal - $HDUsed) * $HDUnit / 1024 / 1024 / 1024 / 1000))

# Send data
curl -s -i -H "Accept: application/json" "http://$DOMO_IP:$DOMO_PORT/json.htm?type=command&param=udevice&idx=$NAS_HD_SPACE_IDX&nvalue=0&svalue=$HDFree"

# Free space volume in percent
HDTotal=`snmpget -c $PASSWORD -v2c -O qv $NASIP .1.3.6.1.2.1.25.2.3.1.5.36` # Change OID to .38 on DSM 5.1
HDUsed=`snmpget -c $PASSWORD -v2c -O qv $NASIP .1.3.6.1.2.1.25.2.3.1.6.36` # Change OID to .38 on DSM 5.1
HDFreePerc=$((($HDUsed * 100) / $HDTotal))
# Send data
curl -s -i -H "Accept: application/json" "http://$DOMO_IP:$DOMO_PORT/json.htm?type=command&param=udevice&idx=$NAS_HD_SPACE_PERC_IDX&nvalue=0&svalue=$HDFreePerc"

# CPU utilisation
CpuUser=`snmpget -v 2c -c $PASSWORD -O qv $NASIP 1.3.6.1.4.1.2021.11.9.0`
CpuSystem=`snmpget -v 2c -c $PASSWORD -O qv $NASIP 1.3.6.1.4.1.2021.11.10.0`
CpuUse=$(($CpuUser + $CpuSystem))
# Send data
curl -s -i -H "Accept: application/json" "http://$DOMO_IP:$DOMO_PORT/json.htm?type=command&param=udevice&idx=$NAS_CPU_IDX&nvalue=0&svalue=$CpuUse"

# Free Memory Available in %
MemAvailable=`snmpget -v 2c -c $PASSWORD -O qv $NASIP 1.3.6.1.4.1.2021.4.6.0`
MemAvailableinMo=$(($MemAvailable / 1024))
MemUsepercent=$((($MemAvailableinMo * 100) / 1024))
# 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"

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

Re: HowTo: monitor Synology NAS

Posted: Sunday 28 December 2014 18:49
by roblom
When you paste some code here it's better to use the code tags.

I think the problem is in your cronjob, the "(= every 5 minutes)" is not allowed because it don't understands what it means so it gives an error.

Re: HowTo: monitor Synology NAS

Posted: Monday 29 December 2014 9:55
by SwordFish
Thanks, will remove that.
Sorry for not using the code tags, didn't know .

Re: HowTo: monitor Synology NAS

Posted: Saturday 03 January 2015 22:12
by JacquesMulders
I was having the same issue as Swordfish, because is have a username and password installed.
i've edit the script (for synology) to:

Code: Select all

 #!/bin/bash
 
 # Settings
 
 NASIP="0.0.0.0"             # NAS IP Address
 PASSWORD="password"         # SNMP Password
 DOMO_IP="0.0.0.0"           # Domoticz IP Address
 DOMO_PORT="0000"            # Domoticz Port
 DOMO_PASS="PASSWORD"        # Domoticz password
 DOMO_USER="USERNAME"           # Domoticz user
 NAS_IDX="1"                 # NAS Switch IDX
 NAS_HD1_TEMP_IDX="2"        # NAS HD1 Temp IDX
 NAS_HD2_TEMP_IDX="3"        # NAS HD2 Temp IDX
 NAS_HD_SPACE_IDX="4"        # NAS HD Space IDX in Go
 NAS_HD_SPACE_PERC_IDX="5"   # NAS HD Space IDX in %
 NAS_CPU_IDX="6"             # NAS CPU IDX
 NAS_MEM_IDX="7"             # NAS MEM 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_USER:$DOMO_PASS@$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_USER:$DOMO_PASS@$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_USER:$DOMO_PASS@$DOMO_IP:$DOMO_PORT/json.htm?type=command&param=udevice&idx=$NAS_HD2_TEMP_IDX&nvalue=0&svalue=$HDtemp2"
 
        # Free space volume in Go
        HDUnit=`snmpget -v 2c -c $PASSWORD -O qv $NASIP 1.3.6.1.2.1.25.2.3.1.4.36`  # Change OID to .38 on DSM 5.1
        HDTotal=`snmpget -v 2c -c $PASSWORD -O qv $NASIP 1.3.6.1.2.1.25.2.3.1.5.36` # Change OID to .38 on DSM 5.1
        HDUsed=`snmpget -v 2c -c $PASSWORD -O qv $NASIP 1.3.6.1.2.1.25.2.3.1.6.36`  # Change OID to .38 on DSM 5.1
        HDFree=$((($HDTotal - $HDUsed) * $HDUnit / 1024 / 1024 / 1024))
 
        # Send data
        curl -s -i -H "Accept: application/json" "http://$DOMO_USER:$DOMO_PASS@$DOMO_IP:$DOMO_PORT/json.htm?type=command&param=udevice&idx=$NAS_HD_SPACE_IDX&nvalue=0&svalue=$HDFree"
 
        # Free space volume in percent
        HDTotal=`snmpget -c $PASSWORD -v2c -O qv $NASIP .1.3.6.1.2.1.25.2.3.1.5.36` # Change OID to .38 on DSM 5.1
        HDUsed=`snmpget -c $PASSWORD -v2c -O qv $NASIP .1.3.6.1.2.1.25.2.3.1.6.36`  # Change OID to .38 on DSM 5.1
     	HDFreePerc=$((($HDUsed * 100) / $HDTotal))
        # Send data
        curl -s -i -H "Accept: application/json" "http://$DOMO_USER:$DOMO_PASS@$DOMO_IP:$DOMO_PORT/json.htm?type=command&param=udevice&idx=$NAS_HD_SPACE_PERC_IDX&nvalue=0&svalue=$HDFreePerc"
 
	# CPU utilisation
        CpuUser=`snmpget -v 2c -c $PASSWORD -O qv $NASIP 1.3.6.1.4.1.2021.11.9.0`
	CpuSystem=`snmpget -v 2c -c $PASSWORD -O qv $NASIP 1.3.6.1.4.1.2021.11.10.0`
	CpuUse=$(($CpuUser + $CpuSystem))
        # Send data
        curl -s -i -H "Accept: application/json" "http://$DOMO_USER:$DOMO_PASS@$DOMO_IP:$DOMO_PORT/json.htm?type=command&param=udevice&idx=$NAS_CPU_IDX&nvalue=0&svalue=$CpuUse"
 
        # Free Memory Available in %
	MemAvailable=`snmpget -v 2c -c $PASSWORD -O qv $NASIP 1.3.6.1.4.1.2021.4.6.0`
        MemAvailableinMo=$(($MemAvailable / 1024))
	MemUsepercent=$((($MemAvailableinMo * 100) / 1024))
        # Send data
       curl -s -i -H "Accept: application/json" "http://$DOMO_USER:$DOMO_PASS@$DOMO_IP:$DOMO_PORT/json.htm?type=command&param=udevice&idx=$NAS_MEM_IDX&nvalue=0&svalue=$MemUsepercent"
 
else
        echo "NAS ON"
        # Send data
        curl -s -i -H "Accept: application/json" "http://$DOMO_USER:$DOMO_PASS@$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_USER:$DOMO_PASS@$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_USER:$DOMO_PASS@$DOMO_IP:$DOMO_PORT/json.htm?type=command&param=udevice&idx=$NAS_HD2_TEMP_IDX&nvalue=0&svalue=$HDtemp2"
 
        # Free space volume in Go
        HDUnit=`snmpget -v 2c -c $PASSWORD -O qv $NASIP 1.3.6.1.2.1.25.2.3.1.4.36`  # Change OID to .38 on DSM 5.1
        HDTotal=`snmpget -v 2c -c $PASSWORD -O qv $NASIP 1.3.6.1.2.1.25.2.3.1.5.36` # Change OID to .38 on DSM 5.1
        HDUsed=`snmpget -v 2c -c $PASSWORD -O qv $NASIP 1.3.6.1.2.1.25.2.3.1.6.36`  # Change OID to .38 on DSM 5.1
        HDFree=$((($HDTotal - $HDUsed) * $HDUnit / 1024 / 1024 / 1024))
 
        # Send data
        curl -s -i -H "Accept: application/json" "http://$DOMO_USER:$DOMO_PASS@$DOMO_IP:$DOMO_PORT/json.htm?type=command&param=udevice&idx=$NAS_HD_SPACE_IDX&nvalue=0&svalue=$HDFree"
 
        # Free space volume in percent
        HDTotal=`snmpget -c $PASSWORD -v2c -O qv $NASIP .1.3.6.1.2.1.25.2.3.1.5.36` # Change OID to .38 on DSM 5.1
        HDUsed=`snmpget -c $PASSWORD -v2c -O qv $NASIP .1.3.6.1.2.1.25.2.3.1.6.36`  # Change OID to .38 on DSM 5.1
     	HDFreePerc=$((($HDUsed * 100) / $HDTotal))
        # Send data
        curl -s -i -H "Accept: application/json" "http://$DOMO_USER:$DOMO_PASS@$DOMO_IP:$DOMO_PORT/json.htm?type=command&param=udevice&idx=$NAS_HD_SPACE_PERC_IDX&nvalue=0&svalue=$HDFreePerc"
 
	# CPU utilisation
        CpuUser=`snmpget -v 2c -c $PASSWORD -O qv $NASIP 1.3.6.1.4.1.2021.11.9.0`
	CpuSystem=`snmpget -v 2c -c $PASSWORD -O qv $NASIP 1.3.6.1.4.1.2021.11.10.0`
	CpuUse=$(($CpuUser + $CpuSystem))
        # Send data
        curl -s -i -H "Accept: application/json" "http://$DOMO_USER:$DOMO_PASS@$DOMO_IP:$DOMO_PORT/json.htm?type=command&param=udevice&idx=$NAS_CPU_IDX&nvalue=0&svalue=$CpuUse"
 
        # Free Memory Available in %
	MemAvailable=`snmpget -v 2c -c $PASSWORD -O qv $NASIP 1.3.6.1.4.1.2021.4.6.0`
        MemAvailableinMo=$(($MemAvailable / 1024))
	MemUsepercent=$((($MemAvailableinMo * 100) / 1024))
        # Send data
       curl -s -i -H "Accept: application/json" "http://$DOMO_USER:$DOMO_PASS@$DOMO_IP:$DOMO_PORT/json.htm?type=command&param=udevice&idx=$NAS_MEM_IDX&nvalue=0&svalue=$MemUsepercent"
 
      fi
 
 else
        curl -s "http://$DOMO_USER:$DOMO_PASS@$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_USER:$DOMO_PASS@$DOMO_IP:$DOMO_PORT/json.htm?type=command&param=switchlight&idx=$NAS_IDX&switchcmd=Off"
        fi
 fi

Re: HowTo: monitor Synology NAS

Posted: Friday 09 January 2015 12:24
by Jan
In the script something is wrong. To calculate the free memory percent, the MemAvailable will be divided by 1024. For a synology with 1024MB RAM, this is right. But not for a synology with 512MB RAM. Maybe the script can be updated!

The old script contains:

Code: Select all

   # Free Memory Available in %
   MemAvailable=`snmpget -v 2c -c $PASSWORD -O qv $NASIP 1.3.6.1.4.1.2021.4.6.0`
   MemAvailableinMo=$(($MemAvailable / 1024))
   MemUsepercent=$((($MemAvailableinMo * 100) / 1024))
   # Send data
   curl -s -i -H "Accept: application/json" "http://$DOMO_USER:$DOMO_PASS@$DOMO_IP:$DOMO_PORT/json.htm?type=command&param=udevice&idx=$NAS_MEM_IDX&nvalue=0&svalue=$MemUsepercent"
Maybe this can be the solution:

Code: Select all

	# Free Memory Available 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`
	MemUsepercent=$((($MemAvailable * 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"
When I look in my DSM of my Synology the percent will be 48%. The script shows 3%. I don't know why both values are different. Hopefully somebody can explain this?

Re: HowTo: monitor Synology NAS

Posted: Sunday 01 February 2015 20:13
by MAidEN
i Jan,

Is right, we have a problem with this formul.

On my Synology i have that :

Image

On Domoticz :

Image

I don't understand how synology obtain 33% memory use...is egal to 337,92 Mo. :roll:

On my screen memory free (libre) = 106 Mb (10,5%) !

You have a same problem ?

Re: HowTo: monitor Synology NAS

Posted: Sunday 01 February 2015 22:09
by globalassist
Is there a way to monitor this in a windows-installation of Domoticz?

Re: HowTo: monitor Synology NAS

Posted: Monday 02 February 2015 7:44
by MAidEN
The script is for linux installation of domoticz only : http://www.domoticz.com/wiki/NAS_Monitoring