pkglib_LTLIBRARIES += amqp.la
amqp_la_SOURCES = amqp.c \
utils_cmd_putval.c utils_cmd_putval.h \
+ utils_parse_option.c utils_parse_option.h \
utils_format_graphite.c utils_format_graphite.h \
utils_format_json.c utils_format_json.h
amqp_la_LDFLAGS = $(PLUGIN_LDFLAGS) $(BUILD_WITH_LIBRABBITMQ_LDFLAGS)
if ((hostname == NULL) || strcasecmp (hostname, ret_ident[i].host))
{
- if (hostname != NULL)
- free (hostname);
+ free (hostname);
hostname = strdup (ret_ident[i].host);
printf ("Host: %s\n", hostname);
}
printf ("ERROR: listval: Failed to convert returned "
"identifier to a string: %s\n",
lcc_strerror (connection));
+ free (hostname);
+ hostname = NULL;
continue;
}
printf ("\t%s\n", id + 1);
}
- if (ret_ident != NULL)
- free (ret_ident);
+ free (ret_ident);
+ free (hostname);
return (RET_OKAY);
} /* int do_listval */
=head2 Plugin C<amqp>
-The I<AMQMP plugin> can be used to communicate with other instances of
+The I<AMQP plugin> can be used to communicate with other instances of
I<collectd> or third party applications using an AMQP message broker. Values
are sent to or received from the broker, which handles routing, queueing and
possibly filtering out messages.
means to concatenate the guest name and UUID (with a literal colon character
between, thus I<"foo:1234-1234-1234-1234">).
+At the moment of writing (collectd-5.5), hostname string is limited to 62
+characters. In case when combination of fields exceeds 62 characters,
+hostname will be truncated without a warning.
+
=item B<InterfaceFormat> B<name>|B<address>
When the virt plugin logs interface data, it sets the name of the collected
while ((dirlen > 0) && (dir[dirlen - 1] == '/'))
dir[--dirlen] = '\0';
- if (dirlen <= 0)
+ if (dirlen <= 0) {
+ free (dir);
return (-1);
+ }
status = chdir (dir);
if (status == 0)
return (-1);
/* Now replace the i'th child in `root' with `new'. */
- if (cf_ci_replace_child (root, new, i) < 0)
+ if (cf_ci_replace_child (root, new, i) < 0) {
+ sfree (new->values);
+ sfree (new);
return (-1);
+ }
/* ... and go back to the new i'th child. */
--i;
rf->rf_interval = plugin_get_interval ();
status = plugin_insert_read (rf);
- if (status != 0)
+ if (status != 0) {
+ sfree (rf->rf_name);
sfree (rf);
+ }
return (status);
} /* int plugin_register_read */
rf->rf_ctx = plugin_get_ctx ();
status = plugin_insert_read (rf);
- if (status != 0)
+ if (status != 0) {
+ sfree (rf->rf_name);
sfree (rf);
+ }
return (status);
} /* int plugin_register_complex_read */
return_status = -1;
}
+ sfree (rf->rf_name);
destroy_callback ((void *) rf);
}
/* This shouldn't happen. */
ERROR ("uc_insert: Don't know how to handle data source type %i.",
ds->ds[i].type);
+ sfree (key_copy);
return (-1);
} /* switch (ds->ds[i].type) */
} /* for (i) */
}
} /* while (mc_receive_thread_loop != 0) */
+ free (mc_receive_socket_entries);
return ((void *) 0);
} /* }}} void *mc_receive_thread */
char errbuf[1024];
ERROR ("realloc failed: %s",
sstrerror (errno, errbuf, sizeof (errbuf)));
+ sfree (temp.rule.comment);
return (1);
}
char errbuf[1024];
ERROR ("malloc failed: %s",
sstrerror (errno, errbuf, sizeof (errbuf)));
+ sfree (temp.rule.comment);
return (1);
}
memcpy (final, &temp, sizeof (temp));
*/
%{
-/* lex and yacc do some weird stuff, so turn off some warnings. */
-#if defined(__clang__)
-# pragma clang diagnostic ignored "-Wunused-function"
-# pragma clang diagnostic ignored "-Wunneeded-internal-declaration"
-#endif
-
#include <stdlib.h>
#include "oconfig.h"
#include "aux_types.h"
%}
%option yylineno
%option noyywrap
+%option noinput
+%option nounput
%x ML
WHITE_SPACE [\ \t\b]
NON_WHITE_SPACE [^\ \t\b]
sfree (st->socket);
sfree (st->host);
sfree (st->port);
+ sfree (st);
}
static int memcached_connect_unix (memcached_t *st)
* polynomial $edb88320
*/
-#include <sys/types.h>
+#include <stdint.h>
+#include <stddef.h>
-u_int32_t crc32_buffer(const u_char *, size_t);
+uint32_t crc32_buffer(const unsigned char *, size_t);
static unsigned int crc32_tab[] = {
0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, 0x076dc419L,
0x706af48fL, 0xe963a535L, 0x9e6495a3L, 0x0edb8832L, 0x79dcb8a4L,
/* Return a 32-bit CRC of the contents of the buffer. */
-u_int32_t
-crc32_buffer(const u_char *s, size_t len)
+uint32_t
+crc32_buffer(const unsigned char *s, size_t len)
{
size_t i;
- u_int32_t ret;
+ uint32_t ret;
ret = 0;
for (i = 0; i < len; i++)
#ifndef UTILS_CRC32_H
#define UTILS_CRC32_H 1
-u_int32_t crc32_buffer(const u_char *, size_t);
+uint32_t crc32_buffer(const unsigned char *, size_t);
#endif
#include "utils_format_json.h"
#include "utils_crc32.h"
-#include <sys/types.h>
+#include <stdint.h>
#include <librdkafka/rdkafka.h>
#include <pthread.h>
#include <zlib.h>
#define KAFKA_FORMAT_JSON 0
#define KAFKA_FORMAT_COMMAND 1
#define KAFKA_FORMAT_GRAPHITE 2
- u_int8_t format;
+ uint8_t format;
unsigned int graphite_flags;
_Bool store_rates;
rd_kafka_topic_conf_t *conf;
rd_kafka_conf_t *kafka_conf;
rd_kafka_t *kafka;
int has_key;
- u_int32_t key;
+ uint32_t key;
char *prefix;
char *postfix;
char escape_char;
const void *keydata, size_t keylen,
int32_t partition_cnt, void *p, void *m)
{
- u_int32_t key = *((u_int32_t *)keydata );
- u_int32_t target = key % partition_cnt;
+ uint32_t key = *((uint32_t *)keydata );
+ uint32_t target = key % partition_cnt;
int32_t i = partition_cnt;
while (--i > 0 && !rd_kafka_topic_partition_available(rkt, target)) {
user_data_t *ud)
{
int status = 0;
- u_int32_t key;
+ uint32_t key;
char buffer[8192];
size_t bfree = sizeof(buffer);
size_t bfill = 0;