This is a discussion on sourceforge tutorial sample code problem within the SNMP Users forums, part of the Networking and Network Related category; Hi, there! I compiled some sample code provided by sorceforge(http://net-snmp.sourceforge.net/tuto...app/index.html), but ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hi, there!
I compiled some sample code provided by sorceforge(http://net-snmp.sourceforge.net/tuto...app/index.html), but it will run into error when call the 'initialize()' function: void initialize (void) { struct oid *op = oids; /* Win32: init winsock */ SOCK_STARTUP; /* initialize library */ init_snmp("asynchapp"); /* parse the oids */ while (op->Name) { op->OidLen = sizeof(op->Oid)/sizeof(op->Oid[0]); if (!read_objid(op->Name, op->Oid, &op->OidLen)) { //########IT WILL RUN INTO ERROR HERE!!######### snmp_perror("read_objid"); exit(1); } op++; } } The program will report 'read_objid: Unknown Object Identifier (Sub-id not found: (top) -> system)'. And I paste oid definition here: struct oid { const char *Name; oid Oid[MAX_OID_LEN]; int OidLen; } oids[] = { { "system.sysDescr.0" }, { "interfaces.ifNumber.1" }, { "interfaces.ifNumber.0" }, { NULL } }; It seems that read_objid function don't understand what is 'system.sysDesc.0', could anybody tell me why this error happend? Thanks! -------------- xiao ren 2008-06-23 ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ 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/...net-snmp-users |
|
|||
|
2008/6/23 xiao ren <reign99@21cn.com>:
> The program will report 'read_objid: Unknown Object Identifier (Sub-id not found: (top) -> system)'. Have you installed the MIB files? Where? Dave ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ 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/...net-snmp-users |
|
|||
|
Hi, Dave
I don't install the MIB files, and I don't know how to install it. According to the tutorial, it seems to me that this 'asyncapp.c' sample don't need any further installation, just 'make and run'. Could you please show me where and how to install this MIB files? Thanks a lot! ------------------ xiao ren 2008-06-24 ------------------------------------------------------------- ·¢¼þÈË£ºDave Shield ·¢ËÍÈÕÆÚ£º2008-06-23 23:52:52 ÊÕ¼þÈË£ºxiao ren ³*ËÍ£ºNet-snmp-users Ö÷Ì⣺Re: sourceforge tutorial sample code problem 2008/6/23 xiao ren <reign99@21cn.com>: > The program will report 'read_objid: Unknown Object Identifier (Sub-id not found: (top) -> system)'. Have you installed the MIB files? Where? Dave ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ 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/...net-snmp-users |
|
|||
|
Hi, Dave
I replaced the function read_objid() to snmp_parse_oid() and the sample application works fine. Is read_objid() updated or something? ------------------ xiao ren 2008-06-24 ------------------------------------------------------------- ·¢¼þÈË£ºDave Shield ·¢ËÍÈÕÆÚ£º2008-06-23 23:52:52 ÊÕ¼þÈË£ºxiao ren ³*ËÍ£ºNet-snmp-users Ö÷Ì⣺Re: sourceforge tutorial sample code problem 2008/6/23 xiao ren <reign99@21cn.com>: > The program will report 'read_objid: Unknown Object Identifier (Sub-id not found: (top) -> system)'. Have you installed the MIB files? Where? Dave ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ 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/...net-snmp-users |
|
|||
|
2008/6/23 xiao ren <reign99@21cn.com>:
> I don't install the MIB files The MIB files are what defines the conversion between MIB object names ('system') and numeric OIDs. If the MIB files aren't available, then the library won't understand object names. > According to the tutorial, it seems to me that this 'asyncapp.c' sample don't need >any further installation, just 'make and run'. The application doesn't need anything special. But it does assume that you've got the Net-SNMP library and accompanying stuff installed. > Could you please show me where and how to install this MIB files? The MIB files would normally be handled as part of installing the basic Net-SNMP software - either from source ("make install") or as part of a binary package. > I replaced the function read_objid() to snmp_parse_oid() and the sample > application works fine. Is read_objid() updated or something? Strange - snmp_parse_oid is effectively a wrapper round read_objid. Both of them rely on having the MIB files available. Still, if that works for you, then fair enough. It might be worth trying read_objid with oids[] = { { "SNMPv2-MIB::sysDescr.0" }, { "IF-MIB::ifNumber.1" }, { "IF-MIBifNumber.0" }, { NULL } }; That's all I can think of offhand. Dave ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ 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/...net-snmp-users |
|
|||
|
> From: net-snmp-users-bounces@lists.sourceforge.net > [mailto:net-snmp-users-bounces@lists.sourceforge.net] On > Behalf Of xiao ren > Sent: Tuesday, June 24, 2008 2:07 AM > And yes, I do install net-snmp lib from source, so I guess I > have installed the MIB files already. Part of "installed" involves locatability. This is usually done by setting the environment variables MIBDIRS and MIBS in a startup file (.bashrc, Windows "environment variables" dialog, etc.), but one can set those locally or use -M/-m flags. > And read_objid function doesn't report error after I changed > the oids structure according to your advice. Maybe I should > always explicitly write the MIB name from which the oid originated? You should always fully qualify your OIDs so the library can find them. Generally, the MIB::name reliably, produces fully qualified OIDs, but you can also use full numeric OIDs, depending on the situation. HTH, Mike ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ 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/...net-snmp-users |