Re: about the snmpagent example

[email protected]
Newsgroups gmane.network.net-snmp.user
Message-ID <[email protected]>
&nbsp;
> > 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
>> 
>>>&nbsp; 2008/5/9&nbsp; <[email protected]>:
>>>&nbsp; > Then i've downloaded "example mib module"(nstAgentModuleObject.c)
>>>&nbsp; > and "header file"(nstAgentModuleObject.h ) and put them into the
>>>&nbsp; > directory:/usr/local/src/net-snmp-5.1.4/agent/mibgroup.
>> 
>>>&nbsp; Is this where you unpacked the source tarball?
>>>&nbsp; [Note that this is a very old version, and no longer being maintained.
>>>&nbsp; But that shouldn't affect whether you can add a new MIB or not.]
>> 
> > Yes,the 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;
>> 
>>>&nbsp; > Secondly,I entered the commands in the terminal as follows:
>>>&nbsp; > # export MIBS=ALL
>>>&nbsp; > # ./configure --with-mib-modules="nstAgentModuleObject"
>>>&nbsp; > # make
>>>&nbsp; > # make install
>> 
>>>&nbsp; This is from /usr/local/src/net-snmp-5.1.4/agent/mibgroup - yes?
>> 
>>&nbsp; Yes,i put the .c and .h file in
>>&nbsp; /usr/local/src/net-snmp-5.4.1/agent/mibgroup.I use net-snmp's version is
>>&nbsp; 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.
>&nbsp;&nbsp; [Please be careful when posting queries - such details can be important!]
Ok!

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

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

Oh,the below is my operate.
#ps -aux|grep snmpd
Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.3/FAQ
root&nbsp;&nbsp;&nbsp;&nbsp; 14960&nbsp; 0.0&nbsp; 0.5 79816 6056 ?&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; S&nbsp;&nbsp;&nbsp; May09&nbsp;&nbsp; 0:01 snmpd -f -Le -C -c /etc/snmp/snmpd.conf -d -Ddump -Dsysid
root&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2855&nbsp; 0.0&nbsp; 0.0 42312&nbsp; 696 pts/1&nbsp;&nbsp;&nbsp; S+&nbsp;&nbsp; 19:32&nbsp;&nbsp; 0:00 grep snmpd
#kill -9 14960 

> How did you start the re-compiled agent?
> What was the command you used?
> What is the result of
>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ps -ef | grep snmpd
> ?

I use the command is:
#make uninstall
#make clean
#./configure --with-mib-modules="sysid"
#make
#make install

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

>>&nbsp; void
>>&nbsp; init_sysid(void)
>>&nbsp; {
>>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; static oid&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sysid_oid[] = { 1, 3, 6, 1, 4, 1, 55555, 1, 1, 1, 1 };
>>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; netsnmp_register_scalar(netsnmp_create_handler_registration
>>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ("sysid", handle_sysid, sysid_oid,
>>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OID_LENGTH(sysid_oid), HANDLER_CAN_RONLY)))
>> }
> OK ....

>>&nbsp; I also put these two files copy to .../net-snmp-5.4.1/agent/mibgroup/,then
>>&nbsp; run
>>&nbsp; # export MIBS=ALL
>>&nbsp; # snmptranslate -IR -On sysid
>>&nbsp; .1.3.6.1.4.1.55555.1.1.1.1
>>&nbsp; # ./configure --with-mib-modules="sysid"
>>&nbsp; # make
>>&nbsp; # make install
> OK....
>> 
>>&nbsp; #snmpd -f -Le&nbsp; -d -Ddump -Dsysid
>>&nbsp; but when i asked for a snmpget command,it also gave me the result:
>>&nbsp; # snmpget -v 2c -c readstring localhost .1.3.6.1.4.1.55555.1.1.1.1
>>&nbsp; SNMPv2-SMI::enterprises.55555.1.1.1.1=No Such Object available on this agent
>>&nbsp; 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
>&nbsp;&nbsp;&nbsp;&nbsp; snmpget -v 2c -c readstring localhost .1.3.6.1.4.1.55555.1.1.1.1.0

> Dave

Ooh,but i also run snmpget -v 2c -c readstring localhost .1.3.6.1.4.1.55555.1.1.1.1.0,
# snmpget -v 2c -c readstring localhost .1.3.6.1.4.1.55555.1.1.1.1.0
SNMPv2-SMI::enterprises.55555.1.1.1.1.0 = No Such Object available on this agent at this OID
The problem is that net-snmp version?
Thanks very much!
-------------------------------------------------------------------------
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


-------------------------------------------------------------------
想玩得精彩?快来惠普"我的电脑 我的舞台"( http://d1.sina.com.cn/sina/limeng3/mail_zhuiyu/2008/mail_zhuiyu_20080505.html )

-------------------------------------------------------------------
注册新浪2G免费邮箱(http://mail.sina.com.cn/)

-------------------------------------------------------------------------
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.