Python Plugin: Synology SNMP Monitor
Moderator: leecollings
-
- Posts: 331
- Joined: Monday 03 July 2017 19:58
- Target OS: NAS (Synology & others)
- Domoticz version:
- Contact:
Python Plugin: Synology SNMP Monitor
This plugin monitors the following services on Synology via SNMP service:
You can find the plugin on: https://github.com/febalci/DomoticzSynology
NAS Status
HDD Empty Space %
NAS Temperature
HDD Temperature up to 4 disks
NAS CPU
NAS Memory
UPS Status
UPS Charge %
UPS Battery Time Left
Thanks to @ycahome for SNMP Reader Plugin : https://github.com/ycahome/SNMPreader
Installation
On Synology: Open Control Panel - Terminal & SNMP - SNMP - Enable SNMP Service and SNMPv1,SNMPv2c service and note down Community password.
On Domoticz install pysnmp: sudo pip3 install pysnmp
Install plugin.py to Domoticz plugins folder.
Configuration
Address: Synology IP Address
Community: Synology SNMP Community Password
DSM OID: Change this OID to 38 on DSM 5.1, 41 on DSM 6.0, 42 on DSM 6.1, 51 on DSM 6.2
Check Interval: Poll interval in minutes
This is the First commit and please bear in mind that it is beta at its best. It works well on my Synology DS 916+ on DSM 6.2. Please inform me if you have any problems...
You can find the plugin on: https://github.com/febalci/DomoticzSynology
NAS Status
HDD Empty Space %
NAS Temperature
HDD Temperature up to 4 disks
NAS CPU
NAS Memory
UPS Status
UPS Charge %
UPS Battery Time Left
Thanks to @ycahome for SNMP Reader Plugin : https://github.com/ycahome/SNMPreader
Installation
On Synology: Open Control Panel - Terminal & SNMP - SNMP - Enable SNMP Service and SNMPv1,SNMPv2c service and note down Community password.
On Domoticz install pysnmp: sudo pip3 install pysnmp
Install plugin.py to Domoticz plugins folder.
Configuration
Address: Synology IP Address
Community: Synology SNMP Community Password
DSM OID: Change this OID to 38 on DSM 5.1, 41 on DSM 6.0, 42 on DSM 6.1, 51 on DSM 6.2
Check Interval: Poll interval in minutes
This is the First commit and please bear in mind that it is beta at its best. It works well on my Synology DS 916+ on DSM 6.2. Please inform me if you have any problems...
Last edited by febalci on Thursday 11 July 2019 20:29, edited 1 time in total.
Re: Python Plugin: Synology SNMP Monitor
After I made a stupid mistake and corrected it the plugin works.
I added drive number 5 because I have a ds1517+

I added drive number 5 because I have a ds1517+
- sincze
- Posts: 1300
- Joined: Monday 02 June 2014 22:46
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2024.4
- Location: Netherlands / Breda Area
- Contact:
Re: Python Plugin: Synology SNMP Monitor
Works like a charm.

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.
- LouiS22
- Posts: 433
- Joined: Friday 27 February 2015 13:21
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Location: Budapest, Hungary
- Contact:
Re: Python Plugin: Synology SNMP Monitor
Getting errors in log:
2019-07-07 21:34:28.917 Error: (SynoMonitor) 'onHeartbeat' failed 'ValueError':'non-hexadecimal number found in fromhex() arg at position 1'.
2019-07-07 21:34:28.917 Error: (SynoMonitor) ----> Line 271 in '/home/pi/domoticz/plugins/DomoticzSynology/plugin.py', function onHeartbeat
2019-07-07 21:34:28.917 Error: (SynoMonitor) ----> Line 221 in '/home/pi/domoticz/plugins/DomoticzSynology/plugin.py', function onHeartbeat
Also, HDD temperature monitor is not created (I have a DS416play - so that would be 4 temperature units).
2019-07-07 21:34:28.917 Error: (SynoMonitor) 'onHeartbeat' failed 'ValueError':'non-hexadecimal number found in fromhex() arg at position 1'.
2019-07-07 21:34:28.917 Error: (SynoMonitor) ----> Line 271 in '/home/pi/domoticz/plugins/DomoticzSynology/plugin.py', function onHeartbeat
2019-07-07 21:34:28.917 Error: (SynoMonitor) ----> Line 221 in '/home/pi/domoticz/plugins/DomoticzSynology/plugin.py', function onHeartbeat
Also, HDD temperature monitor is not created (I have a DS416play - so that would be 4 temperature units).
-
- Posts: 331
- Joined: Monday 03 July 2017 19:58
- Target OS: NAS (Synology & others)
- Domoticz version:
- Contact:
Re: Python Plugin: Synology SNMP Monitor
The error comes from UPS Charge percent calculation, i understand you do not have a UPS connected to your Synology right? I have to put a check mechansim for UPS then. Btw the HDD Temperature units are created but not activated. You can find them in Settings-Devices page and activate them.LouiS22 wrote: ↑Sunday 07 July 2019 21:35 Getting errors in log:
2019-07-07 21:34:28.917 Error: (SynoMonitor) 'onHeartbeat' failed 'ValueError':'non-hexadecimal number found in fromhex() arg at position 1'.
2019-07-07 21:34:28.917 Error: (SynoMonitor) ----> Line 271 in '/home/pi/domoticz/plugins/DomoticzSynology/plugin.py', function onHeartbeat
2019-07-07 21:34:28.917 Error: (SynoMonitor) ----> Line 221 in '/home/pi/domoticz/plugins/DomoticzSynology/plugin.py', function onHeartbeat
Also, HDD temperature monitor is not created (I have a DS416play - so that would be 4 temperature units).
- gizmocuz
- Posts: 2478
- Joined: Thursday 11 July 2013 18:59
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Location: Top of the world
- Contact:
Re: Python Plugin: Synology SNMP Monitor
Thanks for the Plugin !
It would be great if you could make this more generic....
Map OID xx.yy.zz ====> Percentage sensor
Map OID xx.yy.zz ====> to Temp sensor
Map ...
Where you define this as an array at the top of your plugin/or a file
This way, it could also be used to read out servers/switches/routers/.....
(Of course deliver a example configuration file for the Synology would be great!)
It would be great if you could make this more generic....
Map OID xx.yy.zz ====> Percentage sensor
Map OID xx.yy.zz ====> to Temp sensor
Map ...
Where you define this as an array at the top of your plugin/or a file
This way, it could also be used to read out servers/switches/routers/.....
(Of course deliver a example configuration file for the Synology would be great!)
Quality outlives Quantity!
Re: Python Plugin: Synology SNMP Monitor
Please add RaidStatus to the set of devices.
Also when you do a new setup, make it easy to add an other drive, in my case I have 5 disks
Also when you do a new setup, make it easy to add an other drive, in my case I have 5 disks
- EdwinK
- Posts: 1820
- Joined: Sunday 22 January 2017 21:46
- Target OS: Raspberry Pi / ODroid
- Domoticz version: BETA
- Location: Rhoon
- Contact:
Re: Python Plugin: Synology SNMP Monitor
When I add this, I get:
But
2019-07-09 07:31:48.974 Error: (SynoMonitor) failed to load 'plugin.py', Python Path used was '/home/pi/domoticz/plugins/DomoticzSynology/:/usr/lib/python37.zip:/usr/lib/python3.7:/usr/lib/python3.7/lib-dynload:/usr/local/lib/python3.7/dist-packages:/usr/lib/python3/dist-packages:/usr/lib/python3.7/dist-packages'.
2019-07-09 07:31:48.974 Error: (DiskStation) Module Import failed, exception: 'ModuleNotFoundError'
2019-07-09 07:31:48.974 Error: (DiskStation) Module Import failed: ' Name: pysnmp'
2019-07-09 07:31:48.975 Error: (DiskStation) Error Line details not available
But
So, what am I doing wrong?pip3 install pysnmp
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Requirement already satisfied: pysnmp in /home/pi/.local/lib/python3.7/site-packages (4.4.9)
Requirement already satisfied: pyasn1>=0.2.3 in /home/pi/.local/lib/python3.7/site-packages (from pysnmp) (0.4.5)
Requirement already satisfied: pycryptodomex in /home/pi/.local/lib/python3.7/site-packages (from pysnmp) (3.8.2)
Requirement already satisfied: pysmi in /home/pi/.local/lib/python3.7/site-packages (from pysnmp) (0.3.4)
Requirement already satisfied: ply in /home/pi/.local/lib/python3.7/site-packages (from pysmi->pysnmp) (3.11)
Running latest BETA on a Pi-3 | Toon® Thermostat (rooted) | Hue | Tuya | IKEA tradfri | Dashticz V3 on Lenovo Huawei Tablet | Conbee
- Dnpwwo
- Posts: 820
- Joined: Sunday 23 March 2014 9:00
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: Melbourne, Australia
- Contact:
Re: Python Plugin: Synology SNMP Monitor
Did you run the pip3 command with ‘sudo’?
That’s the most common problem
That’s the most common problem
The reasonable man adapts himself to the world; the unreasonable one persists to adapt the world to himself. Therefore all progress depends on the unreasonable man. George Bernard Shaw
Re: Python Plugin: Synology SNMP Monitor
Unfortunately the plugin has a huge impact on CPU usage % peeks of over 20%, with a normal of around 1-3%.
Also memory consumption is big, more then 20Mb extra.
Even the CPU temperature has a fluctuation of 5 degrees Celsius when the CPU usage peeks.
I have the same functions running in a bash script for years now, without any impact on anything.
So what is going on?
Also memory consumption is big, more then 20Mb extra.
Even the CPU temperature has a fluctuation of 5 degrees Celsius when the CPU usage peeks.
I have the same functions running in a bash script for years now, without any impact on anything.
So what is going on?
-
- Posts: 331
- Joined: Monday 03 July 2017 19:58
- Target OS: NAS (Synology & others)
- Domoticz version:
- Contact:
Re: Python Plugin: Synology SNMP Monitor
Well, in my case i see nothing different than as before; if there is a fluctuation as you said, it might be because of the low polling frequency (I kept mine as 5 mins), and high number of requests. As this is pure SNMP requests, these NASes are designed to handle such request loads. Apart from this the only thing i can think of is that there might be a problem on pysnmp package, but as i see there are no complaints on the net regarding this. Is it possible that your Synology might be dealing with some other background processes? Maybe you can restart your Synology and check it with the plugin on and off for 30 mins.EddyG wrote: ↑Thursday 11 July 2019 16:39 Unfortunately the plugin has a huge impact on CPU usage % peeks of over 20%, with a normal of around 1-3%.
Also memory consumption is big, more then 20Mb extra.
Even the CPU temperature has a fluctuation of 5 degrees Celsius when the CPU usage peeks.
I have the same functions running in a bash script for years now, without any impact on anything.
So what is going on?
Also,the CPU and Mem usage calculations are as follows, to reflect the same calculation phase as Synology Resource Monitor:
CPU Usage = CPU User + CPU System
Memory Usage = (Total Mem Swap + Total Mem Real) - (memSwap + memCached+memFree)
I suspect most probably that your bash script might be reflecting only CPU System for CPU Usage and Total Mem-memFree for Memory Usage. You can check it by comparing your bash script results to Synology Resource Monitor Results for compliancy.
Re: Python Plugin: Synology SNMP Monitor
My bash script has the same values as my DS1517+, so that is working fine for years now.
When I enable the python plugin the problem starts.
The cpu load of the raspberry rises to more then 20% at an interval of 45 to 50 minutes.
NAS cpu load is normally between 0,5% and 2% with sometimes shortly up to max. 10%
This only occurs when I enable the plugin.
When I enable the python plugin the problem starts.
The cpu load of the raspberry rises to more then 20% at an interval of 45 to 50 minutes.
NAS cpu load is normally between 0,5% and 2% with sometimes shortly up to max. 10%
This only occurs when I enable the plugin.
-
- Posts: 331
- Joined: Monday 03 July 2017 19:58
- Target OS: NAS (Synology & others)
- Domoticz version:
- Contact:
Re: Python Plugin: Synology SNMP Monitor
Hi Eddy, for whatever reason, i mistook it as the CPU and Memory usage of the NAS itself... I checked mine, started using the plugin on Sunday,CPU and mem were all normal, and on Wednesday, Mem is normal but CPU usage boosted above 20% all the time. Now i restarted domoticz server and both CPU and mem returned to normal. I took it as a linux kernel upgrade or some process stuck unrelated to plugin or domoticz.
So in short, i do not face a problem on my side; there's nothing fancy about the plugin code itself, it could be related to your domoticz server version and also domoticz-plugin memory and cpu usage is beyond my abilities to comprehend or comment.
So in short, i do not face a problem on my side; there's nothing fancy about the plugin code itself, it could be related to your domoticz server version and also domoticz-plugin memory and cpu usage is beyond my abilities to comprehend or comment.
Re: Python Plugin: Synology SNMP Monitor
No problem, I won't investigate further because I have already for years a working bash script.
-
- Posts: 78
- Joined: Saturday 30 July 2016 10:14
- Target OS: Linux
- Domoticz version: 2020beta
- Location: Arnhem
- Contact:
Re: Python Plugin: Synology SNMP Monitor
@Eddy
Is it possible for you to share your bash script (+ installation instructions)
Wanna try your solution too.
Is it possible for you to share your bash script (+ installation instructions)
Wanna try your solution too.
-
- Posts: 331
- Joined: Monday 03 July 2017 19:58
- Target OS: NAS (Synology & others)
- Domoticz version:
- Contact:
Re: Python Plugin: Synology SNMP Monitor
v.1.0.2:
- Fixed 'non-hexadecimal number found' error
- Added 5th HDD Temp
- Fixed UPS 'OL CHRG' and 'OB DISCHRG' shown as 'Unknown' problem.
- Fixed 'non-hexadecimal number found' error
- Added 5th HDD Temp
- Fixed UPS 'OL CHRG' and 'OB DISCHRG' shown as 'Unknown' problem.
-
- Posts: 39
- Joined: Tuesday 11 July 2017 10:26
- Target OS: NAS (Synology & others)
- Domoticz version: 2020.2
- Location: Germany
- Contact:
Re: Python Plugin: Synology SNMP Monitor
Hi all,
does that solution also work (the same way), when Domoticz is running on Synology NAS?
Edit:
Meanwhile I tried to setup the script on Synology NAS since my DOMOTICZ is running on that system.
Unfortunately it seems not to work.
First I installed pysnmp on synology (that was not an easy task by the way)
root@DS918Plus:/volume1/@appstore/py3k/usr/local/lib/python3.5/site-packages# sudo /volume1/@appstore/py3k/usr/local/bin/pip3 install pysnmp
Collecting pysnmp
Using cached pysnmp-4.4.12-py2.py3-none-any.whl (296 kB)
Collecting pysmi
Using cached pysmi-0.3.4-py2.py3-none-any.whl (80 kB)
Collecting pycryptodomex
Downloading pycryptodomex-3.9.8-cp35-cp35m-manylinux1_x86_64.whl (13.7 MB)
|████████████████████████████████| 13.7 MB 6.2 MB/s
Collecting pyasn1>=0.2.3
Downloading pyasn1-0.4.8-py2.py3-none-any.whl (77 kB)
|████████████████████████████████| 77 kB 931 kB/s
Collecting ply
Using cached ply-3.11-py2.py3-none-any.whl (49 kB)
Installing collected packages: ply, pysmi, pycryptodomex, pyasn1, pysnmp
Successfully installed ply-3.11 pyasn1-0.4.8 pycryptodomex-3.9.8 pysmi-0.3.4 pysnmp-4.4.12
Afterwards I set up the scipt with modified configuration.
The hardware is not created (I even allowed new hardware before activating).
I cannot regognize the script to run, no log entries visible.
Happy for any tipps or adjustements.
Kind regards
does that solution also work (the same way), when Domoticz is running on Synology NAS?
Edit:
Meanwhile I tried to setup the script on Synology NAS since my DOMOTICZ is running on that system.
Unfortunately it seems not to work.
First I installed pysnmp on synology (that was not an easy task by the way)
root@DS918Plus:/volume1/@appstore/py3k/usr/local/lib/python3.5/site-packages# sudo /volume1/@appstore/py3k/usr/local/bin/pip3 install pysnmp
Collecting pysnmp
Using cached pysnmp-4.4.12-py2.py3-none-any.whl (296 kB)
Collecting pysmi
Using cached pysmi-0.3.4-py2.py3-none-any.whl (80 kB)
Collecting pycryptodomex
Downloading pycryptodomex-3.9.8-cp35-cp35m-manylinux1_x86_64.whl (13.7 MB)
|████████████████████████████████| 13.7 MB 6.2 MB/s
Collecting pyasn1>=0.2.3
Downloading pyasn1-0.4.8-py2.py3-none-any.whl (77 kB)
|████████████████████████████████| 77 kB 931 kB/s
Collecting ply
Using cached ply-3.11-py2.py3-none-any.whl (49 kB)
Installing collected packages: ply, pysmi, pycryptodomex, pyasn1, pysnmp
Successfully installed ply-3.11 pyasn1-0.4.8 pycryptodomex-3.9.8 pysmi-0.3.4 pysnmp-4.4.12
Afterwards I set up the scipt with modified configuration.
The hardware is not created (I even allowed new hardware before activating).
I cannot regognize the script to run, no log entries visible.
Happy for any tipps or adjustements.
Kind regards
Domoticz Beta | Aeon Labs Z-Wave USB Stick Gen5 | Cyrus SmartHome 4-in-1 Multisensor | Qubino ZMNHCD1 - Roller Shutter | NEO COOLCAM NAS-WR01ZE Power Plug | Fibaro FGRGB-101 | WEMOS D1 MINI (ESP8266) Sensors CO2/TEMP/BARO |
-
- Posts: 36
- Joined: Friday 10 April 2020 7:01
- Target OS: NAS (Synology & others)
- Domoticz version:
- Contact:
Re: Python Plugin: Synology SNMP Monitor
Hi,
nice plugin!
I just don't get the good values on my ds218 with DSM 6.2.3-25426 Update 3
i've tried different oid's but none of them are returning the harddisk space info.
anyone an idea?
This log is with oid 51
2021-02-19 12:38:38.242 (Monitor) NAS Status: Normal
2021-02-19 12:38:39.326 (Monitor) NAS Temperature: 40
2021-02-19 12:38:44.958 (Monitor) RAM Utilization: 7
2021-02-19 12:38:44.958 (Monitor - DS218 Mem) Updating device from 0:'8' to have values 0:'7'.
2021-02-19 12:38:44.967 (Monitor) Update 0:'7' (Monitor - DS218 Mem)
2021-02-19 12:38:47.434 (Monitor) CPU: 28
2021-02-19 12:38:47.434 (Monitor - DS218 CPU) Updating device from 0:'35' to have values 0:'28'.
2021-02-19 12:38:47.447 (Monitor) Update 0:'28' (Monitor - DS218 CPU)
2021-02-19 12:38:48.603 (Monitor) HDD Used: No Such Instance currently exists at this OID
2021-02-19 12:38:49.666 (Monitor) HDD Total: No Such Instance currently exists at this OID
2021-02-19 12:38:49.666 (Monitor) HDD %: Wrong DSM OID!
2021-02-19 12:38:50.988 (Monitor) HDD Temp 1: 23
2021-02-19 12:38:52.053 (Monitor) HDD Temp 2: 23
nice plugin!
I just don't get the good values on my ds218 with DSM 6.2.3-25426 Update 3
i've tried different oid's but none of them are returning the harddisk space info.
anyone an idea?
This log is with oid 51
2021-02-19 12:38:38.242 (Monitor) NAS Status: Normal
2021-02-19 12:38:39.326 (Monitor) NAS Temperature: 40
2021-02-19 12:38:44.958 (Monitor) RAM Utilization: 7
2021-02-19 12:38:44.958 (Monitor - DS218 Mem) Updating device from 0:'8' to have values 0:'7'.
2021-02-19 12:38:44.967 (Monitor) Update 0:'7' (Monitor - DS218 Mem)
2021-02-19 12:38:47.434 (Monitor) CPU: 28
2021-02-19 12:38:47.434 (Monitor - DS218 CPU) Updating device from 0:'35' to have values 0:'28'.
2021-02-19 12:38:47.447 (Monitor) Update 0:'28' (Monitor - DS218 CPU)
2021-02-19 12:38:48.603 (Monitor) HDD Used: No Such Instance currently exists at this OID
2021-02-19 12:38:49.666 (Monitor) HDD Total: No Such Instance currently exists at this OID
2021-02-19 12:38:49.666 (Monitor) HDD %: Wrong DSM OID!
2021-02-19 12:38:50.988 (Monitor) HDD Temp 1: 23
2021-02-19 12:38:52.053 (Monitor) HDD Temp 2: 23
Who is online
Users browsing this forum: No registered users and 1 guest