hello:
         I have install net-snmp agent 4.1.x, and i added a new MIB module.
 Add the C code into it.it can start , the  init routine can run.
 
         Then when i asked for a snmptranslate command,it gave me the right
 result: 
 [EMAIL PROTECTED]:~/Desktop$ snmptranslate -IR -On  MachType
 .1.3.6.1.4.1.29881.3.1.1
 
 but when i asked for a snmpget command,it gave me the result:
 [EMAIL PROTECTED]:~/Desktop$ snmpget  -v 2c -c public 192.168.4.12 
.1.3.6.1.4.1.29881.3.1.1.0
 SNMPv2-SMI::enterprises.29881.3.1.1.0 = No Such Object available on this
 agent at this OID
 
 hy?Why it didn't return the correct value to me?Is there anything
 important I ignored?
 
 But when i entered the command as follows,it gave me the correct value: 
 
 [EMAIL PROTECTED]:~/Desktop$ snmpgetnext  -v 2c -c public 192.168.4.12 .1
 SNMPv2-MIB::sysDescr.0 = STRING: Linux sarge 2.6.22.8 #54 Wed Apr 16
 10:14:16 CST 2008 mips

through my debug i find the object handler routine is not run when i run 
"snmpget  -v 2c -c public 192.168.4.12 .1.3.6.1.4.1.29881.3.1.1.0" this command!
 
 Why? 

Isn't i can't regster the object MIB tree?

help me!





Oh,i'm sorry , i spellworry, i install the 5.1.4 release.

>How did you add the C code to the agent?
i see the /agent/example/example.c and example.h  file.
 So i followed the tutorial .

the code is 

struct variable1    loogson_variables[] = {
    {MACHTYPEGET, ASN_OCTET_STR, RONLY, var_loogson, 1, {1}},
};

oid  loogson_variables_oid[] = { 1, 3, 6, 1, 4, 1, 29881, 3, 1 };

void init_loogson(void)
{
printf("in init_loogson\n");
    REGISTER_MIB("loogson", loogson_variables, variable1, 
loogson_variables_oid);
}

u_char *
var_loogson(struct variable *vp,
            oid * name,
            size_t * length,
            int exact, size_t * var_len, WriteMethod ** write_method)
{
printf("in var_loogson\n");

        ........
        ......
}

Then i compile the net-snmp.
Start it with the command "snmpd -f -Le -Dread_config"
the string "in init_loogson" can show in the console.

when i ask for a snmpget command, the string "in var_loogson" is not show! why ?

I follow the FAQ text file in the release package ,

"I've added my code to this template and it still doesn't work.  Why not?"
        - Is the new module being compiled?
           Yes, it can be compiled.
        - Is it being included in the agent library?
             i run  the command    "nm libnetsnmpmibs.so.8"
                    can find "init_loogson"  and "var_loogson".
        - Is the initialisation routine being run?
            Yes, it run ,  which has shown in above.
         - Has the module been registered with the agent?
                I do'n know whether it has been registered or not.
                "NET-SNMP-MIB::nsModuleTable" module can not be found.
                i do not know what to do in this step ?
                it's something important i have ignored?
                
          - Is the module handler actually being called at all?
                NO, it do not be called!
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users

Reply via email to