Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8679571
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T21:00:20+00:00 2026-06-12T21:00:20+00:00

I am trying to implement an SNMP Agent in Java. I use snmp4j library

  • 0

I am trying to implement an SNMP Agent in Java.
I use snmp4j library (http://www.snmp4j.org/).
Currently, my agent works on localhost/4700.
I tried to send snmpget request thanks to the following request:

snmpget -v2c -c public localhost:4700 1.3.6.1.4.1.1.99.5.4.1.3.1.1

but I only get something like “No such instance currently exists at this OID”
Here is my problem: I don’t know how to create one. I tried to add rows to my MOTable, but it doesn’t seem to work.

Here is a summary of my class implementing MOGRoup

public class MyMIB 
//--AgentGen BEGIN=_EXTENDS
//--AgentGen END
implements MOGroup 
//--AgentGen BEGIN=_IMPLEMENTS
//--AgentGen END
{
    .
    .
    .

public static final OID oidTableEntry = 
    new OID(new int[] { 1,3,6,1,4,1,1,99,5,4,1,3,1 });
    .
    .
    .

private void createTableEntry(MOFactory moFactory) {
// Index definition
    .
    .
    .

// Table model
tableEntryModel = 
  moFactory.createTableModel(oidTableEntry,
                         tableEntryIndex,
                         tableEntryColumns);
((MOMutableTableModel)tableEntryModel).setRowFactory(
  new TableEntryRowFactory());
tableEntry = 
  moFactory.createTable(oidTableEntry,
                    tableEntryIndex,
                    tableEntryColumns,
                    tableEntryModel);

//Adding rows
ArrayList<Integer> oidMon1List= new ArrayList<Integer>();
oidRow1List = this.getListFromArray(oidTableEntry.getValue());
oidRow1List.add(1);

ArrayList<Integer> oidMon2List= new ArrayList<Integer>();
oidRow2List = this.getListFromArray(oidTableEntry.getValue());
oidRow2List.add(2);

DefaultMOMutableTableModel model =
               (DefaultMOMutableTableModel)tableEntry.getModel();

synchronized(model){
model.addRow(
        model.createRow(
                new OID(getArrayFromList(oidRow1List)), 
                new Variable[]{
                    new Integer32(123)
                    }));

model.addRow(
        model.createRow(
                new OID(getArrayFromList(oidRow2List)), 
                new Variable[]{
                    new Integer32(456)
                    }));   
    }
}

But the requests bellow still don’t work.

snmpget -v2c -c public localhost:4700 1.3.6.1.4.1.1.99.5.4.1.3.1.1

snmpget -v2c -c public localhost:4700 1.3.6.1.4.1.1.99.5.4.1.3.1.1.0

snmpget -v2c -c public localhost:4700 1.3.6.1.4.1.1.99.5.4.1.3.1.1.1

I must did not understand how correctly create rows. Could you explain me how I should do ?

Thank you very much !

Just a little precision: I added those lines to my program:

System.out.println("Get row count: " +tableEntryModel.getRowCount());

//first row
System.out.println("TEST1: " +model.getRow(new OID(new int[] {1,3,6,1,4,1,1,99,5,4,1,3,1,1})).getValue(0));
System.out.println("TEST2: " +tableEntry.getValue(new OID(new int[] {1,3,6,1,4,1,1,99,5,4,1,3,1,1,0})));

The first returns: 2 (as expected)

The second returns: 123 (as expected)

The third returns: null… here, I don’t understand why !

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T21:00:22+00:00Added an answer on June 12, 2026 at 9:00 pm

    I would say, the code and the request did not match. I guess that the code is the problem,
    because in SNMP4J-Agent the instance OID of a table’s cell is built by

    <tableEntryOID>.<columnSubID>.<rowIndexOID>
    

    Thus, if your table object has the OID 1.3.6.1.4.1.1.99.5.4.1.3.1 and you want the first instance in the first column to have the ID 1 then you have to create/add the row with:

    model.addRow(       
        model.createRow(       
                new OID(1), new Variable[]{ new Integer32(123) })); 
    

    This cell can then be retrieved with

    snmpget -v2c -c public localhost:4700 1.3.6.1.4.1.1.99.5.4.1.3.1.1.1
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to implement the excellent jQuery bidirectional infite scroll as explained here: http://www.bennadel.com/blog/1803-Creating-A-Bidirectional-Infinite-Scroll-Page-With-jQuery-And-ColdFusion.htm For
Trying to implement search with Sunspot Gem wich is using Solr.Fulltext search works fine
I've implemented an SNMP agent using SNMP4J. I've read in various places (including in
SetFocus I'm trying implement the above Se Focus code in a Class Library that
Trying to implement this gallery on my website. http://coffeescripter.com/code/ad-gallery/ It is noted in the
Trying to implement the following structure from c to use NSArray in objective-c: In
Im trying to implement this code: http://wcf.codeplex.com/wikipage?title=Getting%20started:%20Building%20a%20simple%20web%20api and want to add it to my
I am currently trying implement a QThread that contains a socket connection. The socket
Trying to implement Ryan's JS implementation of the facebook login, via his Railscast: http://railscasts.com/episodes/360-facebook-authentication
Trying to implement Piwik using REST API over http but need a little help.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.