I want to create my own MIB. I'm struggling on this from couple of weeks. I followed this tutorial and using net-snmp 5.7.3. What I'm doing is:

My setup: I have two VM's, both Ubuntu 16, one is snmp-server with IP: and the other snmp-agent with IP: I wrote a MIB, which compiles good without any error (This compilation is done only on the agent system, not on the server). I have already done this:

root@snmp-agent:# MIBS=+MAJOR-MIB    
root@snmp-agent:# MIBS=+DEPENDENT-MIB    
root@snmp-agent:# export MIBS    
root@snmp-agent:# MIBS=ALL

My MIB files are in this path: /usr/share/snmp/mibs which is the default search path. I've already compiled it and generated .c and .h files successfully with the command: mib2c -c mib2c.int_watch.conf objectName. And than configured the snmp like this:

root@snmp-agent:# ./configure --with-mib-modules="objectName"
root@snmp-agent:# make
root@snmp-agent:# make install    

Everything worked fine. After this when I do (on the agent) snmptranslate I get the output as:

root@snmp-agent:snmptranslate -IR objectName.0

And with the command snmptranslate -On objectName.0 I get output as:

root@snmp-agent:# snmptranslate -On MAJOR-MIB::objectName.0

So, I'm getting the expected outputs on the agent system. Now my problem is I don't know how to get the same values from my server!

When I run snmpget, from the server, I get this error:

root@snmp-server:# snmpget -v2c -c public MAJOR-MIB::objectName.0
MAJOR-MIB::objectName.0 = No Such Instance currently exists at this OID

Output when specified the OID:

root@snmp-server:# snmpget -v2c -c public .
SNMPv2-SMI::enterprises.4331.2.1 = No Such Instance currently exists at this OID

Output when I do these:

root@snmp-server:# snmpget -v2c -c public sysDescr.0
SNMPv2-MIB::sysDescr.0 = STRING: Linux snmp-agent 4.10.0-33-generic #37~16.04.1-Ubuntu SMP Fri Aug 11 14:07:24 UTC 2017 x86_64

root@snmp-server:# snmpwalk -v2c -c public .
SNMPv2-SMI::enterprises.4331.2.1 = No more variables left in this MIB View (It is past the end of the MIB tree)

I have searched it and still searching but no luck. What should I do? How should I use snmpget from my server on my own MIBs? I mean something like I do with sysDescr.0 from my server.

I want to do this: snmpget myObjectName.0 and get the values.

EDIT: I have already seen these answers, but doesn't works. snmp extend not working and snmp no such object...


When I do snmpwalk on server:

snmp-server:# snmpwalk -v 2c -c ncs -m DISMAN-PING-MIB .
DISMAN-PING-MIB::pingObjects.0 = INTEGER: 1
DISMAN-PING-MIB::pingFullCompliance. = STRING: "/bin/echo"
DISMAN-PING-MIB::pingMinimumCompliance. = ""
DISMAN-PING-MIB::pingCompliances. = ""
DISMAN-PING-MIB::pingCompliances. = INTEGER: 5
DISMAN-PING-MIB::pingCompliances. = INTEGER: 1
DISMAN-PING-MIB::pingCompliances. = INTEGER: 1
DISMAN-PING-MIB::pingCompliances. = INTEGER: 4
DISMAN-PING-MIB::pingCompliances. = INTEGER: 1
DISMAN-PING-MIB::pingIcmpEcho. = ""
DISMAN-PING-MIB::pingIcmpEcho. = ""

When I do snmpget with pingFullCompliance.

root@snmp-server:# snmpget DISMAN-PING-MIB::pingFullCompliance.
DISMAN-PING-MIB::pingFullCompliance. = Wrong Type (should be INTEGER): STRING: "/bin/echo"

So where am I going wrong? And what is pingFullCompliance. ? Why such a long OID?

Where am I going wrong? Can anyone point me in the right direction? Any suggestions are greatly appreciated.


I had the exact same issue, It didn't work with 5.6.2.

How I solved it:

I've upgraded to 5.7.3 , then it started working. you need to take care for the following:

  1. configure the package (on build) to support agentx) with --with-mib-modules=agentx this is my configure:

      ./configure --prefix=/usr --build=i386-linux --host=arm-linux --target=arm-linux --with-ar=arm-arago-linux-gnueabi-ar --with-cc=arm-arago-linux-gnueabi-gcc --with-ld=arm-arago-linux-gnueabi-ld --with-cflags="-O3 -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp" --with-endianness=big --with-ldflags=-Bstatic --enable-mini-agent --with-mib-modules="mibII ip-mib if-mib tcp-mib udp-mib ucd_snmp target agent_mibs notification-log-mib snmpv3mibs notification agentx" --without-openssl --without-perl-modules --disable-embedded-perl --disable-shared --with-default-snmp-version="2" --with-sys-contact="root" --with-sys-location="unknown" --with-logfile="/var/log/snmpd.log" --with-persistent-directory="/var/net-snmp" --disable-manuals
  2. add agentx to snmpd.conf This is my snmpd.config

    master  agentx
    rocommunity public rwcommunity private
    com2sec readonly  default         public 
    com2sec readwrite default     private
  3. started snmpd with debug, to give more details:

    snmpd -f -Lo: -Dagentx
  4. Then start the agentx application

The following tutorial also helped:


| improve this answer | |

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.