Re: problem in SNMPSET on table with string data type columns

Bill Fenner <[email protected]>
Newsgroups gmane.network.net-snmp.devel,gmane.network.net-snmp.user
Message-ID <CAF4SogY0w4F-CbEfhv_XQA=6sWPYxmnDHryJwOoiLZ=Mygx4XQ@mail.gmail.com>
I've had trouble with multiple requests in ordered table_iterator tables.
 I have no idea if that's what you're using, since you didn't give much
info about your use case.  I just worked around it by injecting the
serialize handler:

    int result = netsnmp_register_table_iterator( reg, iinfo );
    assert( result == MIB_REGISTERED_OK );
    int injected = netsnmp_inject_handler( reg,
netsnmp_get_serialize_handler() );
    assert( injected == SNMPERR_SUCCESS );

  Bill


On Wed, Sep 3, 2014 at 3:19 AM, sarath azad <[email protected]> wrote:

> Hello,
>
> Could you please help in solving the below problem, in doing SNMPSET for
> tables with string data?
>
> thanks and regards
> S Sarath
>
>
>   On Friday, August 22, 2014 9:03 PM, sarath azad <[email protected]>
> wrote:
>
>
> Hello,
>
> Could you please help in resolving the below issue?
> For SNMPSET on a table which contains a column of "string" data type, if
> we are giving values of all the columns in the single SNMPSET query, then
> we are getting the values of the string column properly, only if the order
> of column values, in the query is same as the order of column in the table.
>  ie. snmpset -v 2c -c public <system-IP> <column 1> <column 1 value>
> <column 2> <column 2 value> ...
>
> If we are giving the values in the query in different order, then for
> integer columns we are getting values properly as given in the query. But
> for the string columns we are only getting some junk characters or value in
> the previous column in the query.
>
> The table handler function is written as below:
>
> Int tableHandlerFunction (netsnmp_mib_handler         *handler,
>  netsnmp_handler_registration   *reginfo,
>                               netsnmp_agent_request_info     *reqinfo,
> netsnmp_request_info           *requests)
> {
> netsnmp_request_info *request;
> netsnmp_table_request_info *table_info;
> char data[100];
> for (request = requests; request; request = request->next)
>  {
>           table_info = netsnmp_extract_table_info(request);
>           switch (reqinfo->mode)
>           {
>               case MODE_SET_ACTION:
>                    switch (table_info->colnum)
>                    {
>                                case COLUMN_STRING_COLUMN:
>                                    strcpy( data ,
> requests->requestvb->val.string));
>                                    break;
>
>
> thanks and regards
> S Sarath
>
>
> ------------------------------------------------------------------------------
> Slashdot TV.
> Video for Nerds.  Stuff that matters.
> http://tv.slashdot.org/
> _______________________________________________
> 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
>
>
>
>
> ------------------------------------------------------------------------------
> Slashdot TV.
> Video for Nerds.  Stuff that matters.
> http://tv.slashdot.org/
> _______________________________________________
> 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
>
>

------------------------------------------------------------------------------
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/

_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.