#define ERR_BUF_SIZE 1024
#define TYPE_STRING -1
-#ifndef MIN
-#define MIN(x, y) ((x) < (y) ? (x) : (y))
-#endif
-
struct oid_s {
oid oid[MAX_OID_LEN];
size_t oid_len;
char *type;
char *type_instance;
const table_definition_t *table;
- _Bool is_instance;
+ bool is_instance;
oid_t *oids;
size_t oids_len;
double scale;
};
typedef struct snmp_agent_ctx_s snmp_agent_ctx_t;
-static snmp_agent_ctx_t *g_agent = NULL;
+static snmp_agent_ctx_t *g_agent;
#define CHECK_DD_TYPE(_dd, _p, _pi, _t, _ti) \
(_dd->plugin ? !strcmp(_dd->plugin, _p) : 0) && \
(_dd->type ? !strcmp(_dd->type, _t) : 0) && \
(_dd->type_instance ? !strcmp(_dd->type_instance, _ti) : 1)
+static int snmp_agent_shutdown(void);
static void *snmp_agent_thread_run(void *arg);
static int snmp_agent_register_oid(oid_t *oid, Netsnmp_Node_Handler *handler);
static int snmp_agent_set_vardata(void *dst_buf, size_t *dst_buf_len,
char *oid_str_ptr[MAX_OID_LEN];
for (size_t i = 0; i < o->oid_len; i++) {
- ssnprintf(oid_str[i], sizeof(oid_str[i]), "%lu", (unsigned long)o->oid[i]);
+ snprintf(oid_str[i], sizeof(oid_str[i]), "%lu", (unsigned long)o->oid[i]);
oid_str_ptr[i] = oid_str[i];
}
return strjoin(buf, buf_size, oid_str_ptr, o->oid_len, ".");
}
-static void snmp_agent_dump_data(void) {
+/* Prints a configuration storing list. It handles both table columns list
+ and scalars list */
#if COLLECT_DEBUG
+static void snmp_agent_dump_data(llist_t *list) {
+ char oid_str[DATA_MAX_NAME_LEN];
+ for (llentry_t *de = llist_head(list); de != NULL; de = de->next) {
+ data_definition_t *dd = de->value;
+
+ if (dd->table != NULL)
+ DEBUG(PLUGIN_NAME ": Column:");
+ else
+ DEBUG(PLUGIN_NAME ": Scalar:");
+
+ DEBUG(PLUGIN_NAME ": Name: %s", dd->name);
+ if (dd->plugin)
+ DEBUG(PLUGIN_NAME ": Plugin: %s", dd->plugin);
+ if (dd->plugin_instance)
+ DEBUG(PLUGIN_NAME ": PluginInstance: %s", dd->plugin_instance);
+ if (dd->is_instance)
+ DEBUG(PLUGIN_NAME ": Instance: true");
+ if (dd->type)
+ DEBUG(PLUGIN_NAME ": Type: %s", dd->type);
+ if (dd->type_instance)
+ DEBUG(PLUGIN_NAME ": TypeInstance: %s", dd->type_instance);
+ for (size_t i = 0; i < dd->oids_len; i++) {
+ snmp_agent_oid_to_string(oid_str, sizeof(oid_str), &dd->oids[i]);
+ DEBUG(PLUGIN_NAME ": OID[%" PRIsz "]: %s", i, oid_str);
+ }
+ DEBUG(PLUGIN_NAME ": Scale: %g", dd->scale);
+ DEBUG(PLUGIN_NAME ": Shift: %g", dd->shift);
+ }
+}
+
+/* Prints parsed configuration */
+static void snmp_agent_dump_config(void) {
char oid_str[DATA_MAX_NAME_LEN];
+ /* Printing tables */
for (llentry_t *te = llist_head(g_agent->tables); te != NULL; te = te->next) {
table_definition_t *td = te->value;
DEBUG(PLUGIN_NAME ": SizeOID: %s", oid_str);
}
- for (llentry_t *de = llist_head(td->columns); de != NULL; de = de->next) {
- data_definition_t *dd = de->value;
-
- DEBUG(PLUGIN_NAME ": Column:");
- DEBUG(PLUGIN_NAME ": Name: %s", dd->name);
- if (dd->plugin)
- DEBUG(PLUGIN_NAME ": Plugin: %s", dd->plugin);
- if (dd->plugin_instance)
- DEBUG(PLUGIN_NAME ": PluginInstance: %s", dd->plugin_instance);
- if (dd->is_instance)
- DEBUG(PLUGIN_NAME ": Instance: true");
- if (dd->type)
- DEBUG(PLUGIN_NAME ": Type: %s", dd->type);
- if (dd->type_instance)
- DEBUG(PLUGIN_NAME ": TypeInstance: %s", dd->type_instance);
- for (int i = 0; i < dd->oids_len; i++) {
- snmp_agent_oid_to_string(oid_str, sizeof(oid_str), &dd->oids[i]);
- DEBUG(PLUGIN_NAME ": OID[%d]: %s", i, oid_str);
- }
- DEBUG(PLUGIN_NAME ": Scale: %g", dd->scale);
- DEBUG(PLUGIN_NAME ": Shift: %g", dd->shift);
- }
+ snmp_agent_dump_data(td->columns);
}
- for (llentry_t *e = llist_head(g_agent->scalars); e != NULL; e = e->next) {
- data_definition_t *dd = e->value;
-
- DEBUG(PLUGIN_NAME ": Scalar:");
- DEBUG(PLUGIN_NAME ": Name: %s", dd->name);
- if (dd->plugin)
- DEBUG(PLUGIN_NAME ": Plugin: %s", dd->plugin);
- if (dd->plugin_instance)
- DEBUG(PLUGIN_NAME ": PluginInstance: %s", dd->plugin_instance);
- if (dd->is_instance)
- DEBUG(PLUGIN_NAME ": Instance: true");
- if (dd->type)
- DEBUG(PLUGIN_NAME ": Type: %s", dd->type);
- if (dd->type_instance)
- DEBUG(PLUGIN_NAME ": TypeInstance: %s", dd->type_instance);
- for (int i = 0; i < dd->oids_len; i++) {
- snmp_agent_oid_to_string(oid_str, sizeof(oid_str), &dd->oids[i]);
- DEBUG(PLUGIN_NAME ": OID[%d]: %s", i, oid_str);
- }
- DEBUG(PLUGIN_NAME ": Scale: %g", dd->scale);
- DEBUG(PLUGIN_NAME ": Shift: %g", dd->shift);
- }
-#endif /* COLLECT_DEBUG */
+ /* Printing scalars */
+ snmp_agent_dump_data(g_agent->scalars);
}
+#endif /* COLLECT_DEBUG */
-static int snmp_agent_validate_data(void) {
+static int snmp_agent_validate_config(void) {
- snmp_agent_dump_data();
+#if COLLECT_DEBUG
+ snmp_agent_dump_config();
+#endif
for (llentry_t *te = llist_head(g_agent->tables); te != NULL; te = te->next) {
table_definition_t *td = te->value;
return 0;
}
-static void snmp_agent_generate_oid2string(oid_t *oid, int offset, char *key) {
- int key_len = oid->oid[offset];
- int i;
+static void snmp_agent_generate_oid2string(oid_t *oid, size_t offset,
+ char *key) {
+ size_t key_len = oid->oid[offset];
+ size_t i;
for (i = 0; i < key_len && offset < oid->oid_len; i++)
key[i] = oid->oid[++offset];
}
static int snmp_agent_generate_string2oid(oid_t *oid, const char *key) {
- int key_len = strlen(key);
+ size_t key_len = strlen(key);
oid->oid[oid->oid_len++] = key_len;
- for (int i = 0; i < key_len; i++) {
+ for (size_t i = 0; i < key_len; i++) {
oid->oid[oid->oid_len++] = key[i];
if (oid->oid_len >= MAX_OID_LEN) {
ERROR(PLUGIN_NAME ": Conversion key string %s to OID failed", key);
for (llentry_t *de = llist_head(td->columns); de != NULL; de = de->next) {
data_definition_t *dd = de->value;
- for (int i = 0; i < dd->oids_len; i++)
+ for (size_t i = 0; i < dd->oids_len; i++)
if (td->index_oid.oid_len)
snmp_agent_unregister_oid_index(&dd->oids[i], *index);
else
.severity = NOTIF_WARNING, .time = cdtime(), .plugin = PLUGIN_NAME};
sstrncpy(n.host, hostname_g, sizeof(n.host));
sstrncpy(n.plugin_instance, ins, sizeof(n.plugin_instance));
- ssnprintf(n.message, sizeof(n.message),
- "Removed data row from table %s instance %s index %d", td->name,
- ins, (index != NULL) ? *index : -1);
+ snprintf(n.message, sizeof(n.message),
+ "Removed data row from table %s instance %s index %d", td->name, ins,
+ (index != NULL) ? *index : -1);
plugin_dispatch_notification(&n);
if (td->index_oid.oid_len) {
/* unregister scalar type OID */
if ((*dd)->table == NULL) {
- for (int i = 0; i < (*dd)->oids_len; i++)
+ for (size_t i = 0; i < (*dd)->oids_len; i++)
unregister_mib((*dd)->oids[i].oid, (*dd)->oids[i].oid_len);
}
- if (!(*dd)->table->index_oid.oid_len) {
- char *instance;
-
- c_avl_iterator_t *iter = c_avl_get_iterator((*dd)->table->instance_index);
- while (c_avl_iterator_next(iter, (void *)&instance, (void *)&instance) ==
- 0) {
- for (int i = 0; i < (*dd)->oids_len; i++)
- snmp_agent_unregister_oid_string(&(*dd)->oids[i], instance);
- }
- c_avl_iterator_destroy(iter);
- } else {
- /* unregister all table OIDs */
- int *index;
- char *value;
-
- c_avl_iterator_t *iter = c_avl_get_iterator((*dd)->table->index_instance);
- while (c_avl_iterator_next(iter, (void *)&index, (void *)&value) == 0) {
- for (int i = 0; i < (*dd)->oids_len; i++)
- snmp_agent_unregister_oid_index(&(*dd)->oids[i], *index);
- }
- c_avl_iterator_destroy(iter);
- }
sfree((*dd)->name);
sfree((*dd)->plugin);
return;
}
+static void snmp_agent_free_table_columns(table_definition_t *td) {
+ if (td->columns == NULL)
+ return;
+
+ for (llentry_t *de = llist_head(td->columns); de != NULL; de = de->next) {
+ data_definition_t *dd = de->value;
+
+ if (td->index_oid.oid_len) {
+ int *index;
+ char *instance;
+
+ c_avl_iterator_t *iter = c_avl_get_iterator(td->index_instance);
+ while (c_avl_iterator_next(iter, (void *)&index, (void *)&instance) ==
+ 0) {
+ for (size_t i = 0; i < dd->oids_len; i++)
+ snmp_agent_unregister_oid_index(&dd->oids[i], *index);
+ }
+ c_avl_iterator_destroy(iter);
+ } else {
+ char *instance;
+
+ c_avl_iterator_t *iter = c_avl_get_iterator(dd->table->instance_index);
+ while (c_avl_iterator_next(iter, (void *)&instance, (void *)&instance) ==
+ 0) {
+ for (size_t i = 0; i < dd->oids_len; i++)
+ snmp_agent_unregister_oid_string(&dd->oids[i], instance);
+ }
+ c_avl_iterator_destroy(iter);
+ }
+
+ snmp_agent_free_data(&dd);
+ }
+
+ llist_destroy(td->columns);
+ td->columns = NULL;
+} /* void snmp_agent_free_table_columns */
+
static void snmp_agent_free_table(table_definition_t **td) {
if (td == NULL || *td == NULL)
if ((*td)->size_oid.oid_len)
unregister_mib((*td)->size_oid.oid, (*td)->size_oid.oid_len);
+ /* Unregister Index OIDs */
if ((*td)->index_oid.oid_len) {
int *index;
- char *value;
+ char *instance;
c_avl_iterator_t *iter = c_avl_get_iterator((*td)->index_instance);
- while (c_avl_iterator_next(iter, (void *)&index, (void *)&value) == 0)
+ while (c_avl_iterator_next(iter, (void *)&index, (void *)&instance) == 0)
snmp_agent_unregister_oid_index(&(*td)->index_oid, *index);
c_avl_iterator_destroy(iter);
}
- for (llentry_t *de = llist_head((*td)->columns); de != NULL; de = de->next) {
- data_definition_t *dd = de->value;
- snmp_agent_free_data(&dd);
- }
-
- llist_destroy((*td)->columns);
+ /* Unregister all table columns and their registered OIDs */
+ snmp_agent_free_table_columns(*td);
void *key = NULL;
void *value = NULL;
}
assert(ds->ds_num == values_num);
- assert(oid_index < values_num);
+ assert(oid_index < (int)values_num);
char data[DATA_MAX_NAME_LEN];
size_t data_len = sizeof(data);
for (llentry_t *de = llist_head(td->columns); de != NULL; de = de->next) {
data_definition_t *dd = de->value;
- for (int i = 0; i < dd->oids_len; i++) {
+ for (size_t i = 0; i < dd->oids_len; i++) {
int ret = snmp_oid_ncompare(oid.oid, oid.oid_len, dd->oids[i].oid,
dd->oids[i].oid_len,
- MIN(oid.oid_len, dd->oids[i].oid_len));
+ SNMP_MIN(oid.oid_len, dd->oids[i].oid_len));
if (ret != 0)
continue;
memset(key, 0, sizeof(key));
snmp_agent_generate_oid2string(
- &oid, MIN(oid.oid_len, dd->oids[i].oid_len), key);
+ &oid, SNMP_MIN(oid.oid_len, dd->oids[i].oid_len), key);
ret = c_avl_get(td->instance_index, key, (void **)&instance);
if (ret != 0) {
if (dd->is_instance) {
requests->requestvb->type = ASN_OCTET_STR;
- snmp_set_var_typed_value(requests->requestvb,
- requests->requestvb->type, (const u_char *)instance,
- strlen((instance)));
+ snmp_set_var_typed_value(
+ requests->requestvb, requests->requestvb->type,
+ (const u_char *)instance, strlen((instance)));
pthread_mutex_unlock(&g_agent->lock);
table_definition_t *td = te->value;
if (td->index_oid.oid_len &&
- (snmp_oid_ncompare(oid.oid, oid.oid_len, td->index_oid.oid,
- td->index_oid.oid_len,
- MIN(oid.oid_len, td->index_oid.oid_len)) == 0)) {
+ (snmp_oid_ncompare(
+ oid.oid, oid.oid_len, td->index_oid.oid, td->index_oid.oid_len,
+ SNMP_MIN(oid.oid_len, td->index_oid.oid_len)) == 0)) {
DEBUG(PLUGIN_NAME ": Handle '%s' table index OID", td->name);
if (td->size_oid.oid_len &&
(snmp_oid_ncompare(oid.oid, oid.oid_len, td->size_oid.oid,
td->size_oid.oid_len,
- MIN(oid.oid_len, td->size_oid.oid_len)) == 0)) {
+ SNMP_MIN(oid.oid_len, td->size_oid.oid_len)) == 0)) {
DEBUG(PLUGIN_NAME ": Handle '%s' table size OID", td->name);
long size = c_avl_size(td->index_instance);
- requests->requestvb->type = td->size_oid.type;
+ requests->requestvb->type = ASN_INTEGER;
snmp_set_var_typed_value(requests->requestvb, requests->requestvb->type,
(const u_char *)&size, sizeof(size));
de = de->next) {
data_definition_t *dd = de->value;
- for (int i = 0; i < dd->oids_len; i++) {
+ for (size_t i = 0; i < dd->oids_len; i++) {
int ret = snmp_oid_compare(oid.oid, oid.oid_len, dd->oids[i].oid,
dd->oids[i].oid_len);
for (llentry_t *de = llist_head(td->columns); de != NULL; de = de->next) {
data_definition_t *dd = de->value;
- for (int i = 0; i < dd->oids_len; i++) {
+ for (size_t i = 0; i < dd->oids_len; i++) {
dd->oids[i].type =
snmp_agent_get_asn_type(dd->oids[i].oid, dd->oids[i].oid_len);
}
for (llentry_t *e = llist_head(g_agent->scalars); e != NULL; e = e->next) {
data_definition_t *dd = e->value;
- for (int i = 0; i < dd->oids_len; i++) {
+ for (size_t i = 0; i < dd->oids_len; i++) {
dd->oids[i].type =
snmp_agent_get_asn_type(dd->oids[i].oid, dd->oids[i].oid_len);
return 0;
}
-static int snmp_agent_config_table_data(table_definition_t *td,
- oconfig_item_t *ci) {
+/* This function parses configuration of both scalar and table column
+ * because they have nearly the same structure */
+static int snmp_agent_config_table_column(table_definition_t *td,
+ oconfig_item_t *ci) {
data_definition_t *dd;
int ret = 0;
dd->scale = 1.0;
dd->shift = 0.0;
-
+ /* NULL if it's a scalar */
dd->table = td;
for (int i = 0; i < ci->children_num; i++) {
oconfig_item_t *option = ci->children + i;
- if (strcasecmp("Instance", option->key) == 0)
+ /* Instance option is reserved for table entry only */
+ if (strcasecmp("Instance", option->key) == 0 && td != NULL)
ret = cf_util_get_boolean(option, &dd->is_instance);
else if (strcasecmp("Plugin", option->key) == 0)
ret = cf_util_get_string(option, &dd->plugin);
return -ENOMEM;
}
- llist_append(td->columns, entry);
+ /* Append to column list in parent table */
+ if (td != NULL)
+ llist_append(td->columns, entry);
return 0;
}
-static int snmp_agent_config_data(oconfig_item_t *ci) {
- data_definition_t *dd;
- int ret = 0;
-
- assert(ci != NULL);
-
- dd = calloc(1, sizeof(*dd));
- if (dd == NULL) {
- ERROR(PLUGIN_NAME ": Failed to allocate memory for data definition");
- return -ENOMEM;
- }
-
- ret = cf_util_get_string(ci, &dd->name);
- if (ret != 0) {
- free(dd);
- return -1;
- }
-
- dd->scale = 1.0;
- dd->shift = 0.0;
-
- for (int i = 0; i < ci->children_num; i++) {
- oconfig_item_t *option = ci->children + i;
-
- if (strcasecmp("Instance", option->key) == 0)
- ret = cf_util_get_boolean(option, &dd->is_instance);
- else if (strcasecmp("Plugin", option->key) == 0)
- ret = cf_util_get_string(option, &dd->plugin);
- else if (strcasecmp("PluginInstance", option->key) == 0)
- ret = cf_util_get_string(option, &dd->plugin_instance);
- else if (strcasecmp("Type", option->key) == 0)
- ret = cf_util_get_string(option, &dd->type);
- else if (strcasecmp("TypeInstance", option->key) == 0)
- ret = cf_util_get_string(option, &dd->type_instance);
- else if (strcasecmp("Shift", option->key) == 0)
- ret = cf_util_get_double(option, &dd->shift);
- else if (strcasecmp("Scale", option->key) == 0)
- ret = cf_util_get_double(option, &dd->scale);
- else if (strcasecmp("OIDs", option->key) == 0)
- ret = snmp_agent_config_data_oids(dd, option);
- else {
- WARNING(PLUGIN_NAME ": Option `%s' not allowed here", option->key);
- ret = -1;
- }
-
- if (ret != 0) {
- snmp_agent_free_data(&dd);
- return -1;
- }
- }
-
- llentry_t *entry = llentry_create(dd->name, dd);
- if (entry == NULL) {
- snmp_agent_free_data(&dd);
- return -ENOMEM;
- }
-
- llist_append(g_agent->scalars, entry);
-
- return 0;
+/* Parses scalar configuration entry */
+static int snmp_agent_config_scalar(oconfig_item_t *ci) {
+ return snmp_agent_config_table_column(NULL, ci);
}
static int num_compare(const int *a, const int *b) {
else if (strcasecmp("SizeOID", option->key) == 0)
ret = snmp_agent_config_table_size_oid(td, option);
else if (strcasecmp("Data", option->key) == 0)
- ret = snmp_agent_config_table_data(td, option);
+ ret = snmp_agent_config_table_column(td, option);
else {
WARNING(PLUGIN_NAME ": Option `%s' not allowed here", option->key);
ret = -1;
}
}
- llentry_t *entry = llentry_create(td->name, td);
- if (entry == NULL) {
- snmp_agent_free_table(&td);
- return -ENOMEM;
- }
-
td->instance_index =
c_avl_create((int (*)(const void *, const void *))strcmp);
if (td->instance_index == NULL) {
return -ENOMEM;
}
+ llentry_t *entry = llentry_create(td->name, td);
+ if (entry == NULL) {
+ snmp_agent_free_table(&td);
+ return -ENOMEM;
+ }
llist_append(g_agent->tables, entry);
return 0;
for (llentry_t *de = llist_head(td->columns); de != NULL; de = de->next) {
data_definition_t *dd = de->value;
- for (int i = 0; i < dd->oids_len; i++) {
+ for (size_t i = 0; i < dd->oids_len; i++) {
if (td->index_oid.oid_len) {
ret = snmp_agent_register_oid_index(&dd->oids[i], *index,
snmp_agent_table_oid_handler);
.severity = NOTIF_OKAY, .time = cdtime(), .plugin = PLUGIN_NAME};
sstrncpy(n.host, hostname_g, sizeof(n.host));
sstrncpy(n.plugin_instance, ins, sizeof(n.plugin_instance));
- ssnprintf(n.message, sizeof(n.message),
- "Data row added to table %s instance %s index %d", td->name, ins,
- (index != NULL) ? *index : -1);
+ snprintf(n.message, sizeof(n.message),
+ "Data row added to table %s instance %s index %d", td->name, ins,
+ (index != NULL) ? *index : -1);
plugin_dispatch_notification(&n);
return 0;
}
static int snmp_agent_preinit(void) {
- if (g_agent != NULL) {
- /* already initialized if config callback was called before init callback */
- return 0;
- }
g_agent = calloc(1, sizeof(*g_agent));
if (g_agent == NULL) {
g_agent->tables = llist_create();
g_agent->scalars = llist_create();
+ if (g_agent->tables == NULL || g_agent->scalars == NULL) {
+ ERROR(PLUGIN_NAME ": llist_create() failed");
+ llist_destroy(g_agent->scalars);
+ llist_destroy(g_agent->tables);
+ return -ENOMEM;
+ }
+
int err;
- /* make us a agentx client. */
+ /* make us an agentx client. */
err = netsnmp_ds_set_boolean(NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_AGENT_ROLE,
1);
if (err != 0) {
ERROR(PLUGIN_NAME ": Failed to set agent role (%d)", err);
+ llist_destroy(g_agent->scalars);
+ llist_destroy(g_agent->tables);
return -1;
}
err = init_agent(PLUGIN_NAME);
if (err != 0) {
ERROR(PLUGIN_NAME ": Failed to initialize the agent library (%d)", err);
+ llist_destroy(g_agent->scalars);
+ llist_destroy(g_agent->tables);
return -1;
}
static int snmp_agent_init(void) {
int ret;
- ret = snmp_agent_preinit();
- if (ret != 0)
- return ret;
+ if (g_agent == NULL || ((llist_head(g_agent->scalars) == NULL) &&
+ (llist_head(g_agent->tables) == NULL))) {
+ ERROR(PLUGIN_NAME ": snmp_agent_init: plugin not configured");
+ return -EINVAL;
+ }
+
+ plugin_register_shutdown(PLUGIN_NAME, snmp_agent_shutdown);
ret = snmp_agent_register_scalar_oids();
if (ret != 0)
if (ret != 0)
return ret;
- /* create a second thread to listen for requests from AgentX*/
- ret = pthread_create(&g_agent->thread, NULL, &snmp_agent_thread_run, NULL);
- if (ret != 0) {
- ERROR(PLUGIN_NAME ": Failed to create a separate thread, err %u", ret);
- return ret;
- }
-
ret = pthread_mutex_init(&g_agent->lock, NULL);
if (ret != 0) {
ERROR(PLUGIN_NAME ": Failed to initialize mutex, err %u", ret);
return ret;
}
+ /* create a second thread to listen for requests from AgentX*/
+ ret = pthread_create(&g_agent->thread, NULL, &snmp_agent_thread_run, NULL);
+ if (ret != 0) {
+ ERROR(PLUGIN_NAME ": Failed to create a separate thread, err %u", ret);
+ return ret;
+ }
+
+ if (llist_head(g_agent->tables) != NULL) {
+ plugin_register_write(PLUGIN_NAME, snmp_agent_collect, NULL);
+ plugin_register_missing(PLUGIN_NAME, snmp_agent_clear_missing, NULL);
+ }
+
return 0;
}
for (int i = 0; i < ci->children_num; i++) {
oconfig_item_t *child = ci->children + i;
if (strcasecmp("Data", child->key) == 0) {
- ret = snmp_agent_config_data(child);
+ ret = snmp_agent_config_scalar(child);
} else if (strcasecmp("Table", child->key) == 0) {
ret = snmp_agent_config_table(child);
} else {
}
}
- ret = snmp_agent_validate_data();
+ ret = snmp_agent_validate_config();
if (ret != 0) {
ERROR(PLUGIN_NAME ": Invalid configuration provided");
snmp_agent_free_config();
void module_register(void) {
plugin_register_init(PLUGIN_NAME, snmp_agent_init);
plugin_register_complex_config(PLUGIN_NAME, snmp_agent_config);
- plugin_register_write(PLUGIN_NAME, snmp_agent_collect, NULL);
- plugin_register_missing(PLUGIN_NAME, snmp_agent_clear_missing, NULL);
- plugin_register_shutdown(PLUGIN_NAME, snmp_agent_shutdown);
}