Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.


#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 };

                                  &int_init, NULL);

share|improve this question

closed as not a real question by quanta, Michael Hampton, Ward, HopelessN00b, Scott Pack Sep 22 '12 at 16:11

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

up vote 0 down vote accepted

I dont know if this is the right way, but it work.

static char errors_value[MY_MAX_LEN];
void init_monitor_snmp_agent(void) {
    const oid errors_oid[] = { 1, 3, 6, 1, 4, 1, 8075, 10 };//In this we dont add the 0 at the end
    strcpy(errors_value, "");
            netsnmp_create_handler_registration("open_connections_list", NULL,
                    errors_oid, OID_LENGTH(errors_oid),
            netsnmp_create_watcher_info(&errors_value, MY_MAX_LEN,
                    ASN_OCTET_STR, WATCHER_MAX_SIZE));
share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.