Hello,

I thought of a solution for the missing coloums problem that I stated
earlier. Before I implement I need your comments on the same. 

I did some experiments with the 'netSnmpHostsTable' code that resides in
'mibgroup/examples/' directory of Net-SNMP installation directory. 

I made following are the changes I made to the
'get_netSnmpHostRowStatus' function in 'netSnmpHostsTable_access.c'.

long           *
get_netSnmpHostRowStatus(void *data_context, size_t * ret_len)
{
    static long ret = RS_ACTIVE;
                                                                                
    static int count = 0;
                                                                                
    if (count == 0)
    {
        count++;
        return (NULL);
    }
    *ret_len = sizeof(ret);
    return &ret;
}

In this code I am making sure that agent will _NOT_ return the value for
first instance of the netSnmpHostRowStatus object. 

I made following are the changes I made to the
'netSnmpHostsTable_handler' function in 'netSnmpHostsTable.c' for the
GET portion of 'COLUMN_NETSNMPHOSTROWSTATUS'

case COLUMN_NETSNMPHOSTROWSTATUS:
{
        long           *retval;
        size_t          retval_len = 0;

        retval = get_netSnmpHostRowStatus (data_context,
                                           &retval_len);
        if (retval == NULL)
                netsnmp_set_request_error (reqinfo, 
                                           request,
                                           SNMP_NOSUCHINSTANCE);
        else
                snmp_set_var_typed_value (var, ASN_INTEGER,
                                          (const u_char *) retval,
                                           retval_len);
}
break;


Following is a snapshot of the snmpwalk. As seen from the output there
is no value for 'netSnmpHostRowStatus."SYSTEM-1"' column and 'snmpwalk'
retrieved values for rest of the columns. 

NET-SNMP-EXAMPLES-MIB::netSnmpHostAddressType."SYSTEM-1" = INTEGER:
ipv4(1)
NET-SNMP-EXAMPLES-MIB::netSnmpHostAddressType."SYSTEM-2" = INTEGER:
ipv4(1)
NET-SNMP-EXAMPLES-MIB::netSnmpHostAddressType."SYSTEM-3" = INTEGER:
ipv4(1)
NET-SNMP-EXAMPLES-MIB::netSnmpHostAddress."SYSTEM-1" = Hex-STRING: 0A 5B
00 01
NET-SNMP-EXAMPLES-MIB::netSnmpHostAddress."SYSTEM-2" = Hex-STRING: 0A 5B
00 02
NET-SNMP-EXAMPLES-MIB::netSnmpHostAddress."SYSTEM-3" = Hex-STRING: 0A 5B
00 03
NET-SNMP-EXAMPLES-MIB::netSnmpHostStorage."SYSTEM-1" = INTEGER:
nonVolatile(3)
NET-SNMP-EXAMPLES-MIB::netSnmpHostStorage."SYSTEM-2" = INTEGER:
nonVolatile(3)
NET-SNMP-EXAMPLES-MIB::netSnmpHostStorage."SYSTEM-3" = INTEGER:
nonVolatile(3)
NET-SNMP-EXAMPLES-MIB::netSnmpHostRowStatus."SYSTEM-2" = INTEGER:
active(1)
NET-SNMP-EXAMPLES-MIB::netSnmpHostRowStatus."SYSTEM-3" = INTEGER:
active(1)

Please let me know your feedback on this change.

Another question: Can anyway I can return a 'SNMP_NOSUCHINSTANCE' code
generated in ucd-snmp style ?

Thanks
SrIdhar

PS: Both the files have following header

/*
 * Note: this file originally auto-generated by mib2c using
 *        : mib2c.access_functions.conf,v 1.3 2003/05/31 00:11:57
 hardaker Exp $ */



On Thu, 27 Jan 2005 11:50:47 +0530, "Sridhar S" <[EMAIL PROTECTED]> said:
> Robert,
> 
> > Dealing with jumping to the next row would have to be handled internally
> > in the var_* routine.
> 
> This means I need to handle in var_ifEntry (...) function. Right ? If
> so, I need to think of a algorithm for doing so.
> 
> Thanks
> SrIdhar
> 
> 
> On Wed, 26 Jan 2005 15:29:20 -0500, "Robert Story" <[EMAIL PROTECTED]>
> said:
> > On Tue, 25 Jan 2005 22:17:34 -0800 Wes wrote:
> > WH> Do you have at least 2 interfaces?  You'd need to if your ignoring
> > the
> > WH> first and expect results back still.
> > 
> > Yes, an earlier message indicated that he did have 2 interfaces.
> > 
> > WH> I'd have to study your changes in greater detail but since what
> > you're
> > WH> trying to do is a bit strange I can't say what you've done will work
> > WH> though in theory it should if you did it right.
> > 
> > I don't think so. I don't think the old API handles sparse tables
> > automatically. It will handle missing columns, but not sparse tables.
> > 
> > Dealing with jumping to the next row would have to be handled internally
> > in the
> > var_* routine.
> > 
> > -- 
> > Robert Story; NET-SNMP Junkie
> > Support: <http://www.net-snmp.org/> <irc://irc.freenode.net/#net-snmp>  
> > Archive:
> > <http://sourceforge.net/mailarchive/forum.php?forum=net-snmp-users>
> > 
> > You are lost in a twisty maze of little standards, all different. 


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
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

Reply via email to