#include "collectd.h"
-#include "common.h"
#include "plugin.h"
+#include "utils/common/common.h"
+#include "utils/ignorelist/ignorelist.h"
#include "utils_complain.h"
-#include "utils_ignorelist.h"
#include <net-snmp/net-snmp-config.h>
#include <net-snmp/net-snmp-includes.h>
char *oid_str_ptr[MAX_OID_LEN];
for (size_t i = 0; i < o->oid_len; i++) {
- snprintf(oid_str[i], sizeof(oid_str[i]), "%lu", (unsigned long)o->oid[i]);
+ ssnprintf(oid_str[i], sizeof(oid_str[i]), "%lu", (unsigned long)o->oid[i]);
oid_str_ptr[i] = oid_str[i];
}
"= %i }",
hd->name, hd->address, hd->community, hd->version);
- snprintf(cb_name, sizeof(cb_name), "snmp-%s", hd->name);
+ ssnprintf(cb_name, sizeof(cb_name), "snmp-%s", hd->name);
status = plugin_register_complex_read(
/* group = */ NULL, cb_name, csnmp_read_host, interval,
for (size_t i = 0; i < vb->val_len; i++) {
int status;
- status = snprintf(buffer_ptr, buffer_free, (i == 0) ? "%02x" : ":%02x",
+ status = ssnprintf(buffer_ptr, buffer_free, (i == 0) ? "%02x" : ":%02x",
(unsigned int)vb->val.bitstring[i]);
assert(status >= 0);
if (((size_t)status) >= buffer_free) /* truncated */
{
- dst[dst_size - 1] = 0;
+ dst[dst_size - 1] = '\0';
return ENOMEM;
} else /* if (status < buffer_free) */
{
else if (vb->type == ASN_BIT_STR)
src = (char *)vb->val.bitstring;
else if (vb->type == ASN_IPADDRESS) {
- return snprintf(dst, dst_size,
+ return ssnprintf(dst, dst_size,
"%" PRIu8 ".%" PRIu8 ".%" PRIu8 ".%" PRIu8 "",
(uint8_t)vb->val.string[0], (uint8_t)vb->val.string[1],
(uint8_t)vb->val.string[2], (uint8_t)vb->val.string[3]);
dst[i] = src[i];
}
dst[num_chars] = 0;
- dst[dst_size - 1] = 0;
+ dst[dst_size - 1] = '\0';
if (dst_size <= vb->val_len)
return ENOMEM;
value_t val = csnmp_value_list_to_value(
vb, DS_TYPE_COUNTER,
/* scale = */ 1.0, /* shift = */ 0.0, hd->name, dd->name);
- snprintf(il->value, sizeof(il->value), "%" PRIu64, (uint64_t)val.counter);
+ ssnprintf(il->value, sizeof(il->value), "%" PRIu64, (uint64_t)val.counter);
}
return il;
if (data->host.prefix == NULL)
sstrncpy(vl.host, temp, sizeof(vl.host));
else
- snprintf(vl.host, sizeof(vl.host), "%s%s", data->host.prefix, temp);
+ ssnprintf(vl.host, sizeof(vl.host), "%s%s", data->host.prefix, temp);
} else {
sstrncpy(vl.host, host->name, sizeof(vl.host));
}
if (data->type_instance.prefix == NULL)
sstrncpy(vl.type_instance, temp, sizeof(vl.type_instance));
else
- snprintf(vl.type_instance, sizeof(vl.type_instance), "%s%s",
+ ssnprintf(vl.type_instance, sizeof(vl.type_instance), "%s%s",
data->type_instance.prefix, temp);
} else if (data->type_instance.value) {
sstrncpy(vl.type_instance, data->type_instance.value,
if (data->plugin_instance.prefix == NULL)
sstrncpy(vl.plugin_instance, temp, sizeof(vl.plugin_instance));
else
- snprintf(vl.plugin_instance, sizeof(vl.plugin_instance), "%s%s",
+ ssnprintf(vl.plugin_instance, sizeof(vl.plugin_instance), "%s%s",
data->plugin_instance.prefix, temp);
} else if (data->plugin_instance.value) {
sstrncpy(vl.plugin_instance, data->plugin_instance.value,
value_cell_ptr[0] = value_cell_ptr[0]->next;
} /* while (have_more) */
- return (0);
+ return 0;
} /* int csnmp_dispatch_table */
static int csnmp_read_table(host_definition_t *host, data_definition_t *data) {