SNMP disk information from Synology NAS

Has someone tried to get disk information like status, size etc for a Synology NAS with SEVERAL disks?
I have found the MIB with OIDs but I can´t figure out how to somehow parse information from each drive

See this https://global.download.synology.com/download/Document/Software/DeveloperGuide/Firmware/DSM/All/enu/Synology_DiskStation_MIB_Guide.pdf
Page 7

Is there any reason not to use the Synology integration? I can see individual status of the 3 disks in mine.

Actually I am testing SNMP in general and using my NAS for it. Beacuse I use HA normally I wanted to try it out here.
I guess the integration also uses SNMP but wanted to try the “hard” way :slight_smile:

I also don´t think this integration is available in my version of HA. I am on 0.103.6.

No issue with doing it to learn more about it, just didn’t want you to struggle if you were’t aware of an easier route :grinning: You’re right that the integration only came in recently, so wouldn’t help you anyway. Sorry I don’t know enough about SNMP to help you with the problem.

I use the integration for my disk info. But I wanted some more sensors, so I’ve added these:

 - platform: snmp
    host: !secret ip_nas
    community: public
    name: Synology Uptime
    baseoid: 1.3.6.1.2.1.25.1.1.0
    value_template: >
      {%- set time = value | int // 100 %}
      {%- set minutes = ((time % 3600) // 60) %}
      {%- set minutes = '{}min'.format(minutes) if minutes > 0 else '' %}
      {%- set hours = ((time % 86400) // 3600) %}
      {%- set hours = '{}hr '.format(hours) if hours > 0 else '' %}
      {%- set days = (time // 86400) %}
      {%- set days = '{}d '.format(days) if days > 0 else '' %}
      {{ 'Less than 1 min' if time < 60 else days + hours + minutes }}
      
    # https://global.download.synology.com/download/Document/Software/DeveloperGuide/Firmware/DSM/All/enu/Synology_DiskStation_MIB_Guide.pdf

  - platform: snmp
    host: !secret ip_nas
    community: public
    name: Synology DSM Version
    baseoid: 1.3.6.1.4.1.6574.1.5.3.0

  - platform: snmp
    host: !secret ip_nas
    community: public
    name: Synology Update
    baseoid: 1.3.6.1.4.1.6574.1.5.4.0
    value_template: >
      {% set update = value | int %}
      {% if update == 1 %}
      Update is available
      {% elif update == 2 %}
      Latest version is installed
      {% elif update == 3 %}
      Connecting
      {% elif update == 4 %}
      Disconnected       
      {% elif update == 5 %}
      Others
      {% else %}
      --- 
      {% endif %}

  - platform: snmp
    host: !secret ip_nas
    community: public
    name: Synology Temperature
    baseoid: 1.3.6.1.4.1.6574.1.2.0
    unit_of_measurement: °C

Hopefully these can help you?

Use a value template to recalculate the readings to whatever format you want (Mb, Gb, Tb etc…) and add that the unit of measurements.
Then it should show up nicely in Lovelace.

thanks anyway :slight_smile:

I also have some OIDs as sensors and it works great. But every night when my Synology shuts down it returns a new error in the logs every 10 seconds :-/

However I want to get disk info through SNMP but can´t figure out how to parse the information from the disk OID.

What do you mean with “parse the information”?
When you set up the sensor, you have the information there.

But:

Table 23. Disk-Related OID
OID - Name - Explanation 
.1.3.6.1.2.1.25.2.3.1.3 - hrStorageDescrA - description of the type and instance of the storage described by this entry
.1.3.6.1.2.1.25.2.3.1.4 - hrStorageAllocationUnits - The size, in bytes, of the data objects allocated from this pool
.1.3.6.1.2.1.25.2.3.1.5 - hrStorageSize - The size of the storage represented by this entry, in units of hrStorageAllocationUnits
.1.3.6.1.2.1.25.2.3.1.6 - hrStorageUsed - The amount of the storage represented by this entry

You probably need to multiply "hrStorageAllocationUnits " with “hrStorageUsed” to get a familiar value i bytes.
If you want something in %, you can divide “hrStorageUsed” with “hrStorageSize” (and * 100) etc…

I thought table 4 was to be used for disk info.
I now tried this:

  - platform: "snmp"
    host: 192.168.1.110
    baseoid: 1.3.6.1.2.1.25.2.3.1.3.0
    name: NAS disk descr

but it just returns an error in the log
[homeassistant.components.snmp.sensor] SNMP error: noSuchName at 1.3.6.1.2.1.25.2.3.1.3.0

Then I would guess that your OID is wrong!

The information from the pdf is not enough to get the right OID. It only shows you the “system order” they uses.

Example:

.1.3.6.1.2.1.25.2.3.1.3 - hrStorageDescrA - description of the type and instance of the storage described by this entry

If you have two disk on your system, they might show up like this:
1.3.6.1.2.1.25.2.3.1.3.11 - “Disk 1” (here you only find the name of the disk/volume)
1.3.6.1.2.1.25.2.3.1.3.12 - “Disk 2” (here you only find the name of the disk/volume)

Then you have the last digits linked to the name of the disk/volume. These you have to add to the rest of the OID’s.

Then you find the next info:

.1.3.6.1.2.1.25.2.3.1.4 - hrStorageAllocationUnits - The size, in bytes, of the data objects allocated from this pool

1.3.6.1.2.1.25.2.3.1.4.11 = “4096” (readings for disk 1)
1.3.6.1.2.1.25.2.3.1.4.12 = “4096” (readings for disk 2)

And last:

1.3.6.1.2.1.25.2.3.1.5 - hrStorageSize - The size of the storage represented by this entry, in units of hrStorageAllocationUnits

1.3.6.1.2.1.25.2.3.1.5.11 = “960237388” (readings for disk 1)
1.3.6.1.2.1.25.2.3.1.5.12 = “960237388” (readings for disk 2)

Try using a program like SNMP Tester to find your correct OID

I just found these OIDs for Disk info on a website and they work and shows information for my drive 2.
How to get the info for the other drives is now the question.
I can find the OID for disk info i table 2 row 2 and table 4 but how to find out what to use after 6574.2.??? is not clear. The second last number seems to be from table 4.

1.3.6.1.4.1.6574.2.1.1.2.1 = STRING: “Disk 2”
.1.3.6.1.4.1.6574.2.1.1.3.1 = STRING: "ST3000DM001-1CH166 "
.1.3.6.1.4.1.6574.2.1.1.5.1 = INTEGER: 1

I just tried to replace the final .1 with 0, 2 and 3. It actually then shows Disk 1, 3 and 4 in HA.

I now also tried:
1.3.6.1.2.1.25.2.3.1.5.1 = 7989844
1.3.6.1.2.1.25.2.3.1.6.1 = 2066752
This should then become 2066752 / 7989844 = 26%
But when I look in DSM storage manager for any of my drives none of shows a usage of anything near 26%

Then put in 1 after this.

1.3.6.1.2.1.25.2.3.1.3.1 - > and you’ll get the name of the volume you are looking at.

Probably you’re looking at some system volumes that you don’t see as a regular user.

It shows “physical memory” then. That explains the strange numbers I guess (8Gb memory)
I replaced the final 1 with 2 to (hopefully) get information for Disk 1 but unfortuneateley it returns an error in the log instead.

I linked in the tool you could use to find the correct address. If you rather want to randomly try different numbers, good luck. It could be between 0 and 100 ?
You can’t find the “correct number” looking on the web. This depends on how many disks you have installed, how many volumes you have configured etc…

But if you have 4 disks and 4 volumes, you could try 41, 42, 43 and 44!

I guess I then rater use the tool :smiley:
I will try it out tomorrow and return here.
Thanks so far :slight_smile:
By the way. What happens if your Synology is shut down? Does it return errors in the log every 10 seconds until it is powered on again?

bringing this thread back to life - I’ve used the Version OID, and it doesn’t return the full version …

My DS-918+ is on DSM 6.2.4-25556, yet the OID returns DSM 6.2-25556 … haven’t been able to do a walk to find out what it should be either…

The reason is some sensor are not well retrieved with the integration.
For example all my temperature for my DS918+ are not retrieved (influxdb explore = no data) as my DX917 extension for 5 disks all temperatures are well retrieved.

Some other example : the volume space usage is some time retrieved but if i restart HA it doesn’t work, i need to restart HA to get it work back.