Hi, this is a long e-mail again because i attached some code
> Object identifier 9: 1.3.6.1.4.1.11.2.4.3.8.3.2 > Object identifier 10: 1.3.6.1.4.1.11.2.4.3.8.3.3 > Object identifier 11: 1.3.6.1.4.1.11.2.4.3.10.7 > Object identifier 12: 1.3.6.1.4.1.11.2.4.3.10.13 > Object identifier 13: 1.3.6.1.4.1.11.2.4.3.13.1 >All these are HP-specific MIB objects, which the Net-SNMP >agent won't implement. >. >. >I wouldn't get hung up on the ifIndex ordering until you've tackled >this missing MIB, which is likely to be a much more significant problem. i have found the missing mib (JETDIRECT3-MIB) that is needed to resolve the OIDs above but i have some trouble implementing these Objects. These are scalar objects and i used the mib2c.scalar.conf to generate the template code i implemented the class as i always do it for scalars. (i will attach the code for the OID 1.3.6.1.4.1.11.2.4.3.13.1 as an example) I get the error that the Object i implement is not in the agent snmpget -v1 -cpublic 192.168.2.101 npIpxGetUnitCfgResp2.1 Error in packet Reason: (noSuchName) There is no such variable name in this MIB. Failed object: JETDIRECT3-MIB::npIpxGetUnitCfgResp2.7 snmpget -v2c -cpublic 192.168.2.101 npIpxGetUnitCfgResp2.1 JETDIRECT3-MIB::npIpxGetUnitCfgResp2.1 = No Such Object available on this agent at this OID the npIpxGetUnitCfg2 as example Object for understanding npIpxGetUnitCfgResp2 OBJECT-TYPE SYNTAX OCTET STRING MAX-ACCESS read-write STATUS current DESCRIPTION "This object is the Get Unit Config Response structure described in the IPX code. This structure is of variable length depending on how many servers are configured. This is the second set of info when more than 8 print servers are configured." ::={ npIpx 7 } And here are the entries in the header files that are relevant to compile this object into the agent: mib_module_inits.h #ifdef USING_HP_NPIPXGETUNITCFGRESP2_MODULE if (should_init("npIpxGetUnitCfgResp2")) init_npIpxGetUnitCfgResp2(); #endif mib_module_includes.h #ifdef USING_HP_NPIPXGETUNITCFGRESP2_MODULE #include "mibgroup/hp/npIpxGetUnitCfgResp2.h" #endif and mib_module_config.h #ifdef USING_HP_MODULE #define USING_HP_NPIPXGETUNITCFGRESP2_MODULE 1 #endif and the MIB Jetdirect3-MIB is defined in net-snmp-config.h #define DEFAULT_MIBS "IP-MIB;IF-MIB;TCP-MIB;UDP-MIB;HOST-RESOURCES-MIB;SNMPv2-MIB;RFC1213-MIB;NOTIFICATION-LOG-MIB;UCD-SNMP-MIB;SNMP-TARGET-MIB;NET-SNMP-AGENT-MIB;DISMAN-EVENT-MIB;SNMP-VIEW-BASED-ACM-MIB;SNMP-COMMUNITY-MIB;UCD-DLMOD-MIB;SNMP-FRAMEWORK-MIB;SNMP-MPD-MIB;SNMP-USER-BASED-SM-MIB;SNMP-NOTIFICATION-MIB;SNMPv2-TM;LaserJet-Series4050-MIB;Printer-MIB;JETDIRECT3-MIB" and here is the implementation i usually use for string type scalars /* * Note: this file originally auto-generated by mib2c using * : mib2c.scalar.conf,v 1.8 2004/10/14 12:57:34 dts12 Exp $ */ #include <net-snmp/net-snmp-config.h> #include <net-snmp/net-snmp-includes.h> #include <net-snmp/agent/net-snmp-agent-includes.h> #include "npIpxGetUnitCfgResp2.h" char *tmp_ptr; static char npIpxGetUnitCfgResp2[BUF_LEN]; /** Initializes the npIpxGetUnitCfgResp2 module */ void init_ipxvars(void) { strcpy(npIpxGetUnitCfgResp2, "test"); } void init_npIpxGetUnitCfgResp2(void) { static oid npIpxGetUnitCfgResp2_oid[] = { 1,3,6,1,4,1,11,2,4,3,10,7 }; DEBUGMSGTL(("npIpxGetUnitCfgResp2", "Initializing\n")); init_ipxvars(); netsnmp_register_scalar( netsnmp_create_handler_registration("npIpxGetUnitCfgResp2", handle_npIpxGetUnitCfgResp2, npIpxGetUnitCfgResp2_oid, OID_LENGTH(npIpxGetUnitCfgResp2_oid), HANDLER_CAN_RWRITE )); } int handle_npIpxGetUnitCfgResp2(netsnmp_mib_handler *handler, netsnmp_handler_registration *reginfo, netsnmp_agent_request_info *reqinfo, netsnmp_request_info *requests) { /* We are never called for a GETNEXT if it's registered as a "instance", as it's "magically" handled for us. */ /* a instance handler also only hands us one request at a time, so we don't need to loop over a list of requests; we'll only get one. */ switch(reqinfo->mode) { case MODE_GET: snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR, (u_char *)npIpxGetUnitCfgResp2,strlen(npIpxGetUnitCfgResp2)); break; /* * SET REQUEST * * multiple states in the transaction. See: * http://www.net-snmp.org/tutorial-5/toolkit/mib_module/set-actions.jpg */ case MODE_SET_RESERVE1: if (requests->requestvb->type != ASN_OCTET_STR ) { netsnmp_set_request_error(reqinfo, requests, SNMP_ERR_WRONGTYPE); return SNMP_ERR_WRONGTYPE; } if (requests->requestvb->val_len > sizeof(BUF_LEN) ) { netsnmp_set_request_error(reqinfo, requests, SNMP_ERR_WRONGVALUE); return SNMP_ERR_WRONGVALUE; } break; case MODE_SET_RESERVE2: tmp_ptr = (char *)malloc(requests->requestvb->val_len + 1); if (tmp_ptr == NULL) { printf("SNMP_ERR_RESOURCEUNAVAILABLE!\n"); netsnmp_set_request_error(reqinfo, requests, SNMP_ERR_RESOURCEUNAVAILABLE); return (SNMP_ERR_RESOURCEUNAVAILABLE); } break; case MODE_SET_FREE: if (tmp_ptr) { free(tmp_ptr); printf("memory freed!\n"); } break; case MODE_SET_ACTION: if (tmp_ptr == NULL) { printf("SNMP_ERR_RESOURCEUNAVAILABLE!\n"); netsnmp_set_request_error(reqinfo, requests, SNMP_ERR_RESOURCEUNAVAILABLE); return (SNMP_ERR_RESOURCEUNAVAILABLE); } memset(tmp_ptr, 0, BUF_LEN); strncpy(tmp_ptr, (char *)requests->requestvb->val.string, (BUF_LEN-1)); break; case MODE_SET_COMMIT: if (sizeof(tmp_ptr) >= BUF_LEN) { printf("SNMP_ERR_COMMITFAILED!\n"); netsnmp_set_request_error(reqinfo, requests, SNMP_ERR_COMMITFAILED); return (SNMP_ERR_COMMITFAILED); } strcpy(npIpxGetUnitCfgResp2, tmp_ptr); free(tmp_ptr); printf("memory freed in commit!\n"); break; case MODE_SET_UNDO: free(tmp_ptr); printf("memory freed in undo!\n"); break; default: /* we should never get here, so this is a really bad error */ snmp_log(LOG_ERR, "unknown mode (%d) in handle_npIpxGetUnitCfgResp2\n", reqinfo->mode ); return SNMP_ERR_GENERR; } return SNMP_ERR_NOERROR; } Is the code wrong or could it be a bad MIB? I have downloaded the JETDIRECT3-MIB (the new version because the older one is buggy) from www.mibdepot.com Sorry for messing you with this details but I don't see where i make something wrong. Perhaps you can give some suggestions. Thanks in advance for your understanding With best regards -- DSL-Aktion wegen großer Nachfrage bis 28.2.2006 verlängert: GMX DSL-Flatrate 1 Jahr kostenlos* http://www.gmx.net/de/go/dsl ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642 _______________________________________________ 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