netsnmp - how to register string?

Posted by user1495181 on Server Fault See other posts from Server Fault or by user1495181
Published on 2012-09-13T13:31:42Z Indexed on 2012/09/13 15:40 UTC
Read the original article Hit count: 464

Filed under:
|

I use net-snmp. I try to add my own mibs (no need in handler, just a MIB that i can get and set by snmp call), so i followed the scalar example. In order to add my own mibs i defined them in the mib file and create an agent extension.(see below).

It work, so i have now an integer MIB. Now i want to add string mib, so i define the MIB , but i dont find a register API for string, like i have for the int - netsnmp_register_int_instance. I look in the includes file , but dosnt found matching one.

agent:

#include <net-snmp/net-snmp-config.h>
#include <net-snmp/net-snmp-includes.h>
#include <net-snmp/agent/net-snmp-agent-includes.h>
#include "monitor.h"


static int int_init = 0;  /* default value */


void init_monitor(void)
{

    oid  open_connections_count_oid[] =
        { 1, 3, 6, 1, 4, 1, 8075, 1, 0 };

    netsnmp_register_int_instance("open_connections_count",
                                  open_connections_count_oid,
                                  OID_LENGTH(open_connections_count_oid),
                                  &int_init, NULL);

}

© Server Fault or respective owner

Related posts about snmp

Related posts about net-snmp