HowTo: monitor Synology NAS
Moderator: leecollings
-
- Posts: 17
- Joined: Sunday 07 December 2014 15:14
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: HowTo: monitor Synology NAS
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?
@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?
-
- Posts: 24
- Joined: Tuesday 16 July 2013 10:12
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Contact:
Re: HowTo: monitor Synology NAS
I have the solution for the Disk monitoring of my NAS with the screenshot above. The OID of Volume1 is 38.MAidEN wrote:
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¶m=udevice&idx=$NAS_HD_SPACE_IDX&nvalue=$0&svalue=$HDFree"
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¶m=udevice&idx=$NAS_HD_SPACE_PERC_IDX&nvalue=0&svalue=$HDFreePerc"
-
- Posts: 402
- Joined: Wednesday 26 February 2014 15:28
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: the Netherlands
- Contact:
Re: HowTo: monitor Synology NAS
The above seems to work indeed.
-
- Posts: 402
- Joined: Wednesday 26 February 2014 15:28
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: the Netherlands
- Contact:
Re: HowTo: monitor Synology NAS
Just login here and you can edit the wiki page.MAidEN wrote:Yes we can add this tip on Wiki. How do that?
-
- Posts: 17
- Joined: Sunday 07 December 2014 15:14
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: HowTo: monitor Synology NAS
Thanks is ok now, but I don't understand why I have a value "7" on title :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 GBThe code for Free Space in PercentCode: 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¶m=udevice&idx=$NAS_HD_SPACE_IDX&nvalue=$0&svalue=$HDFree"
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¶m=udevice&idx=$NAS_HD_SPACE_PERC_IDX&nvalue=0&svalue=$HDFreePerc"
The good value is 5901 Go.
The percent monitor is ok.
-
- Posts: 17
- Joined: Sunday 07 December 2014 15:14
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: HowTo: monitor Synology NAS
It's good I had update the wiki page with this news :decrxgarage wrote:Just login here and you can edit the wiki page.MAidEN wrote:Yes we can add this tip on Wiki. How do that?
Cpu monitor
Memory monitor
Disk usage in %
And I add a coment with new OID for disk usage to DSM 5.1 (.38)
-
- Posts: 278
- Joined: Sunday 14 December 2014 12:28
- Target OS: Raspberry Pi / ODroid
- Domoticz version: V4.11375
- Contact:
Re: HowTo: monitor Synology NAS
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.
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.
- Attachments
-
- Knipsel.PNG (26.79 KiB) Viewed 6314 times
-
- Posts: 402
- Joined: Wednesday 26 February 2014 15:28
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: the Netherlands
- Contact:
Re: HowTo: monitor Synology NAS
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).
- sincze
- Posts: 1299
- Joined: Monday 02 June 2014 22:46
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2024.4
- Location: Netherlands / Breda Area
- Contact:
Re: HowTo: monitor Synology NAS
Excellent .
Pass2php
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
-
- Posts: 278
- Joined: Sunday 14 December 2014 12:28
- Target OS: Raspberry Pi / ODroid
- Domoticz version: V4.11375
- Contact:
Re: HowTo: monitor Synology NAS
Thanks for the quick reply. I will give it a trydecrxgarage wrote:SwordFish wrote:So I have questing, how do i make a virtual Switch en the virtual temperature sensors?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.
- 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).
-
- Posts: 278
- Joined: Sunday 14 December 2014 12:28
- Target OS: Raspberry Pi / ODroid
- Domoticz version: V4.11375
- Contact:
Re: HowTo: monitor Synology NAS
I've managed to get the virtual switches but when i test the script i'll still get this?
- Attachments
-
- Knipsel.PNG (26.79 KiB) Viewed 6320 times
-
- Posts: 402
- Joined: Wednesday 26 February 2014 15:28
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: the Netherlands
- Contact:
Re: HowTo: monitor Synology NAS
Did you make the script executable:
Is this a windows machine?
Code: Select all
sudo chmod +x nas.sh
-
- Posts: 278
- Joined: Sunday 14 December 2014 12:28
- Target OS: Raspberry Pi / ODroid
- Domoticz version: V4.11375
- Contact:
Re: HowTo: monitor Synology NAS
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. #!/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¶m=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¶m=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¶m=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¶m=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¶m=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¶m=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¶m=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¶m=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¶m=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¶m=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¶m=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¶m=switchlight&idx=$NAS_IDX&switchcmd=Off"
fi
fi
- 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. #!/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¶m=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¶m=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¶m=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¶m=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¶m=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¶m=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¶m=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¶m=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¶m=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¶m=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¶m=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¶m=switchlight&idx=$NAS_IDX&switchcmd=Off"
fi
fi
-
- Posts: 402
- Joined: Wednesday 26 February 2014 15:28
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: the Netherlands
- Contact:
Re: HowTo: monitor Synology NAS
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.
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.
-
- Posts: 278
- Joined: Sunday 14 December 2014 12:28
- Target OS: Raspberry Pi / ODroid
- Domoticz version: V4.11375
- Contact:
Re: HowTo: monitor Synology NAS
Thanks, will remove that.
Sorry for not using the code tags, didn't know .
Sorry for not using the code tags, didn't know .
-
- Posts: 33
- Joined: Saturday 03 January 2015 22:05
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: The Netherlands
- Contact:
Re: HowTo: monitor Synology NAS
I was having the same issue as Swordfish, because is have a username and password installed.
i've edit the script (for synology) to:
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¶m=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¶m=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¶m=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¶m=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¶m=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¶m=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¶m=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¶m=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¶m=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¶m=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¶m=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¶m=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¶m=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¶m=switchlight&idx=$NAS_IDX&switchcmd=Off"
fi
fi
-
- Posts: 4
- Joined: Wednesday 05 February 2014 7:18
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: HowTo: monitor Synology NAS
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:
Maybe this can be the solution:
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?
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¶m=udevice&idx=$NAS_MEM_IDX&nvalue=0&svalue=$MemUsepercent"
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¶m=udevice&idx=$NAS_MEM_IDX&nvalue=0&svalue=$MemUsepercent"
Last edited by Jan on Friday 09 January 2015 12:38, edited 1 time in total.
My hardware:
- Raspberry Pi
- Rfxtrx433 transceiver
- RaZberry
- Nuon Smart Plug 6 (2x)
- Nuon Smart Plug (5x)
- Fibaro Universal Sensor
- Fibaro Smoke Sensor
- Aeon Door Sensor
- Bluetooth dongle
- Raspberry Pi
- Rfxtrx433 transceiver
- RaZberry
- Nuon Smart Plug 6 (2x)
- Nuon Smart Plug (5x)
- Fibaro Universal Sensor
- Fibaro Smoke Sensor
- Aeon Door Sensor
- Bluetooth dongle
-
- Posts: 17
- Joined: Sunday 07 December 2014 15:14
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: HowTo: monitor Synology NAS
i Jan,
Is right, we have a problem with this formul.
On my Synology i have that :
On Domoticz :
I don't understand how synology obtain 33% memory use...is egal to 337,92 Mo.
On my screen memory free (libre) = 106 Mb (10,5%) !
You have a same problem ?
Is right, we have a problem with this formul.
On my Synology i have that :
On Domoticz :
I don't understand how synology obtain 33% memory use...is egal to 337,92 Mo.
On my screen memory free (libre) = 106 Mb (10,5%) !
You have a same problem ?
-
- Posts: 25
- Joined: Monday 09 December 2013 16:51
- Target OS: Windows
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: HowTo: monitor Synology NAS
Is there a way to monitor this in a windows-installation of Domoticz?
-
- Posts: 17
- Joined: Sunday 07 December 2014 15:14
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: HowTo: monitor Synology NAS
The script is for linux installation of domoticz only : http://www.domoticz.com/wiki/NAS_Monitoring
Who is online
Users browsing this forum: No registered users and 0 guests