- char errbuf[1024]; \
- ERROR("powerdns plugin: %s failed: %s", func, \
- sstrerror(errno, errbuf, sizeof(errbuf))); \
+ ERROR("powerdns plugin: %s failed: %s", func, STRERRNO); \
ERROR("powerdns plugin: Socket `%s` %s failed: %s", sockpath, func, \
ERROR("powerdns plugin: Socket `%s` %s failed: %s", sockpath, func, \
{"ipv6-questions", "dns_question", "incoming-ipv6"},
{"malloc-bytes", "gauge", "malloc_bytes"},
{"max-mthread-stack", "gauge", "max_mthread_stack"},
{"ipv6-questions", "dns_question", "incoming-ipv6"},
{"malloc-bytes", "gauge", "malloc_bytes"},
{"max-mthread-stack", "gauge", "max_mthread_stack"},
- {"no-packet-error", "gauge", "no_packet_error"},
+ {"no-packet-error", "errors", "no_packet_error"},
{"noedns-outqueries", "dns_question", "outgoing-noedns"},
{"noping-outqueries", "dns_question", "outgoing-noping"},
{"over-capacity-drops", "dns_question", "incoming-over_capacity"},
{"noedns-outqueries", "dns_question", "outgoing-noedns"},
{"noping-outqueries", "dns_question", "outgoing-noping"},
{"over-capacity-drops", "dns_question", "incoming-over_capacity"},
{"uptime", "uptime", NULL}}; /* }}} */
static int lookup_table_length = STATIC_ARRAY_SIZE(lookup_table);
{"uptime", "uptime", NULL}}; /* }}} */
static int lookup_table_length = STATIC_ARRAY_SIZE(lookup_table);
"but I can only handle one.",
type, ds->ds_num);
return;
}
if (0 != parse_value(value_str, &value, ds->ds[0].type)) {
"but I can only handle one.",
type, ds->ds_num);
return;
}
if (0 != parse_value(value_str, &value, ds->ds[0].type)) {
-static int powerdns_get_data_dgram(list_item_t *item, /* {{{ */
- char **ret_buffer, size_t *ret_buffer_size) {
+static int powerdns_get_data_dgram(list_item_t *item, char **ret_buffer) {
+ /* {{{ */
if ((status != 0) && (errno != ENOENT)) {
SOCK_ERROR("unlink", sa_unix.sun_path);
close(sd);
if ((status != 0) && (errno != ENOENT)) {
SOCK_ERROR("unlink", sa_unix.sun_path);
close(sd);
buffer_new = realloc(buffer, buffer_size + status + 1);
if (buffer_new == NULL) {
FUNC_ERROR("realloc");
buffer_new = realloc(buffer, buffer_size + status + 1);
if (buffer_new == NULL) {
FUNC_ERROR("realloc");
-static int powerdns_get_data(list_item_t *item, char **ret_buffer,
- size_t *ret_buffer_size) {
+static int powerdns_get_data(list_item_t *item, char **ret_buffer) {
item->command = strdup(SERVER_COMMAND);
if (item->command == NULL) {
ERROR("powerdns plugin: strdup failed.");
item->command = strdup(SERVER_COMMAND);
if (item->command == NULL) {
ERROR("powerdns plugin: strdup failed.");
- size_t buffer_size = 0;
- int status = powerdns_get_data(item, &buffer, &buffer_size);
- if (status != 0)
- return (-1);
- if ((buffer == NULL) || (buffer_size == 0)) {
+ int status = powerdns_get_data(item, &buffer);
+ if (status != 0) {
+ ERROR("powerdns plugin: powerdns_get_data failed.");
+ return status;
+ }
+ if (buffer == NULL) {
if (li->fields_num < 1) {
sstrncpy(buffer, RECURSOR_COMMAND, sizeof(buffer));
if (li->fields_num < 1) {
sstrncpy(buffer, RECURSOR_COMMAND, sizeof(buffer));
li->command = strdup(buffer);
if (li->command == NULL) {
ERROR("powerdns plugin: strdup failed.");
li->command = strdup(buffer);
if (li->command == NULL) {
ERROR("powerdns plugin: strdup failed.");
} /* }}} int powerdns_update_recursor_command */
static int powerdns_read_recursor(list_item_t *item) /* {{{ */
{
char *buffer = NULL;
} /* }}} int powerdns_update_recursor_command */
static int powerdns_read_recursor(list_item_t *item) /* {{{ */
{
char *buffer = NULL;
status = powerdns_update_recursor_command(item);
if (status != 0) {
ERROR("powerdns plugin: powerdns_update_recursor_command failed.");
status = powerdns_update_recursor_command(item);
if (status != 0) {
ERROR("powerdns plugin: powerdns_update_recursor_command failed.");
} /* }}} int powerdns_read_recursor */
static int powerdns_config_add_collect(list_item_t *li, /* {{{ */
} /* }}} int powerdns_read_recursor */
static int powerdns_config_add_collect(list_item_t *li, /* {{{ */
if (ci->values_num < 1) {
WARNING("powerdns plugin: The `Collect' option needs "
"at least one argument.");
if (ci->values_num < 1) {
WARNING("powerdns plugin: The `Collect' option needs "
"at least one argument.");
}
for (int i = 0; i < ci->values_num; i++)
if (ci->values[i].type != OCONFIG_TYPE_STRING) {
WARNING("powerdns plugin: Only string arguments are allowed to "
"the `Collect' option.");
}
for (int i = 0; i < ci->values_num; i++)
if (ci->values[i].type != OCONFIG_TYPE_STRING) {
WARNING("powerdns plugin: Only string arguments are allowed to "
"the `Collect' option.");
}
temp =
realloc(li->fields, sizeof(char *) * (li->fields_num + ci->values_num));
if (temp == NULL) {
WARNING("powerdns plugin: realloc failed.");
}
temp =
realloc(li->fields, sizeof(char *) * (li->fields_num + ci->values_num));
if (temp == NULL) {
WARNING("powerdns plugin: realloc failed.");
} /* }}} int powerdns_config_add_collect */
static int powerdns_config_add_server(oconfig_item_t *ci) /* {{{ */
} /* }}} int powerdns_config_add_collect */
static int powerdns_config_add_server(oconfig_item_t *ci) /* {{{ */
if ((ci->values_num != 1) || (ci->values[0].type != OCONFIG_TYPE_STRING)) {
WARNING("powerdns plugin: `%s' needs exactly one string argument.",
ci->key);
if ((ci->values_num != 1) || (ci->values[0].type != OCONFIG_TYPE_STRING)) {
WARNING("powerdns plugin: `%s' needs exactly one string argument.",
ci->key);
}
item = calloc(1, sizeof(*item));
if (item == NULL) {
ERROR("powerdns plugin: calloc failed.");
}
item = calloc(1, sizeof(*item));
if (item == NULL) {
ERROR("powerdns plugin: calloc failed.");
}
item->instance = strdup(ci->values[0].value.string);
if (item->instance == NULL) {
ERROR("powerdns plugin: strdup failed.");
sfree(item);
}
item->instance = strdup(ci->values[0].value.string);
if (item->instance == NULL) {
ERROR("powerdns plugin: strdup failed.");
sfree(item);
for (llentry_t *e = llist_head(list); e != NULL; e = e->next) {
list_item_t *item = (list_item_t *)e->value;
for (llentry_t *e = llist_head(list); e != NULL; e = e->next) {
list_item_t *item = (list_item_t *)e->value;
plugin_register_read("powerdns", powerdns_read);
plugin_register_shutdown("powerdns", powerdns_shutdown);
} /* void module_register */
plugin_register_read("powerdns", powerdns_read);
plugin_register_shutdown("powerdns", powerdns_shutdown);
} /* void module_register */