Hi,David ,I made it with your suggestion. in excute phase: (both the agent and the manager were on ubuntu-10.10)
in the agent side, I wrote agent's command function in the MODE_SET_COMMIT module, it get the command string from the set-request package,and system it in the manager side ,I made a set-request package, send it. and the agent excute it , it's wonderful ! By now ,I can send several commands and excute them on the agent via net-snmpsuch ,as "touch ","cal" ,etc. but when I send "shutdown -h now" or "gedit &", it didn't work. Then ,what's the reason ? because of the authority of the snmp user or X server ? How to solve this? Best Regards wade 发件人: David A 发送时间: 2010-11-20 18:00:42 收件人: 徐滕 抄送: net-snmp-users 主题: Re: 回复: Help using net-snmp Hi good to see you are progressing. Q1: you can shorten the timeout. That will help move stuff along. Or instead of looking for agents, you can maybe incorporate a protocol like bonjour or mdns? Google those and see. I forgot details on them Q2: did you create an init_<module> and in there call the init function created by mib2c ? You also might want to make that one a set request, instead of get. Good luck David On Nov 20, 2010 1:44 AM, "徐滕" <xut...@huaihuacity.com> wrote: > Thanks David, and I still have to bother you with two questions. > > By now ,my practice is : > > I wrote my own mib which has two oids ,a vendorId (.1.3.6.1.4.1.8888.1, a > string type ,read-only ,for detecting device) ,a commandId > ((.1.3.6.1.4.1.8888.2, a string type, read-only ,for execute command on the > agent) , add this mib to the agent > > question 1 : in detecting phase: > I send the get-request for oid vendorID to the lan subnet , once anyone > return the vendorId I wanted , the manager recognise the responser . In my > test case, polling 60 IPs cost 6 minutes, it's a little slow, is anyother > more effective way to detecte devices I wanted? > > question 2: in execute phase > I want the agent to execute a command such as shutdown when the manager send > a get-request for commandId, so ,I used the mib2c to generate .h and .c from > the mib I defined myself , in the get-request-handler for commandId, I added > a function system("shutdown -h now") , then compile these files to a dynamic > library mylib.so , loaded it in the snmpd.conf on the agent ,restart snmpd > service . but it doesn't work ,why ? How should I do ? > > Thanks > > Best Regards > > wade > > ------------------ 原始邮件 ------------------ > 发件人: "David A"<daaf...@gmail.com>; > 发送时间: 2010年11月20日(星期六) 凌晨0:43 > 收件人: "徐滕"<xut...@huaihuacity.com>; > 抄送: "net-snmp-users"<net-snmp-users@lists.sourceforge.net>; > 主题: Re: Help using net-snmp > > > > Yes you would have to send requests to a range of IP addresses and see who > answers back. Or maybe you can use some bonjour like protocol. > > The manager can send requests to an agent that can trigger a command to be > executed yes. > On Nov 18, 2010 6:48 PM, "徐滕" <xut...@huaihuacity.com> wrote: >> Hi,all: >> >> I'm a fresh man to snmp, and now participating a project which has a manger >> on the console server,and a agent on several >> >> terminals such as pc or tc via lan . I cannot get my head arount how the >> manger detect the agent via lan ,should it brodcast a get-request to the lan >> ? >> >> and next question is ,could the manger send data to the agent or excute a >> remote command on the agent via net-snmp ? >> >> Could anyone help me? >> >> Regards! >> >> wade >> >> 2010-11-19
<<FoxmailIcon2: xuteng@huaihuacity.com.jpg>>
------------------------------------------------------------------------------ Increase Visibility of Your 3D Game App & Earn a Chance To Win $500! Tap into the largest installed PC base & get more eyes on your game by optimizing for Intel(R) Graphics Technology. Get started today with the Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs. http://p.sf.net/sfu/intelisp-dev2dev
_______________________________________________ Net-snmp-users mailing list Net-snmp-users@lists.sourceforge.net Please see the following page to unsubscribe or change other options: https://lists.sourceforge.net/lists/listinfo/net-snmp-users