RE: Help with exec and pass
Santanu Misra <[email protected]>
| Newsgroups | gmane.network.net-snmp.user |
|---|---|
| Message-ID | <[email protected]> |
Hello Dave, Thanks for your help, making me understand the man page a bit better now for net-snmp. Well my Perl script is ready and working fine with snmpwalk/ snmpgetnext/ snmpget. I am going to post the dummies how to on that. You are welcome to make your comments on that. Here is the draft. ------------------------------------------------------------------------ --- Trying to create a simple perl script to query via snmp which replies with recursively not just one set as shown on the main man page(you can choose any others of your choice). If is simple as long as basics are correct... 1. It should always reply with 3(three) sets of DATA -> The OID -> The Type (String or integer) -> The Data Example: .1.3.6.1.4.1.9999.1.0.0 string QAC_runtime 2. It should not print anything or debug message if there is anything wrong it should just do an exit!! 3. The script should be able to answer to "-g" and "-n" option only when that was passed otherwise do an exit. 4. When it is "-g" it should print the value for the OID it was asked. Example: # /usr/bin/lmstat.pl -g .1.3.6.1.4.1.9999.1.0.0 .1.3.6.1.4.1.9999.1.0.0 string QAC_runtime 5. When it is "-n" it should print the value for the next OID, then it was asked with. Example: # /usr/bin/lmstat.pl -n .1.3.6.1.4.1.9999.1.0.0 .1.3.6.1.4.1.9999.1.0.1 integer 0 6. When the last OID is reached it should exit. Like here I query the parent OID and as soon I reach end I exit. This only can be done with SNMP-WALK not by your script. As your script should only return the first OID ".1.3.6.1.4.1.9999.1.0.0" when called with ".1.3.6.1.4.1.9999.1" # /usr/local/net-snmp/bin/snmpwalk -v 1 -c public localhost .1.3.6.1.4.1.9999.1 SNMPv2-SMI::enterprises.9999.1.0.0 = STRING: "QAC_runtime" SNMPv2-SMI::enterprises.9999.1.0.1 = INTEGER: 0 SNMPv2-SMI::enterprises.9999.1.1.0 = STRING: "QAD_Planning" SNMPv2-SMI::enterprises.9999.1.1.1 = INTEGER: 0 SNMPv2-SMI::enterprises.9999.1.2.0 = STRING: "948" Like ..... .... ------------------------- End of Draft ------------------------------ Hope this one helps some others. -Regards Santanu -----Original Message----- From: Dave Shield [mailto:[email protected]] Sent: Friday, 14 October, 2005 16:28 To: Santanu Misra Cc: [email protected] Subject: RE: Help with exec and pass On Fri, 2005-10-14 at 16:17 +0200, Santanu Misra wrote: > Well some break through. I made changes and make sure with -g and - n > correct OID I get it right value and my script knows where the OID tree > end. > So here are the outputs > > # /usr/bin/lmstat.pl -n .1.3.6.1.4.1.9999.1.1.7 > wrong oid passed with option -n $ man snmpd.conf PASS-THROUGH CONTROL pass MIBOID EXEC EXEC -g MIBOID EXEC -n MIBOID To indicate that the script is unable to comply with the request due to an end-of-mib condition or an invalid request, simply exit and return no output to stdout at all. ^^^^^^^^^^^^^^^^^^^^^^^^^^ "wrong oid passed with option -n" is *NOT* the same as "no output" > *** Question *** > > But what I need to do to get all those child value via snmpwalk Follow the instructions in snmpd.conf. I'd also suggest you try testing with "snmpget" and "snmpgetnext" rather than "snmpwalk" Dave ----------------------------------------------------------------- Visit our Internet site at http://www.reuters.com To find out more about Reuters Products and Services visit http://www.reuters.com/productinfo Any views expressed in this message are those of the individual sender, except where the sender specifically states them to be the views of Reuters Ltd. ------------------------------------------------------- This SF.Net email is sponsored by: Power Architecture Resource Center: Free content, downloads, discussions, and more. http://solutions.newsforge.com/ibmarch.tmpl _______________________________________________ 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