1

I have equipment that is non SNMP-enabled. I have the API to get its status and am implementing an SNMP agent for it. I did that with SNMP4j and can answer GET requests and send traps.

The problem I have is that there are several (2) such equipments to monitor with the same instance of my program. So far, I added a branch for each equipment in the MIB like 1.3.6.1.4.1.PEN.devices.1.xxx and 1.3.6.1.4.1.PEN.devices.2.xxx but 1-that's ugly and 2-I can't give a MIB usable for each equipment but a single MIB for the whole System with redundant information and that's also ugly ;)

I'm not sure if the MIB Table object is suitable for that, but it doesn't sound like the way to go (I have a fixed number of equipment). I also saw that RFC 3413 §3.5 describes SNMP proxy forwarder but I'm not sure it is what I need to implement (my equipments are not SNMP-enabled), and SNMP4j ProxyForwarder seems to map a MIB to another MIB.

With SNMP4j, I implemented the processPDU() method of the CommandResponder interface and I was hoping that, if the Supervision software is configured to use my program as a "proxy forwarder", there could be some information available in the CommandResponderEvent for me to send the correct response PDU (though I didn't find any such thing, I might have missed something).

I could start several instances of my agent (one per equipment) but I'd rather not for sparse ressources reasons. What would be the best way to tackle that problem? Table? Proxy? Other? Not possible?

EDIT:

I have found that some NNM add an extra Variable Binding in the GET request to indicate which equipment to address (SNMP-proxy-like), while some other map the equipment by changing the community in the GET. Are these viable options? Which one is the most common/acceptable?

Community
  • 1
  • 1
Matthieu
  • 2,736
  • 4
  • 57
  • 87
  • Can you elaborate on your concern about using a table with two rows? – k1eran Jan 12 '15 at 14:38
  • @k1eran none really, but I was a little reluctant on using tables as I'm rather new to SNMP and didn't get that part quite yet. I'm trying to read through the RFCs but there are many. Is it possible to keep the OID-tree in table elements? – Matthieu Jan 12 '15 at 15:10
  • 1
    http://tools.ietf.org/html/rfc4133 may be interesting; I would start there as it has a entPhysicalTable. Alternatively you can do a vendor specific one. http://www.opennms.org/wiki/Hardware_Inventory_Entity_MIB shows how one particular NMS integrates with both approaches. I don't really understand your comment re. 'OID-tree in table elements' since they are inextricably linked I believe. – k1eran Jan 12 '15 at 16:17
  • @k1eran thanks, I'll read through that. What I meant is that each row would represent one equipment but there is a whole tree of scalars under each. If the table OID is `toid` and `toid.2` is the 2nd equipment, can I query `toid.2.1.0` (column 1) and `toid.2.3.8.0` (column 3, node 8) or am I limited to only `toid.2..0` (column cannot have sub-elements)? – Matthieu Jan 12 '15 at 17:07
  • Too long for comment so added an 'answer' showing accessing various ways. – k1eran Jan 12 '15 at 17:32
  • @k1eran as you seem to know your way through MIB, could I ask for your help on [that one](http://stackoverflow.com/q/28815383/1098603)? Thanks! – Matthieu Mar 05 '15 at 14:10

1 Answers1

1

Using a simple table here to show general concepts of tables and rows ...

This is how to retrieve a example table (with an index and 2 more columns). Perhaps each of your equipments would be a row in your own table (with a bunch of data in your own columns)

snmptable  -M +.  -m +ALL -v 2c -c public  -Ci  myhost   SNMPv2-MIB::sysORTable
SNMP table: SNMPv2-MIB::sysORTable

 index                                        sysORID                                              sysORDescr  sysORUpTime
     1          SNMP-MPD-MIB::snmpMPDMIBObjects.3.1.1         The MIB for Message Processing and Dispatching. 0:0:00:00.33
     2       SNMP-USER-BASED-SM-MIB::usmMIBCompliance         The MIB for Message Processing and Dispatching. 0:0:00:00.33

Walk that table :

snmpwalk   -M +.  -m +ALL -v 2c -c public  myhost  SNMPv2-MIB::sysORTable
SNMPv2-MIB::sysORID.1 = OID: SNMP-MPD-MIB::snmpMPDMIBObjects.3.1.1
SNMPv2-MIB::sysORID.2 = OID: SNMP-USER-BASED-SM-MIB::usmMIBCompliance
SNMPv2-MIB::sysORDescr.1 = STRING: The MIB for Message Processing and Dispatching.
SNMPv2-MIB::sysORDescr.2 = STRING: The MIB for Message Processing and Dispatching.
SNMPv2-MIB::sysORUpTime.1 = Timeticks: (33) 0:00:00.33
SNMPv2-MIB::sysORUpTime.2 = Timeticks: (33) 0:00:00.33 

Access one part of above by walk :

snmpwalk   -M +.  -m +ALL -v 2c -c public  myhost  SNMPv2-MIB::sysORDescr.2
SNMPv2-MIB::sysORDescr.2 = STRING: The MIB module for SNMPv2 entities

Access one part of above by GET :

snmpget   -M +.  -m +ALL -v 2c -c public  myhost  SNMPv2-MIB::sysORDescr.2
SNMPv2-MIB::sysORDescr.2 = STRING: The MIB module for SNMPv2 entities

EDIT: To see how this OID fits into the tree look at ...

snmptranslate -M+. -m +ALL    1.3.6.1.2.1.1
SNMPv2-MIB::system
snmptranslate -M+. -m +ALL    1.3.6.1.2.1.1.9
SNMPv2-MIB::sysORTable
snmptranslate -M+. -m +ALL    1.3.6.1.2.1.1.9.1
SNMPv2-MIB::sysOREntry
snmptranslate -M+. -m +ALL    1.3.6.1.2.1.1.9.1.3
SNMPv2-MIB::sysORDescr
snmptranslate -M+. -m +ALL    1.3.6.1.2.1.1.9.1.3.2
SNMPv2-MIB::sysORDescr.2
k1eran
  • 4,492
  • 8
  • 50
  • 73
  • Thank you, it feels a little bit clearer. Now I just need to know if it is legal to GET something like `snmpget ... myhost SNMPv2-MIB::sysORDescr.2.1`? In other words, can `SNMPv2-MIB::sysORDescr` currently defined as an `Octet String` be defined as an `OBJECT IDENTIFIER`? – Matthieu Jan 12 '15 at 17:45
  • 1
    An OID is just a id for a particular part of the tree, more analogous to a C++ pointer than a C++ object. SNMPv2-MIB::sysORDescr.2 is more like a 'primitive type'. I updated answer with more info on what SNMPv2-MIB::sysORDescr.2 is. – k1eran Jan 13 '15 at 09:37
  • OK, I'm getting there :) So I understand that the `sysORDescr.2` is a primitive type (scalar) and therefore cannot be a part of the tree. I would have liked to include a full MIB under it (i.e. `sysOrDescr.2.4.12.3`) but I guess it's not possible, so Tables are not what I'm looking for. Thank you for bearing with me! :) – Matthieu Jan 13 '15 at 17:36