%{?el7:%global _has_atasmart 1}
%{?el7:%global _has_hiredis 1}
%{?el7:%global _has_asm_msr_index 1}
+%{?el7:%global _has_libmosquitto 1}
# plugins enabled by default
%define with_aggregation 0%{!?_without_aggregation:1}
%define with_memory 0%{!?_without_memory:1}
%define with_multimeter 0%{!?_without_multimeter:1}
%define with_modbus 0%{!?_without_modbus:0%{?_has_libmodbus}}
+%define with_mqtt 0%{!?_without_mqtt:0%{?_has_libmosquitto}}
%define with_mysql 0%{!?_without_mysql:1}
%define with_netlink 0%{!?_without_netlink:0%{?_has_iproute}}
%define with_network 0%{!?_without_network:1}
handlers and database traffic.
%endif
+%if %{with_mqtt}
+%package mqtt
+Summary: mqtt plugin for collectd
+Group: System Environment/Daemons
+Requires: %{name}%{?_isa} = %{version}-%{release}
+BuildRequires: mosquitto-devel
+%description mqtt
+The MQTT plugin publishes and subscribes to MQTT topics.
+%endif
+
%if %{with_netlink}
%package netlink
Summary: netlink plugin for collectd
%define _with_multimeter --disable-multimeter
%endif
+%if %{with_mqtt}
+%define _with_mqtt --enable-mqtt
+%else
+%define _with_mqtt --disable-mqtt
+%endif
+
%if %{with_mysql}
%define _with_mysql --enable-mysql
%else
%{?_with_mic} \
%{?_with_modbus} \
%{?_with_multimeter} \
+ %{?_with_mqtt} \
%{?_with_mysql} \
%{?_with_netapp} \
%{?_with_netlink} \
%{_libdir}/%{name}/modbus.so
%endif
+%if %{with_mqtt}
+%files mqtt
+%{_libdir}/%{name}/mqtt.so
+%endif
+
%if %{with_mysql}
%files mysql
%{_libdir}/%{name}/mysql.so
%changelog
#* TODO: next feature release changelog
#- New upstream version
+#- New plugins enabled by default: mqtt
#- New plugins disabled by default: zone
#
* Wed May 27 2015 Marc Fournier <marc.fournier@camptocamp.com> 5.5.0-1
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
Values are submitted to I<Sorted Sets>, using the metric name as the key, and
the timestamp as the score. Retrieving a date range can then be done using the
-C<ZRANGEBYSCORE> I<Redis> command. Additionnally, all the identifiers of these
+C<ZRANGEBYSCORE> I<Redis> command. Additionally, all the identifiers of these
I<Sorted Sets> are kept in a I<Set> called C<collectd/values> (or
C<${prefix}/values> if the B<Prefix> option was specified) and can be retrieved
using the C<SMEMBERS> I<Redis> command. You can specify the database to use
=item B<Node> I<Nodename>
The B<Node> block identifies a new I<Redis> node, that is a new I<Redis>
-instance running in an specified host and port. The name for node is a
+instance running on a specified host and port. The node name is a
canonical identifier which is used as I<plugin instance>. It is limited to
-64E<nbsp>characters in length.
+51E<nbsp>characters in length.
=item B<Host> I<Hostname>
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;