3

I've registered my own oid with IANA. For this post we'll call it 99999.

so in my snmpd.conf file (Ubuntu 14)

I added the following line

extend .1.3.6.1.4.1.99999.1 test /bin/echo hello

When I get a snmpget with the oid .1.3.6.1.4.1.99999.1, expecting a reply of hello I got not found.

So decided to do a snmpwalk from .1.3.6.1.4.1.99999 and I got the following

.1.3.6.1.4.1.99999.1.1.0  =  1
.1.3.6.1.4.1.99999.1.2.1.2.4.116.101.115.116   =  /bin/echo
.1.3.6.1.4.1.99999.1.2.1.3.4.116.101.115.116   =  hello
.1.3.6.1.4.1.99999.1.2.1.4.4.116.101.115.116   =  hello
.1.3.6.1.4.1.99999.1.2.1.5.4.116.101.115.116   =  5
.1.3.6.1.4.1.99999.1.2.1.6.4.116.101.115.116   =  1
.1.3.6.1.4.1.99999.1.2.1.7.4.116.101.115.116   =  1
.1.3.6.1.4.1.99999.1.2.1.20.4.116.101.115.116  =  4
.1.3.6.1.4.1.99999.1.2.1.21.4.116.101.115.116  =  1
.1.3.6.1.4.1.99999.1.3.1.1.4.116.101.115.116   =  hello
.1.3.6.1.4.1.99999.1.3.1.2.4.116.101.115.116   =  hello
.1.3.6.1.4.1.99999.1.3.1.3.4.116.101.115.116   =  1
.1.3.6.1.4.1.99999.1.3.1.4.4.116.101.115.116   =  0
.1.3.6.1.4.1.99999.1.4.1.2.4.116.101.115.116   =  hello

Ok that's not what I was expecting. On my old Ubuntu 8 server I would get a reply from oid .1.3.6.1.4.1.99999.1 as hello

So the question is what's the stuff after my oid? (.2.1.2.4.116.101.115.116, etc)

I assume there is some sort of meaning/logic to the numbers after "my" oid.

which is the correct oid to use in a snmpget to get the "hello" back

Any pointers would be useful.

Many thanks in advance.

* Added comments after my original post *

Ok, I've worked out some of the numbers added to my oid.

Looking at the oid .1.3.6.1.4.1.99999.1.2.1.2.4.116.101.115.116

The last section is ascii 116.101.115.116 equals "test"

so what's the stuff in the middle

2.1.2.4
2.1.3.4
2.1.4.4
2.1.5.4
and so on...

I'm still confused as to why this is all added to my OID in the first place.

On my old Ubuntu 8 SNMP I could simple do a snmpget on the oid number (.1.3.6.1.4.1.99999.1) I had test in the snmpd.conf exec line and get the result 'hello' back

With all these added numbers to the old how do I know what oid I need to go a snmpget on?

Likewise how on earth would you create a meaning full MIB file to match it all?

ARGH!!! SNMP Overload....

Help!!!

1

This may be an old question, but the documentation out there isn't very forthcoming as to why SNMP is acting like it is, and I've been struggling with this mess for a while, so here goes.

The extend stanza creates a new MIB structure at the OID you specify, and appends a number of values from NET-SNMP-EXTEND-MIB, then appends more values depending on the name specified in the extend directive.

In your example, the base OID is .1.3.6.1.4.1.99999.1. SNMPd duplicates the MIB structure from NET-SNMP-EXTEND-MIB and appends it to this OID. I've replicated the basic MIB tree below, the full MIB can be found at http://net-snmp.sourceforge.net/docs/mibs/NET-SNMP-EXTEND-MIB.txt

.1: nsExtendNumEntries
.2: nsExtendConfigTable
  .1: nsExtendConfigEntry
    .1: nsExtendToken
    .2: nsExtendCommand
    .3: nsExtendArgs
    .4: nsExtendInput
    .5: nsExtendCacheTime
    .6: nsExtendExecType
    .7: nsExtendRunType
    .20: nsExtendStorage
    .21: nsExtendStatus
.3: nsExtendOutput1Table
  .1: nsExtendOutput1Entry
    .1: nsExtendOutput1Line
    .2: nsExtendOutputFull
    .3: nsExtendOutNumLines
    .4: nsExtendResult
.4: nsExtendOutput2Table
  .1: nsExtendOutput2Entry
    .2: nsExtendOutput2Entry 

The character length of the name is appended, then the name is converted to ASCII and appended as decimal values.

So the breakdown of the OID response .1.3.6.1.4.1.99999.1.3.1.1.4.116.101.115.116 = hello is as follows:

.1.3.6.1.4.1.99999.1 : base OID

  .3                 : nsExtendOutput1Table
    .1               : nsExtendOutput1Entry
      .1             : nsExtendOutput1Line
        .4           : Length of name ("test" in this case)
          .116       : ASCII t
            .101     : ASCII e
              .115   : ASCII s
                .116 : ASCII t

And since this OID is the nsExtendOutput1Line value, which returns the first line of the command output, the value is "hello".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.