HowTo: monitor Synology NAS
Moderator: leecollings
-
- Posts: 36
- Joined: Friday 10 April 2020 7:01
- Target OS: NAS (Synology & others)
- Domoticz version:
- Contact:
Re: HowTo: monitor Synology NAS
Hi,
I'm trying to get the general temperature in this scripts.
This returns value: 0
I'm running domoticz on a ds214se. Is there an issue with the oid?
# Temperature NAS
NAS_TEMP=`snmpwalk -v 2c -c $PASSWORD -O qv $NASIP 1.3.6.1.4.1.6574.1.2`
echo "NAS_TEMP:" $nastemp
# Send data
echo "Sending data to device#:" $NAS_TEMP_IDX
curl -s -i -H "Accept: application/json" "http://$DOMO_IP:$DOMO_PORT/json.htm?type=command¶m=udevice&idx=$NAS_TEMP_IDX&nvalue=0&svalue=$nastemp"
echo "Data sent"
I'm trying to get the general temperature in this scripts.
This returns value: 0
I'm running domoticz on a ds214se. Is there an issue with the oid?
# Temperature NAS
NAS_TEMP=`snmpwalk -v 2c -c $PASSWORD -O qv $NASIP 1.3.6.1.4.1.6574.1.2`
echo "NAS_TEMP:" $nastemp
# Send data
echo "Sending data to device#:" $NAS_TEMP_IDX
curl -s -i -H "Accept: application/json" "http://$DOMO_IP:$DOMO_PORT/json.htm?type=command¶m=udevice&idx=$NAS_TEMP_IDX&nvalue=0&svalue=$nastemp"
echo "Data sent"
Re: HowTo: monitor Synology NAS
I am running DSM 6.2 and it works.
To get temperatures from harddisks use: 1.3.6.1.4.1.6574.2.1.1.6
You will get the temperature from every harddisk as 1.3.6.1.4.1.6574.2.1.1.6.0 1.3.6.1.4.1.6574.2.1.1.6.1 etc....
Free tester on: https://www.paessler.com/tools/snmptester
NAS_TEMP=`snmpwalk -v 2c -c $PASSWORD -O qv $NASIP 1.3.6.1.4.1.6574.1.2`
echo "NAS_TEMP:" $nastemp
Wrong variable use should be echo "NAS Temp: "$NAS_TEMP Same for the curl command
To get temperatures from harddisks use: 1.3.6.1.4.1.6574.2.1.1.6
You will get the temperature from every harddisk as 1.3.6.1.4.1.6574.2.1.1.6.0 1.3.6.1.4.1.6574.2.1.1.6.1 etc....
Free tester on: https://www.paessler.com/tools/snmptester
NAS_TEMP=`snmpwalk -v 2c -c $PASSWORD -O qv $NASIP 1.3.6.1.4.1.6574.1.2`
echo "NAS_TEMP:" $nastemp
Wrong variable use should be echo "NAS Temp: "$NAS_TEMP Same for the curl command
-
- Posts: 36
- Joined: Friday 10 April 2020 7:01
- Target OS: NAS (Synology & others)
- Domoticz version:
- Contact:
Re: HowTo: monitor Synology NAS
I only have issues with The HD temps. Only the general temp is returning blank.EddyG wrote: ↑Saturday 18 April 2020 9:14 I am running DSM 6.2 and it works.
To get temperatures from harddisks use: 1.3.6.1.4.1.6574.2.1.1.6
You will get the temperature from every harddisk as 1.3.6.1.4.1.6574.2.1.1.6.0 1.3.6.1.4.1.6574.2.1.1.6.1 etc....
Free tester on: https://www.paessler.com/tools/snmptester
The variable change did the job! Thanks
-
- Posts: 36
- Joined: Friday 10 April 2020 7:01
- Target OS: NAS (Synology & others)
- Domoticz version:
- Contact:
Re: HowTo: monitor Synology NAS
Another question:
I've added the FAN status to my script.
The data is 1 = ok 2 = not ok (From the MIB documentation)
I've added a virtual sensor, type text. it is updates nicely. But a sensor of type text is a bit ugly in the web gui.
2 questions: 1. is it possible to use a different type of sensor? Or, is it possible to use like conditional formatting. When 1 is returned, a green color, when 2 is returned, a red color.
I've added the FAN status to my script.
The data is 1 = ok 2 = not ok (From the MIB documentation)
I've added a virtual sensor, type text. it is updates nicely. But a sensor of type text is a bit ugly in the web gui.
2 questions: 1. is it possible to use a different type of sensor? Or, is it possible to use like conditional formatting. When 1 is returned, a green color, when 2 is returned, a red color.
Re: HowTo: monitor Synology NAS
You could use a Type General with Subtype Alert.
See: https://www.domoticz.com/wiki/DzVents:_ ... ert_sensor
See: https://www.domoticz.com/wiki/DzVents:_ ... ert_sensor
-
- 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
I'm trying to add it too, and send it to an ' Alert Sensor" but I can't seem to get it to work. This is what I have in my script:svdhaar wrote: ↑Saturday 18 April 2020 13:52 Another question:
I've added the FAN status to my script.
The data is 1 = ok 2 = not ok (From the MIB documentation)
I've added a virtual sensor, type text. it is updates nicely. But a sensor of type text is a bit ugly in the web gui.
2 questions: 1. is it possible to use a different type of sensor? Or, is it possible to use like conditional formatting. When 1 is returned, a green color, when 2 is returned, a red color.
Code: Select all
# Fan alert
FANUnit=`snmpget -v 2c -c $PASSWORD -O qv $NASIP 1.3.6.1.4.1.6574.1.4.1`
# Send data
curl -s -i -H "Accept: application/json" "http://$DOMO_IP:$DOMO_PORT/json.htm?type=command¶m=udevice&idx=$NAS_FAN_ALERT&nvalue=$FANUnit&svalue=FAN"
-
- Posts: 36
- Joined: Friday 10 April 2020 7:01
- Target OS: NAS (Synology & others)
- Domoticz version:
- Contact:
Re: HowTo: monitor Synology NAS
I've got it working with:dressie wrote: ↑Saturday 18 April 2020 19:51I'm trying to add it too, and send it to an ' Alert Sensor" but I can't seem to get it to work. This is what I have in my script:svdhaar wrote: ↑Saturday 18 April 2020 13:52 Another question:
I've added the FAN status to my script.
The data is 1 = ok 2 = not ok (From the MIB documentation)
I've added a virtual sensor, type text. it is updates nicely. But a sensor of type text is a bit ugly in the web gui.
2 questions: 1. is it possible to use a different type of sensor? Or, is it possible to use like conditional formatting. When 1 is returned, a green color, when 2 is returned, a red color.Any thoughts?Code: Select all
# Fan alert FANUnit=`snmpget -v 2c -c $PASSWORD -O qv $NASIP 1.3.6.1.4.1.6574.1.4.1` # Send data curl -s -i -H "Accept: application/json" "http://$DOMO_IP:$DOMO_PORT/json.htm?type=command¶m=udevice&idx=$NAS_FAN_ALERT&nvalue=$FANUnit&svalue=FAN"
FAN_STATUS=`snmpwalk -v 2c -c $PASSWORD -O qv $NASIP 1.3.6.1.4.1.6574.1.4.1`
echo "FAN_STATUS:" $FAN_STATUS
# Send data
echo "Sending data to device#:" $NAS_FAN_STAT_IDX
curl -s -i -H "Accept: application/json" "http://$DOMO_IP:$DOMO_PORT/json.htm?type=command¶m=udevice&idx=$NAS_FAN_STAT_IDX&nvalue=0&svalue=$FAN_STATUS"
echo "Data sent"
-
- Posts: 36
- Joined: Friday 10 April 2020 7:01
- Target OS: NAS (Synology & others)
- Domoticz version:
- Contact:
Re: HowTo: monitor Synology NAS
Thanks!EddyG wrote: ↑Saturday 18 April 2020 18:41 You could use a Type General with Subtype Alert.
See: https://www.domoticz.com/wiki/DzVents:_ ... ert_sensor
Any idea what the syntax should be? If it is 1, it should be green, if it is 2 it should be red..
I use this code to update the sensor:
curl -s -i -H "Accept: application/json" "http://$DOMO_IP:$DOMO_PORT/json.htm?type=command¶m=udevice&idx=$NAS_FAN_STAT_IDX&nvalue=0&svalue=$FAN_STATUS"
echo "Data sent"
Fixed it
# Fan status
FAN_STATUS=`snmpwalk -v 2c -c $PASSWORD -O qv $NASIP 1.3.6.1.4.1.6574.1.4.1`
echo "FAN_STATUS:" $FAN_STATUS
if expr $FAN_STATUS =<> "1" ; then
# Send data
echo "Sending data to device#:" $NAS_FAN_STAT_IDX
curl -s -i -H "Accept: application/json" "http://$DOMO_IP:$DOMO_PORT/json.htm?type=command¶m=udevice&idx=$NAS_FAN_STAT_IDX&nvalue=4&svalue=$FAN_STATUS"
echo "Data sent"
else
# Send data
echo "Sending data to device#:" $NAS_FAN_STAT_IDX
curl -s -i -H "Accept: application/json" "http://$DOMO_IP:$DOMO_PORT/json.htm?type=command¶m=udevice&idx=$NAS_FAN_STAT_IDX&nvalue=1&svalue=$FAN_STATUS"
echo "Data sent"
fi
-
- Posts: 66
- Joined: Friday 21 October 2016 10:42
- Target OS: NAS (Synology & others)
- Domoticz version:
- Contact:
Re: HowTo: monitor Synology NAS
mmm.... i'm getting this error after I followed every step in the tutorial:
Any ideas?
Code: Select all
./nas.sh: line 125: unexpected EOF while looking for matching `"'
./nas.sh: line 128: syntax error: unexpected end of file
-
- Posts: 1
- Joined: Wednesday 16 December 2020 12:44
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: HowTo: monitor Synology NAS
I use .44 for DSM 6.2.3-25426 Update 3svdhaar wrote: ↑Saturday 18 April 2020 8:47.41 works for me! DSM6.2multinet wrote: ↑Monday 13 April 2020 13:05 Hello
Does anyone have the correct OID for DSM6.2+ ?
Since I upgraded to this version my script is faulty on HDSPace calculation
on this part
# 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.52` # Change OID to .38 on DSM 5.1 or .41 on DSM 6.0+
HDTotal=`snmpget -v 2c -c $PASSWORD -O qv $NASIP 1.3.6.1.2.1.25.2.3.1.5.52` # Change OID to .38 on DSM 5.1 or .41 on DSM 6.0+
HDUsed=`snmpget -v 2c -c $PASSWORD -O qv $NASIP 1.3.6.1.2.1.25.2.3.1.6.52` # Change OID to .38 on DSM 5.1 or .41 on DSM 6.0+
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.52` # Change OID to .38 on DSM 5.1 or .41 on DSM 6.0+
HDUsed=`snmpget -c $PASSWORD -v2c -O qv $NASIP .1.3.6.1.2.1.25.2.3.1.6.52` # Change OID to .38 on DSM 5.1 or .41 on DSM 6.0+
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"
Thank you
-
- Posts: 3
- Joined: Saturday 06 February 2016 21:10
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: The Netherlands
- Contact:
Re: HowTo: monitor Synology NAS
I modified the code because some items where no longer working with DSM7.0.
In addition to that I decided I wanted to have the UPS data in Domoticz.
So I have added that too.
I use a cheap APC ups type CS350 which is connected to my nas via a usb cable.
My Domoticz system runs of the same UPS, so it is nice to know when a shutdown is going to happen.
(Now a Raspberry Pi 3B+ with an SSD, will become a NUC with an Intel J4105 Celeron.)
Modified the crontab entry, otherwise the script would not run completely (replacing spaces in a string would not work) from cron.
The /bin/bash entry is new here:
And here the code of nas.sh after modification.
The memory percentage calculation is modified to suit the amount of RAM in my nas. (6144)
I have a DS218+ with 6Gb of RAM installed.
In addition to that I decided I wanted to have the UPS data in Domoticz.
So I have added that too.
I use a cheap APC ups type CS350 which is connected to my nas via a usb cable.
My Domoticz system runs of the same UPS, so it is nice to know when a shutdown is going to happen.
(Now a Raspberry Pi 3B+ with an SSD, will become a NUC with an Intel J4105 Celeron.)
Modified the crontab entry, otherwise the script would not run completely (replacing spaces in a string would not work) from cron.
The /bin/bash entry is new here:
Code: Select all
*/5 * * * * /bin/bash /home/pi/domoticz/scripts/nas.sh (= every 5 minutes)
The memory percentage calculation is modified to suit the amount of RAM in my nas. (6144)
I have a DS218+ with 6Gb of RAM installed.
Code: Select all
#!/bin/bash
PATH='/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin'
# Settings
NASIP="192.168.1.?" # NAS IP Address
PASSWORD="?????" # SNMP Password
DOMO_IP="192.168.1.?" # Domoticz IP Address
DOMO_PORT="8080" # Domoticz Port
NAS_IDX="280" # NAS Switch IDX
NAS_HD1_TEMP_IDX="277" # NAS HD1 Temp IDX
NAS_HD2_TEMP_IDX="278" # NAS HD2 Temp IDX
NAS_HD_SPACE_IDX="279" # NAS HD Space IDX in Go
NAS_HD_SPACE_PERC_IDX="276" # NAS HD Space IDX in %
NAS_CPU_IDX="274" # NAS CPU IDX
NAS_MEM_IDX="275" # NAS MEM IDX
NAS_UPS_MANUFACTURER_IDX="515" # NAS UPS MANUFACTURER IDX
NAS_UPS_MODEL_IDX="516" # NAS UPS MODEL IDX
NAS_UPS_STATUS_IDX="517" # NAS UPS STATUS IDX
NAS_UPS_CHARGE_VALUE_IDX="514" # NAS UPS CHARGE VALUE 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"
# 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_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.55` # Change OID to .38 on DSM 5.1 or .41 on DSM 6.0+ was 51
HDTotal=`snmpget -v 2c -c $PASSWORD -O qv $NASIP 1.3.6.1.2.1.25.2.3.1.5.55` # Change OID to .38 on DSM 5.1 or .41 on DSM 6.0+
HDUsed=`snmpget -v 2c -c $PASSWORD -O qv $NASIP 1.3.6.1.2.1.25.2.3.1.6.55` # Change OID to .38 on DSM 5.1 or .41 on DSM 6.0+
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.55` # Change OID to .38 on DSM 5.1 or .41 on DSM 6.0+
HDUsed=`snmpget -c $PASSWORD -v2c -O qv $NASIP .1.3.6.1.2.1.25.2.3.1.6.55` # Change OID to .38 on DSM 5.1 or .41 on DSM 6.0+
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) / 6144))
# 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"
# UPS Charge value
UPSchargevalue=`snmpget -v 2c -c $PASSWORD -O qv $NASIP 1.3.6.1.4.1.6574.4.3.1.1.0`
# Send data
curl -s -i -H "Accept: application/json" "http://$DOMO_IP:$DOMO_PORT/json.htm?type=command¶m=udevice&idx=$NAS_UPS_CHARGE_VALUE_IDX&nvalue=0&svalue=$UPSchargevalue"
# UPS Status
UPSstatus=`snmpget -v 2c -c $PASSWORD -O qv $NASIP 1.3.6.1.4.1.6574.4.2.1.0`
TmpSts="${UPSstatus%\"}"
UPSstatus="${TmpSts#\"}"
echo $UPSstatus
case $UPSstatus in
OL) UPSstatTxt="ONLINE"
;;
OB) UPSstatTxt="ON%20BATTERY"
;;
LB) UPSstatTxt="LOW%20BATTERY"
;;
HB) UPSstatTxt="HIGH%20BATTERY"
;;
RB) UPSstatTxt="REPLACE%20BATTERY"
;;
CHRG) UPSstatTxt="CHARGING"
;;
DISCHRG) UPSstatTxt="DISCHARGING"
;;
BYPASS) UPSstatTxt="BYPASS"
;;
CAL) UPSstatTxt="CALIBRATION"
;;
OFF) UPSstatTxt="OFF"
;;
OVER) UPSstatTxt="OVERLOAD"
;;
TRIM) UPSstatTxt="SMARTTRIM"
;;
BOOST) UPSstatTxt="BOOST"
;;
FSD) UPSstatTxt="FORCE%20SHUTDOWN"
;;
*) UPSstatTxt="STATUS%20UNKNOWN"
;;
esac
# Send data
curl -s -i -H "Accept: application/json" "http://$DOMO_IP:$DOMO_PORT/json.htm?type=command¶m=udevice&idx=$NAS_UPS_STATUS_IDX&nvalue=0&svalue=$UPSstatTxt"
echo $UPSstatTxt
# UPS Manufacturer
UPSmanufacturer=`snmpget -v 2c -c $PASSWORD -O qv $NASIP 1.3.6.1.4.1.6574.4.1.2.0`
TmpMfg1="${UPSmanufacturer%\"}"
TmpMfg2="${TmpMfg1#\"}"
TmpMfg3="${TmpMfg2// /%20}"
UPSmanufacturerTxt=$TmpMfg3
# Send data
curl -s -i -H "Accept: application/json" "http://$DOMO_IP:$DOMO_PORT/json.htm?type=command¶m=udevice&idx=$NAS_UPS_MANUFACTURER_IDX&nvalue=0&svalue=$UPSmanufacturerTxt"
echo $UPSmanufacturerTxt
# UPS Model
UPSmodel=`snmpget -v 2c -c $PASSWORD -O qv $NASIP 1.3.6.1.4.1.6574.4.1.1.0`
TmpMod1="${UPSmodel%\"}"
TmpMod2="${TmpMod1#\"}"
TmpMod3="${TmpMod2// /%20}"
UPSmodelTxt=$TmpMod3
# Send data
curl -s -i -H "Accept: application/json" "http://$DOMO_IP:$DOMO_PORT/json.htm?type=command¶m=udevice&idx=$NAS_UPS_MODEL_IDX&nvalue=0&svalue=$UPSmodelTxt"
echo $UPSmodelTxt
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"
# 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_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.55` # Change OID to .38 on DSM 5.1 or .41 on DSM 6.0+
HDTotal=`snmpget -v 2c -c $PASSWORD -O qv $NASIP 1.3.6.1.2.1.25.2.3.1.5.55` # Change OID to .38 on DSM 5.1 or .41 on DSM 6.0+
HDUsed=`snmpget -v 2c -c $PASSWORD -O qv $NASIP 1.3.6.1.2.1.25.2.3.1.6.55` # Change OID to .38 on DSM 5.1 or .41 on DSM 6.0+
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.55` # Change OID to .38 on DSM 5.1 or .41 on DSM 6.0+
HDUsed=`snmpget -c $PASSWORD -v2c -O qv $NASIP .1.3.6.1.2.1.25.2.3.1.6.55` # Change OID to .38 on DSM 5.1 or .41 on DSM 6.0+
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 %
MemTotal=`snmpget -v 2c -c $PASSWORD -O qv $NASIP .1.3.6.1.4.1.2021.4.5.0`
MemTotalinMo=$(($MemTotal / 1024))
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) / MemTotalinMo))
# 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"
# UPS Charge value
UPSchargevalue=`snmpget -v 2c -c $PASSWORD -O qv $NASIP 1.3.6.1.4.1.6574.4.3.1.1.0`
# Send data
curl -s -i -H "Accept: application/json" "http://$DOMO_IP:$DOMO_PORT/json.htm?type=command¶m=udevice&idx=$NAS_UPS_CHARGE_VALUE_IDX&nvalue=0&svalue=$UPSchargevalue"
# UPS Status
UPSstatus=`snmpget -v 2c -c $PASSWORD -O qv $NASIP 1.3.6.1.4.1.6574.4.2.1.0`
TmpSts="${UPSstatus%\"}"
UPSstatus="${TmpSts#\"}"
echo $UPSstatus
case $UPSstatus in
OL) UPSstatTxt="ONLINE"
;;
OB) UPSstatTxt="ON%20BATTERY"
;;
LB) UPSstatTxt="LOW%20BATTERY"
;;
HB) UPSstatTxt="HIGH%20BATTERY"
;;
RB) UPSstatTxt="REPLACE%20BATTERY"
;;
CHRG) UPSstatTxt="CHARGING"
;;
DISCHRG) UPSstatTxt="DISCHARGING"
;;
BYPASS) UPSstatTxt="BYPASS"
;;
CAL) UPSstatTxt="CALIBRATION"
;;
OFF) UPSstatTxt="OFF"
;;
OVER) UPSstatTxt="OVERLOAD"
;;
TRIM) UPSstatTxt="SMARTTRIM"
;;
BOOST) UPSstatTxt="BOOST"
;;
FSD) UPSstatTxt="FORCE%20SHUTDOWN"
;;
*) UPSstatTxt="STATUS%20UNKNOWN"
;;
esac
# Send data
curl -s -i -H "Accept: application/json" "http://$DOMO_IP:$DOMO_PORT/json.htm?type=command¶m=udevice&idx=$NAS_UPS_STATUS_IDX&nvalue=0&svalue=$UPSstatTxt"
echo $UPSstatTxt
# UPS Manufacturer
UPSmanufacturer=`snmpget -v 2c -c $PASSWORD -O qv $NASIP 1.3.6.1.4.1.6574.4.1.2.0`
TmpMfg1="${UPSmanufacturer%\"}"
TmpMfg2="${TmpMfg1#\"}"
TmpMfg3="${TmpMfg2// /%20}"
UPSmanufacturerTxt=$TmpMfg3
# Send data
curl -s -i -H "Accept: application/json" "http://$DOMO_IP:$DOMO_PORT/json.htm?type=command¶m=udevice&idx=$NAS_UPS_MANUFACTURER_IDX&nvalue=0&svalue=$UPSmanufacturerTxt"
echo $UPSmanufacturerTxt
# UPS Model
UPSmodel=`snmpget -v 2c -c $PASSWORD -O qv $NASIP 1.3.6.1.4.1.6574.4.1.1.0`
TmpMod1="${UPSmodel%\"}"
TmpMod2="${TmpMod1#\"}"
TmpMod3="${TmpMod2// /%20}"
UPSmodelTxt=$TmpMod3
# Send data
curl -s -i -H "Accept: application/json" "http://$DOMO_IP:$DOMO_PORT/json.htm?type=command¶m=udevice&idx=$NAS_UPS_MODEL_IDX&nvalue=0&svalue=$UPSmodelTxt"
echo $UPSmodelTxt
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
Re: HowTo: monitor Synology NAS
For what purpose do you use 'UPSmanufacturer' and UPSmodel in Domoticz? Does that change overtime?
-
- Posts: 3
- Joined: Saturday 06 February 2016 21:10
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: The Netherlands
- Contact:
Re: HowTo: monitor Synology NAS
You are right, those (manufacturer and model) serve no purpose at all.
Looking back at it, the only thing the ups data provides for me is info in the Domoticz screen.
For switching off the server when the ups shuts down I use nut.
Could have used nut to get the ups info in Domoticz as well.
Looking back at it, the only thing the ups data provides for me is info in the Domoticz screen.
For switching off the server when the ups shuts down I use nut.
Could have used nut to get the ups info in Domoticz as well.
-
- Posts: 39
- Joined: Thursday 24 February 2022 8:32
- Target OS: Linux
- Domoticz version: 2024.4
- Contact:
Re: HowTo: monitor Synology NAS
This setup works fairly well and many of the tips written in the forum are useful. However, the disk temperatures are oscillating between 0 and 31ºC for some reason
I'm on DSM7 and have been using the following script
Does anyone has stumbled upon the same issue? Thanks in advance.
I'm on DSM7 and have been using the following script
Code: Select all
#!/bin/bash
# Settings
NASIP="192.168.1.150" # NAS IP Address
PASSWORD="xxxxxxxxxxxxxxxxxxxxx" # SNMP Password
DOMO_IP="192.168.1.151" # Domoticz IP Address
DOMO_PORT="8080" # Domoticz Port
NAS_IDX="60" # NAS Switch IDX
NAS_HD1_TEMP_IDX="61" # NAS HD1 Temp IDX
NAS_HD2_TEMP_IDX="62" # NAS HD2 Temp IDX
NAS_HD_SPACE_IDX="66" # NAS HD Space IDX in Go
NAS_HD_SPACE_PERC_IDX="65" # NAS HD Space IDX in %
NAS_CPU_IDX="63" # NAS CPU IDX
NAS_MEM_IDX="64" # 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=`snmpwalk -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"
# Temperature HD2
HDtemp2=`snmpwalk -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_IP:$DOMO_PORT/json.htm?type=command¶m=udevice&idx=$NAS_HD2_TEMP_IDX&nvalue=0&svalue=$HDtemp2"
# Free space volume in Go
HDUnit=`snmpwalk -v 2c -c $PASSWORD -O qv $NASIP 1.3.6.1.2.1.25.2.3.1.4.55` # Change OID to .38 on DSM 5.1, .41 on DSM 6.0, 42 on DSM 6.1, 44 for DSM 6.2.3
HDTotal=`snmpwalk -v 2c -c $PASSWORD -O qv $NASIP 1.3.6.1.2.1.25.2.3.1.5.55` # Change OID to .38 on DSM 5.1, .41 on DSM 6.0, 42 on DSM 6.1, 44 for DSM 6.2.3
HDUsed=`snmpwalk -v 2c -c $PASSWORD -O qv $NASIP 1.3.6.1.2.1.25.2.3.1.6.55` # Change OID to .38 on DSM 5.1, .41 on DSM 6.0, 42 on DSM 6.1, 44 for DSM 6.2.3
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=`snmpwalk -c $PASSWORD -v2c -O qv $NASIP .1.3.6.1.2.1.25.2.3.1.5.55` # Change OID to .38 on DSM 5.1, .41 on DSM 6.0, 42 on DSM 6.1, 44 for DSM 6.2.3
HDUsed=`snmpwalk -c $PASSWORD -v2c -O qv $NASIP .1.3.6.1.2.1.25.2.3.1.6.55` # Change OID to .38 on DSM 5.1, .41 on DSM 6.0, 42 on DSM 6.1, 44 for DSM 6.2.3
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=`snmpwalk -v 2c -c $PASSWORD -O qv $NASIP 1.3.6.1.4.1.2021.11.9.0`
CpuSystem=`snmpwalk -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=`snmpwalk -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=`snmpwalk -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"
# Temperature HD2
HDtemp2=`snmpwalk -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_IP:$DOMO_PORT/json.htm?type=command¶m=udevice&idx=$NAS_HD2_TEMP_IDX&nvalue=0&svalue=$HDtemp2"
# Free space volume in Go
HDUnit=`snmpwalk -v 2c -c $PASSWORD -O qv $NASIP 1.3.6.1.2.1.25.2.3.1.4.55` # Change OID to .38 on DSM 5.1, .41 on DSM 6.0, 42 on DSM 6.1, 44 for DSM 6.2.3
HDTotal=`snmpwalk -v 2c -c $PASSWORD -O qv $NASIP 1.3.6.1.2.1.25.2.3.1.5.55` # Change OID to .38 on DSM 5.1, .41 on DSM 6.0, 42 on DSM 6.1, 44 for DSM 6.2.3
HDUsed=`snmpwalk -v 2c -c $PASSWORD -O qv $NASIP 1.3.6.1.2.1.25.2.3.1.6.55` # Change OID to .38 on DSM 5.1, .41 on DSM 6.0, 42 on DSM 6.1, 44 for DSM 6.2.3
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=`snmpwalk -c $PASSWORD -v2c -O qv $NASIP .1.3.6.1.2.1.25.2.3.1.5.55` # Change OID to .38 on DSM 5.1, .41 on DSM 6.0, 42 on DSM 6.1, 44 for DSM 6.2.3
HDUsed=`snmpwalk -c $PASSWORD -v2c -O qv $NASIP .1.3.6.1.2.1.25.2.3.1.6.55` # Change OID to .38 on DSM 5.1, .41 on DSM 6.0, 42 on DSM 6.1, 44 for DSM 6.2.3
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=`snmpwalk -v 2c -c $PASSWORD -O qv $NASIP 1.3.6.1.4.1.2021.11.9.0`
CpuSystem=`snmpwalk -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=`snmpwalk -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: 39
- Joined: Thursday 24 February 2022 8:32
- Target OS: Linux
- Domoticz version: 2024.4
- Contact:
Re: HowTo: monitor Synology NAS
My issue is exactly the same as yours. I've changed my cronjob to output the logcurious wrote: ↑Friday 27 January 2017 21:57 When I run the script I mostly get the message Timeout : no response
When pinging the ip-adres I get an answer within about .420 ms
Besides that I get an error message :
line 44: ( - ) * / 1024 / 1024 / 1024: syntax error: operand expected (error token is ") * / 1024 / 1024 / 1024")
But that can be caused by the time outs ?
The script in line 43 and 44 is :I can't see anything wrong, the only thing I changes is .36 to .41Code: Select all
HDUsed=`snmpget -v 2c -c $PASSWORD -O qv $NASIP 1.3.6.1.2.1.25.2.3.1.6.41` # Change OID to .38 on DSM 5.1 or .41 on DSM 6.0+ HDFree=$((($HDTotal - $HDUsed) * $HDUnit / 1024 / 1024 / 1024))
I have a synology 213J running on DSM 6.0+
NB: When running a single command like :
HDUsed=`snmpget -v 2c -c $PASSWORD -O qv $NASIP 1.3.6.1.2.1.25.2.3.1.6.41`
I sometimes get a result but not often (time out)
Code: Select all
*/5 * * * * /home/pi/domoticz/scripts/nas.sh 1> /dev/null 2> /home/pi/some_job.err
Code: Select all
Timeout: No Response from 192.168.1.5
Timeout: No Response from 192.168.1.5
Timeout: No Response from 192.168.1.5
Timeout: No Response from 192.168.1.5
/home/pi/domoticz/scripts/nas.sh: line 44: ( - 201822598) * / 1024 / 1024 / 1024: syntax error: operand expected (error token is "/ 1024 / 1024 / 1024")
My DSM is version 7.2 and the nas.sh code that I'm using is
Code: Select all
#!/bin/bash
# Settings
NASIP="192.168.1.5" # NAS IP Address
PASSWORD="????????????????????" # SNMP Password
DOMO_IP="192.168.1.162" # Domoticz IP Address
DOMO_PORT="8080" # Domoticz Port
NAS_IDX="60" # NAS Switch IDX
NAS_HD1_TEMP_IDX="61" # NAS HD1 Temp IDX
NAS_HD2_TEMP_IDX="62" # NAS HD2 Temp IDX
NAS_HD_SPACE_IDX="66" # NAS HD Space IDX in Go
NAS_HD_SPACE_PERC_IDX="65" # NAS HD Space IDX in %
NAS_CPU_IDX="63" # NAS CPU IDX
NAS_MEM_IDX="64" # 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=command¶m=getdevices&rid=$NAS_IDX" | grep "Status" | grep "On" > /dev/null
if [ $? -eq 0 ] ; then
echo "NAS already ON"
# Temperature HD1
HDtemp1=`snmpwalk -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"
# Temperature HD2
HDtemp2=`snmpwalk -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_IP:$DOMO_PORT/json.htm?type=command¶m=udevice&idx=$NAS_HD2_TEMP_IDX&nvalue=0&svalue=$HDtemp2"
# Free space volume in Go
HDUnit=`snmpwalk -v 2c -c $PASSWORD -O qv $NASIP 1.3.6.1.2.1.25.2.3.1.4.55` # Change OID to .38 on DSM 5.1, .41 on DSM 6.0, 42 on DSM 6.1, 44 for DSM 6.2.3
HDTotal=`snmpwalk -v 2c -c $PASSWORD -O qv $NASIP 1.3.6.1.2.1.25.2.3.1.5.55` # Change OID to .38 on DSM 5.1, .41 on DSM 6.0, 42 on DSM 6.1, 44 for DSM 6.2.3
HDUsed=`snmpwalk -v 2c -c $PASSWORD -O qv $NASIP 1.3.6.1.2.1.25.2.3.1.6.55` # Change OID to .38 on DSM 5.1, .41 on DSM 6.0, 42 on DSM 6.1, 44 for DSM 6.2.3
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=`snmpwalk -c $PASSWORD -v2c -O qv $NASIP .1.3.6.1.2.1.25.2.3.1.5.55` # Change OID to .38 on DSM 5.1, .41 on DSM 6.0, 42 on DSM 6.1, 44 for DSM 6.2.3
HDUsed=`snmpwalk -c $PASSWORD -v2c -O qv $NASIP .1.3.6.1.2.1.25.2.3.1.6.55` # Change OID to .38 on DSM 5.1, .41 on DSM 6.0, 42 on DSM 6.1, 44 for DSM 6.2.3
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=`snmpwalk -v 2c -c $PASSWORD -O qv $NASIP 1.3.6.1.4.1.2021.11.9.0`
CpuSystem=`snmpwalk -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=`snmpwalk -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=`snmpwalk -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"
# Temperature HD2
HDtemp2=`snmpwalk -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_IP:$DOMO_PORT/json.htm?type=command¶m=udevice&idx=$NAS_HD2_TEMP_IDX&nvalue=0&svalue=$HDtemp2"
# Free space volume in Go
HDUnit=`snmpwalk -v 2c -c $PASSWORD -O qv $NASIP 1.3.6.1.2.1.25.2.3.1.4.55` # Change OID to .38 on DSM 5.1, .41 on DSM 6.0, 42 on DSM 6.1, 44 for DSM 6.2.3
HDTotal=`snmpwalk -v 2c -c $PASSWORD -O qv $NASIP 1.3.6.1.2.1.25.2.3.1.5.55` # Change OID to .38 on DSM 5.1, .41 on DSM 6.0, 42 on DSM 6.1, 44 for DSM 6.2.3
HDUsed=`snmpwalk -v 2c -c $PASSWORD -O qv $NASIP 1.3.6.1.2.1.25.2.3.1.6.55` # Change OID to .38 on DSM 5.1, .41 on DSM 6.0, 42 on DSM 6.1, 44 for DSM 6.2.3
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=`snmpwalk -c $PASSWORD -v2c -O qv $NASIP .1.3.6.1.2.1.25.2.3.1.5.55` # Change OID to .38 on DSM 5.1, .41 on DSM 6.0, 42 on DSM 6.1, 44 for DSM 6.2.3
HDUsed=`snmpwalk -c $PASSWORD -v2c -O qv $NASIP .1.3.6.1.2.1.25.2.3.1.6.55` # Change OID to .38 on DSM 5.1, .41 on DSM 6.0, 42 on DSM 6.1, 44 for DSM 6.2.3
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=`snmpwalk -v 2c -c $PASSWORD -O qv $NASIP 1.3.6.1.4.1.2021.11.9.0`
CpuSystem=`snmpwalk -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=`snmpwalk -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=command¶m=getdevices&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: 39
- Joined: Thursday 24 February 2022 8:32
- Target OS: Linux
- Domoticz version: 2024.4
- Contact:
Re: HowTo: monitor Synology NAS
I've made a few extra tests and based on this webpage
https://www.baeldung.com/linux/snmpwalk ... out-values
one can set timeout values to improve the success rate. After a few tests I was able to avoid any timeout errors, by setting the interval at 5 seconds with 3 retries. However, the disk temperature values still return zero and the NAS does some clicking noise at every 25 minutes. If I comment out the snmpwalk commands for temperature this does not happen anymore, and I've confirmed that it happens for any of my two disks. I've checked that my commands are correct using
which returns
and so I am not sure what else to do...(head scratching). There is a possibly related post in synology's forum
https://community.synology.com/enu/forum/17/post/82156
https://www.baeldung.com/linux/snmpwalk ... out-values
one can set timeout values to improve the success rate. After a few tests I was able to avoid any timeout errors, by setting the interval at 5 seconds with 3 retries. However, the disk temperature values still return zero and the NAS does some clicking noise at every 25 minutes. If I comment out the snmpwalk commands for temperature this does not happen anymore, and I've confirmed that it happens for any of my two disks. I've checked that my commands are correct using
Code: Select all
snmpwalk -v 2c -c"mypassword" 192.168.1.5 1.3.6.1.4.1.6574.2.1.1.6
Code: Select all
SYNOLOGY-DISK-MIB::diskTemperature.0 = INTEGER: 30
SYNOLOGY-DISK-MIB::diskTemperature.1 = INTEGER: 31
https://community.synology.com/enu/forum/17/post/82156
-
- Posts: 2
- Joined: Wednesday 18 September 2024 19:01
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: HowTo: monitor Synology NAS
Hi, I used the monitor script for years to monitor my NAS disk usage, but I recently upgraded to DSM 7.1.1 and now it doesn't work any more.
Does anyone know the correct OID for DSM 7.1.1?
.55 also doesn't work
Does anyone know the correct OID for DSM 7.1.1?
Code: Select all
# Free space volume in Go
HDUnit=`snmpwalk -v 2c -c $PASSWORD -O qv $NASIP 1.3.6.1.2.1.25.2.3.1.4.55` # Change OID to .38 on DSM 5.1, .41 on DSM 6.0, 42 on DSM 6.1, 44 for DSM 6.2.3
HDTotal=`snmpwalk -v 2c -c $PASSWORD -O qv $NASIP 1.3.6.1.2.1.25.2.3.1.5.55` # Change OID to .38 on DSM 5.1, .41 on DSM 6.0, 42 on DSM 6.1, 44 for DSM 6.2.3
HDUsed=`snmpwalk -v 2c -c $PASSWORD -O qv $NASIP 1.3.6.1.2.1.25.2.3.1.6.55` # Change OID to .38 on DSM 5.1, .41 on DSM 6.0, 42 on DSM 6.1, 44 for DSM 6.2.3
HDFree=$((($HDTotal - $HDUsed) * $HDUnit / 1024 / 1024 / 1024))
- waltervl
- Posts: 5148
- Joined: Monday 28 January 2019 18:48
- Target OS: Linux
- Domoticz version: 2024.7
- Location: NL
- Contact:
Re: HowTo: monitor Synology NAS
Perhaps this tip will help you to find the correct OID https://domoticz.com/forum/viewtopic.ph ... 78#p279178
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
-
- Posts: 2
- Joined: Wednesday 18 September 2024 19:01
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: HowTo: monitor Synology NAS
Thanx, found it:
With 48 everything works again!
Code: Select all
pi@domoticz:~/domoticz/scripts $ snmpget -c xxxxxx -v2c -O qv xxx.xxx.xxx.xxx 1.3.6.1.2.1.25.2.3.1.3.48
"/volume1"
Who is online
Users browsing this forum: No registered users and 1 guest