Re: 回复:Re: about the snmpagent example

"Dave Shield" <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <[email protected]>
    [ First - *please* don't mail me privately, without copying
     any responses to the mailing list.  I don't have the time
     or inclination to offer private, unpaid, SNMP consultancy.
     Keep discussions to the list, where others can both learn
     and offer advice.  Thanks.   ]



2008/5/9  <[email protected]>:
> Thanks for you reply.
>
>> ----- Original Message -----
>> From: Dave Shield <[email protected]>
>> To: [email protected]
>> Subject: Re: about the snmpagent example
>> Date: 08-05-09 16:38:29
>
>> 2008/5/9  <[email protected]>:
>> > Then i've downloaded "example mib module"(nstAgentModuleObject.c)
>> > and "header file"(nstAgentModuleObject.h ) and put them into the
>> > directory:/usr/local/src/net-snmp-5.1.4/agent/mibgroup.
>
>> Is this where you unpacked the source tarball?
>> [Note that this is a very old version, and no longer being maintained.
>> But that shouldn't affect whether you can add a new MIB or not.]
>
> Yesthe example mib module(nstAgentModuleObject.c) was downlaod from
> "https://sourceforge.net/search/?group_id=12694&type_of_search=mlists",
> the file .c and .h also;
>
>> > Secondly,I entered the commands in the terminal as follows:
>> > # export MIBS=ALL
>> > # ./configure --with-mib-modules="nstAgentModuleObject"
>> > # make
>> > # make install
>
>> This is from /usr/local/src/net-snmp-5.1.4/agent/mibgroup - yes?
>
> Yes,i put the .c and .h file in
> /usr/local/src/net-snmp-5.4.1/agent/mibgroup.I use net-snmp's version is
> 5-4-1.


OK - 5.4.1 is a much more sensible version to use.
That's the most recent release - 5.1.4 is obsolete.
   [Please be careful when posting queries - such details can be important!]


>> Did you start the new agent?
>> How?
>
>> Is there a vendor-supplied version of the Net-SNMP agent already
>> installed?
>> Did you stop that first?   (Or better, remove it completely before
>> starting with
>> the self-compiled version).
>
> First,i stop the snmpd,then recompiled the source.
>
> # ./configure --with-mib-modules="nstAgentModuleObject"
> # make
> # make install
> I use the default installation.
> Thanks very much,Dave Shield.


But *how* did you stop the (vendors supplied) agent?
What was the command you used?

How did you start the re-compiled agent?
What was the command you used?

What is the result of
     ps -ef | grep snmpd
?



> I also generate a small program use mib2c,the code below:


> void
> init_sysid(void)
> {
>     static oid      sysid_oid[] = { 1, 3, 6, 1, 4, 1, 55555, 1, 1, 1, 1 };

>     netsnmp_register_scalar(netsnmp_create_handler_registration
>                             ("sysid", handle_sysid, sysid_oid,
>                              OID_LENGTH(sysid_oid), HANDLER_CAN_RONLY)))

> }

OK ....


> I also put these two files copy to .../net-snmp-5.4.1/agent/mibgroup/,then
> run
> # export MIBS=ALL
> # snmptranslate -IR -On sysid
> .1.3.6.1.4.1.55555.1.1.1.1
> # ./configure --with-mib-modules="sysid"
> # make
> # make install

OK....

>
> #snmpd -f -Le  -d -Ddump -Dsysid
> but when i asked for a snmpget command,it also gave me the result:
> # snmpget -v 2c -c readstring localhost .1.3.6.1.4.1.55555.1.1.1.1
> SNMPv2-SMI::enterprises.55555.1.1.1.1=No Such Object available on this agent
> at this OID

You've forgotten the instance subidentifier.
.1.3.6.1.4.1.55555.1.1.1.1 is the OID of the MIB *object*,
not the scalar instance.

Try
    snmpget -v 2c -c readstring localhost .1.3.6.1.4.1.55555.1.1.1.1.0


Dave

-------------------------------------------------------------------------
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.