SNMP Advice / Guidance

Hello,

I’ve read the SNMP - Home Assistant page a number of times, but I remain a little unsure on how to integrate my Dlink network switch. I have several Dlink DGS-1510-28 switches and I would like to poll them using SNMP.

Only issue… I have read that I need to supply the OID or baseoid which I believe is the key to identifying the parameter I am wanting to retrieve from the switch.

I have no idea where to obtain the OID, and had hoped someone might be able to point me in the right direction. The SNMP config in HA appears to be straight forward, and I figure once I have the OID it should be straight forward from there?

Would appreciate anyone that has implemented SNMP on a network switch giving me their thoughts please.

Thanks, Mark

The OID should be in one of the MIB files on this page:

http://support.dlink.com.au/Download/download.aspx?product=DGS-1510-28

The MIB to use depends on the FW version of your switch.

And looking at the spreadsheets without delving into the MIB, the D-Link specific OIDs start at 1.3.6.1.4.1.171.14

Hi Daryl,

Thanks for the reply. I previously downloaded DGS-1510 Series FW v1.70.012 MIB.zip because my switches are running the v1.70 firmware. Having looked at the file I could make head nor tail of the data.

I am seeking to start with something easy to poll via SNMP, but honestly didn’t know where to start. Based on reading the configuration documentation (DGS-1510 Series Web UI Reference Guide v1.70.pdf) it appears I am supposed to turn on SNMP and then enable ‘public’ access to allow stations to retrieve MIB objects. I also assume I am using SNMPv1 as I dont need logins etc.

That’s kind of where I go stuck. So if I understand the situation… I obtain the OID of the data I want to retrieve, enter that into HA SNMP and then HA retrieves the data from the switch via SNMP? Or am I missing something?

I attempted to find the OID in the file DGS1510_R1.70_MIB_List.xls but couldn’t find anything. I hate to ask, but could you perhaps let me know which file you found the 1.3.6.1.4.1.171.14 OID?

Have a look at the spreadsheets included in the zip file - the OIDs are in DGS1510_MIB_Dependency.xlsx. ooops they are in the first column of the spreadsheet you looked at - DGS1510_R1.70_MIB_List.xls on the Overview tab.

I would then download and install a MIB browser (there are plenty that are either free or have trial periods - try OIDview). Compile the MIBs, add your device and you will be able to browse through all the values and parameters reported by your switch.

Looking at the SNMP integration - it gives an example you can test with. Use the uptime example but substitute your switch details instead:

sensor:
  - platform: snmp
    name: "Switch uptime"
    host: 192.168.2.21 # put in the management address for your switch
    baseoid: 1.3.6.1.2.1.1.3.0
    accept_errors: true
    unit_of_measurement: "minutes"
    value_template: "{{((value | int) / 6000) | int}}"

If you look at the tab RFC1213-MIB you can see other examples you can try.

But get yourself a browsing tool - you will understand it a lot better once you start exploring all the items in the various MIBs your switch supports.

Hi Daryl,

Thanks for the info. So I am understanding, here’s what I am seeing in the spreadsheet DGS1510_R1.70_MIB_List.xls.

I can see the 1.3.6.1.2 but am at a loss to find 1.3.6.1.2.1.1.3.0 or the examples to which you reference.

I will try the example you provided and see what happens. Apology for the stupid questions.

Thanks, Mark

Yeah when you first start playing with SNMP it’s not exactly intuitive - then suddenly you go: aha! and it all comes together.

That’s why you need to get a MIB browser and have a play - then you will see how the structure hangs together.

OIDs in SNMP are an upside down tree structure. so 1.3.6.1.2.1 is a branch of 1.3.6.1.2, and is documented in the RFC1213-MIB tab on that spreadsheet:

RFC1213-MIB
Under iso(1).org(3).dod(6).internet(1).mgmt(2).mib2(1)

If you look in there you will find a branch called system(1), the full OID for that is 1.3.6.1.2.1.1

Under system are 4 variables - one of which is sysUpTime(3) - the OID for that branch is 1.3.6.1.2.1.1.3

Lastly all MIB variables are in arrays - so to reference a single element variable it is array element 0 (zero)

Which gives us the OID 1.3.6.1.2.1.1.3.0

Truly you need to get familiar with a MIB browser of some kind - they let you navigate the MIB tree graphically and once you find the thing you want to monitor normally will show you the numeric OID as well.

The example sensor I gave you is modified from the one in the SNMP integration page:

Scroll down to the example for printer uptime - that will work on your switch as well.