简体   繁体   中英

Set SNMP value for custom OID

We have applied for a Private Enterprise Number to "reserve" a space in the SNMP MIB "tree" to store some monitoring values. We will, eventually, be assigned a number like:

iso.org.dod.internet.private.enterprise.XXX (1.3.6.1.4.1.XXX)

We haven't received our allotted PEN yet, but I was hoping to get my project started by simply taking a (temporary, only on my workstation) OID and writing a value to it using SNMP#Net . I have followed the set example which works fine (the sysLocation , OID 1.3.6.1.2.1.1.6.0 , is set fine).

So, next I tried setting a "faked" OID ( 1.3.6.1.4.1.99999.1.0 , where 99999 would, eventually, become our allotted PEN). This, however, fails with ErrorStatus 17 , which, according to this source , should be "The variable cannot be written or created."

I have checked my SNMP Agent service and the private community which I'm using is set to READ/CREATE . I am using C# on Windows 7.

Is there something I need to do before I can set my desired value? Do I need to import some kind of "MIB definition" before windows allows me to set a value? What would I need to do in order to (for now test) set values? Maybe I need to "declare" or "register" my desired OID first with the SNMP agent?

You need to register the variable in the SNMP Agent provider service as part of a binding list, using the WinSNMP API .

Essentially you use SnmpCreateVbl to bind an OID to a variable.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM