Re: objects marked not-accessible returned by snmpwalk
Bill Fenner <[email protected]>
| Newsgroups | gmane.network.net-snmp.devel,gmane.network.net-snmp.user |
|---|---|
| Message-ID | <CAF4Sogav6pCWWsCB=fBC0JRL58OxqxjqybqnMPoWMSKYiZe5Lw@mail.gmail.com> |
You don't mention which helper you're using, but if you're using the table_iterator, is the not-accessible column in your column_info->details.list? Bill On Mon, Apr 27, 2015 at 6:47 AM, Tim Culhane <[email protected]> wrote: > Hi, > > I believe it is correct for index objects in a mib to be marked as > 'not-accessible'. Hence, when doing a walk of the mib such oids should be > skipped over and not returned. If you specifically try to get the object > then it should return ' no such object'. > > I have a shared object which is loaded by snmpd voa the dlmod directive and > which has the below function for retrieving column values from a table > defined in my mib: > > Hi Fulko, > > Originally in my shared object I had the following code to retrieve a > specific column: > > ***********************************************************************/ > /* > * @internal > * Retrieve the value for a particular column > */ > NETSNMP_STATIC_INLINE int > _razorgateSmtpStatusCountersTable_get_column > (razorgateSmtpStatusCountersTable_rowreq_ctx * rowreq_ctx, > netsnmp_variable_list * var, int column) > { > int rc = SNMPERR_SUCCESS; > > > DEBUGMSGTL(("internal:razorgateSmtpStatusCountersTable:_mfd_razorgateSmtpSta > tusCountersTable_get_column", "called for %d\n", column)); > > netsnmp_assert(NULL != rowreq_ctx); > > /* > * (INDEX) > > razorgateSmtpIPAddress(1)/DisplayString/ASN_OCTET_STR/char(char)//L/A/w/e/R/ > d/H > */ > if (COLUMN_RAZORGATESMTPIPADDRESS == column) > { > var->type = ASN_OCTET_STR; > /* > * NOTE: val_len is in bytes, razorgateSmtpIPAddress_len might not be (e.g. > oids) > */ > if (var->val_len < > (rowreq_ctx->tbl_idx.razorgateSmtpIPAddress_len * > sizeof(rowreq_ctx->tbl_idx.razorgateSmtpIPAddress[0]))) { > var->val.string = > malloc(rowreq_ctx->tbl_idx.razorgateSmtpIPAddress_len * > sizeof(rowreq_ctx->tbl_idx. > razorgateSmtpIPAddress[0])); > } > var->val_len = > rowreq_ctx->tbl_idx.razorgateSmtpIPAddress_len * > sizeof(rowreq_ctx->tbl_idx.razorgateSmtpIPAddress[0]); > memcpy(var->val.string, rowreq_ctx->tbl_idx.razorgateSmtpIPAddress, > var->val_len); > } > else if (RAZORGATESMTPSTATUSCOUNTERSTABLE_MIN_COL < column > && column <= RAZORGATESMTPSTATUSCOUNTERSTABLE_MAX_COL) > { > var->val_len = sizeof(long); > var->type = ASN_INTEGER; > rc = column_value_get(rowreq_ctx, > (long *) var->val.string, column); > } > else > { > snmp_log(LOG_ERR, > "unknown column %d in _razorgateSmtpStatusCountersTable_get_column\n", > column); > } > > return rc; > } > > However, if I do a talk of the tableall values are returned, including the > index field. > > > I then removed the if branch dealing with the IPAddress column, e.g.: > > if (COLUMN_RAZORGATESMTPIPADDRESS == column) > { > var->type = ASN_OCTET_STR; > /* > * NOTE: val_len is in bytes, razorgateSmtpIPAddress_len might not be (e.g. > oids) > */ > if (var->val_len < > (rowreq_ctx->tbl_idx.razorgateSmtpIPAddress_len * > sizeof(rowreq_ctx->tbl_idx.razorgateSmtpIPAddress[0]))) { > var->val.string = > malloc(rowreq_ctx->tbl_idx.razorgateSmtpIPAddress_len * > sizeof(rowreq_ctx->tbl_idx. > razorgateSmtpIPAddress[0])); > } > var->val_len = > rowreq_ctx->tbl_idx.razorgateSmtpIPAddress_len * > sizeof(rowreq_ctx->tbl_idx.razorgateSmtpIPAddress[0]); > memcpy(var->val.string, rowreq_ctx->tbl_idx.razorgateSmtpIPAddress, > var->val_len); > } > > But then if I do a walk of the table I get the below error: > > > snmpwalk -v2c -c public 10.128.19.86:161 -Os > razorgateSmtpStatusCountersTable > razorgateSmtpStatusCountersTable = No Such Object available on this agent > at > this OID > > It seems to be failing on the first oid in the table which is the IPAddress > oid. > > Can anybody tell me how I should handle requests for oids in my shared > objects when those oids are 'not-accessible'? > > Many thanks, > > Tim > > > > > ------------------------------------------------------------------------------ > One dashboard for servers and applications across Physical-Virtual-Cloud > Widest out-of-the-box monitoring support with 50+ applications > Performance metrics, stats and reports that give you Actionable Insights > Deep dive visibility with transaction tracing using APM Insight. > http://ad.doubleclick.net/ddm/clk/290420510;117567292;y > _______________________________________________ > Net-snmp-coders mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/net-snmp-coders > ------------------------------------------------------------------------------ One dashboard for servers and applications across Physical-Virtual-Cloud Widest out-of-the-box monitoring support with 50+ applications Performance metrics, stats and reports that give you Actionable Insights Deep dive visibility with transaction tracing using APM Insight. http://ad.doubleclick.net/ddm/clk/290420510;117567292;y _______________________________________________ Net-snmp-coders mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/net-snmp-coders