Fixes Github issue #220.
+2013-01-27, Version 5.2.1
+ * Build system: "make distcheck" has been fixed. Build fixes Solaris
+ and systems without gcrypt. Thanks to Yves Mettier for his patches.
+ * collectd: The complaint mechanism was fixed. It reported messages
+ more frequently than intended.
+ * collectd-tg: A manual page has been added.
+ * dns plugin: Build issues on FreeBSD have been fixed. Thanks to
+ Ed Schouten for his patch.
+ * ethstat plugin: Fix the "Map" config option. An incorrectly used
+ character pointer may lead to a segmentation fault.
+ * network plugin: Build issues on FreeBSD have been fixed. Thanks to
+ Ed Schouten for his patch.
+ * postgresql plugin: A memory leak in the writing code has been fixed.
+ A use-after-free issue that happened when more than one database was
+ configured was fixed. Thanks to Sebastian Harl for fixing these
+ problems.
+ * redis plugin: A build failure has been fixed. Thanks to Pierre-Yves
+ Ritschard for his patch.
+ * varnish plugin: Fix a problem with instances without name.
+ * write_graphite plugin: A regression which rendered the
+ "SeparateInstances" and "AlwaysAppendDS" options unusable has been
+ fixed. A failed assertion when using types with many data sources
+ has been fixed. Improve reporting of connection errors to not spam
+ log files too much. Thanks to Pierre-Yves Ritschard for reporting
+ the logging problem.
+ * zfs_arc plugin: Fix the type used for mutex misses. Thanks to Yves
+ Mettier for reporting this bug.
+
2012-11-17, Version 5.2.0
* collectd: The performance of the LISTVAL command has been improved.
Thanks to Yves Mettier for the patch.
* tcpconns plugin: Use a netlink socket rather than reading from /proc
for improved performance. Thanks to Michael Stapelberg for the patch.
+2013-01-25, Version 5.1.2
+ * Build system: "make distcheck" has been fixed. Thanks to Yves
+ Mettier for his patches.
+ * collectd: The complaint mechanism was fixed. It reported messages
+ more frequently than intended.
+ * dns plugin: Build issues on FreeBSD have been fixed. Thanks to
+ Ed Schouten for his patch.
+ * ethstat plugin: Fix the "Map" config option. An incorrectly used
+ character pointer may lead to a segmentation fault.
+ * network plugin: Build issues on FreeBSD have been fixed. Thanks to
+ Ed Schouten for his patch.
+ * varnish plugin: Fix a problem with instances without name.
+ * write_graphite: Improve reporting of connection errors to not spam
+ log files too much. Thanks to Pierre-Yves Ritschard for reporting
+ this problem.
+ * zfs_arc plugin: Fix the type used for mutex misses. Thanks to Yves
+ Mettier for reporting this bug.
+
2012-11-11, Version 5.1.1
* collectd: Create new directories with mode 0777 and let umask remove
unwanted permission bits.
write your own plugins in Perl and return arbitrary values using this
API. See collectd-perl(5).
+ - pf
+ Query statistics from BSD's packet filter "pf".
+
- pinba
Receive and dispatch timing values from Pinba, a profiling extension for
PHP.
* Miscellaneous plugins:
+ - aggregation
+ Selects multiple value lists based on patterns or regular expressions
+ and creates new aggregated values lists from those.
+
- threshold
Checks values against configured thresholds and creates notifications if
values are out of bounds. See collectd-threshold(5) for details.
endif
EXTRA_DIST = perl/Makefile.PL \
+ perl/uninstall_mod.pl \
perl/lib/Collectd.pm \
perl/lib/Collectd/Unixsock.pm \
perl/lib/Collectd/Plugins/Monitorus.pm \
# Perl 'make uninstall' does not work as well as wanted.
# So we do the work here.
uninstall-local:
- rm -f $(DESTDIR)$(mandir)/man3/Collectd::Unixsock.3pm
- rm -f $(DESTDIR)$(datarootdir)/perl5/Collectd.pm
- rm -f $(DESTDIR)$(datarootdir)/perl5/Collectd/Plugins/OpenVZ.pm
- rm -f $(DESTDIR)$(datarootdir)/perl5/Collectd/Unixsock.pm
- rm -f $(DESTDIR)$(prefix)/lib64/perl5/perllocal.pod
- rm -f $(DESTDIR)$(prefix)/lib64/perl5/auto/Collectd/.packlist
+ @PERL@ -I$(DESTDIR)$(prefix) $(srcdir)/perl/uninstall_mod.pl Collectd
+ find $(DESTDIR)$(prefix) -name "perllocal.pod" -exec rm {} \;
clean-local:
rm -rf buildperl
buildperl/Makefile: .perl-directory-stamp buildperl/Makefile.PL \
$(top_builddir)/config.status
- cd buildperl && @PERL@ Makefile.PL INSTALL_BASE=$(prefix) @PERL_BINDINGS_OPTIONS@
+ cd buildperl && @PERL@ Makefile.PL INSTALL_BASE=$(DESTDIR)$(prefix) @PERL_BINDINGS_OPTIONS@
buildperl/Makefile.PL: .perl-directory-stamp $(top_builddir)/config.status
--- /dev/null
+#! /usr/bin/perl
+
+use strict;
+use ExtUtils::Installed;
+
+my $mod = $ARGV[0] || die "Usage : $0 Module\n";
+my $inst = ExtUtils::Installed->new();
+unlink $inst->files($mod), $inst->packlist($mod)->packlist_file();
&& rm -f -r src/libcollectdclient/.libs \
&& rm -f src/libcollectdclient/*.o \
&& rm -f src/libcollectdclient/*.la \
-&& rm -f src/libcollectdclient/*.lo
+&& rm -f src/libcollectdclient/*.lo \
+&& rm -f bindings/.perl-directory-stamp \
+&& rm -f -r bindings/buildperl
]
)
-AM_INIT_AUTOMAKE(dist-bzip2)
+AM_INIT_AUTOMAKE([tar-pax dist-bzip2])
AC_LANG(C)
AC_PREFIX_DEFAULT("/opt/collectd")
AC_CHECK_HEADERS(netinet/ip_compat.h)
have_net_pfvar_h="no"
-AC_CHECK_HEADERS(net/pfvar.h, [have_net_pfvar_h="yes"])
+AC_CHECK_HEADERS(net/pfvar.h,
+ [have_net_pfvar_h="yes"],
+ [have_net_pfvar_h="no"],
+[
+#if HAVE_SYS_IOCTL_H
+# include <sys/ioctl.h>
+#endif
+#if HAVE_SYS_SOCKET_H
+# include <sys/socket.h>
+#endif
+#if HAVE_NET_IF_H
+# include <net/if.h>
+#endif
+])
# For the multimeter plugin
have_termios_h="no"
GraphWidth 400
#UnixSockAddr "/var/run/collectd-unixsock"
<Type apache_bytes>
- DataSources count
+ DataSources value
DSName "count Bytes/s"
RRDTitle "Apache Traffic"
RRDVerticalLabel "Bytes/s"
Color count 0000ff
</Type>
<Type apache_requests>
- DataSources count
+ DataSources value
DSName "count Requests/s"
RRDTitle "Apache Traffic"
RRDVerticalLabel "Requests/s"
</Type>
<Type apache_scoreboard>
Module GenericStacked
- DataSources count
+ DataSources value
RRDTitle "Apache scoreboard on {hostname}"
RRDVerticalLabel "Slots"
RRDFormat "%6.2lf"
RRDFormat "%6.1lf"
</Type>
<Type conntrack>
- DataSources conntrack
+ DataSources value
DSName conntrack Conntrack count
RRDTitle "nf_conntrack connections on {hostname}"
RRDVerticalLabel "Count"
RRDFormat "%4.0lf"
</Type>
<Type entropy>
- DataSources entropy
+ DataSources value
DSName entropy Entropy bits
RRDTitle "Available entropy on {hostname}"
RRDVerticalLabel "Bits"
Color value 00b000
</Type>
<Type frequency>
- DataSources frequency
+ DataSources value
DSName frequency Frequency
RRDTitle "Frequency ({type_instance})"
RRDVerticalLabel "Hertz"
Scale 8
</Type>
<Type percent>
- DataSources percent
+ DataSources value
DSName percent Percent
RRDTitle "Percent ({type_instance})"
RRDVerticalLabel "Percent"
Color percent 0000ff
</Type>
<Type ping>
- DataSources ping
+ DataSources value
DSName "ping Latency"
RRDTitle "Network latency ({type_instance})"
RRDVerticalLabel "Milliseconds"
Scale 0.001
</Type>
<Type users>
- DataSources users
+ DataSources value
DSName users Users
RRDTitle "Users ({type_instance}) on {hostname}"
RRDVerticalLabel "Users"
collectdmon_CPPFLAGS = $(AM_CPPFLAGS)
collectd_nagios_SOURCES = collectd-nagios.c
+collectd_nagios_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_builddir)/src/libcollectdclient/collectd
collectd_nagios_LDADD =
if BUILD_WITH_LIBSOCKET
collectd_nagios_LDADD += -lsocket
collectdctl_SOURCES = collectdctl.c
+collectdctl_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_builddir)/src/libcollectdclient/collectd
collectdctl_LDADD =
if BUILD_WITH_LIBSOCKET
collectdctl_LDADD += -lsocket
collectd_tg_SOURCES = collectd-tg.c \
utils_heap.c utils_heap.h
+collectd_tg_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_builddir)/src/libcollectdclient/collectd
collectd_tg_LDADD =
if BUILD_WITH_LIBSOCKET
collectd_tg_LDADD += -lsocket
endif
+if BUILD_WITH_LIBRT
+collectd_tg_LDADD += -lrt
+endif
if BUILD_AIX
collectd_tg_LDADD += -lm
endif
collectd-perl.5 \
collectd-python.5 \
collectd-snmp.5 \
+ collectd-tg.1 \
collectd-threshold.5 \
collectd-unixsock.5 \
types.db.5
collectd-python.pod \
collectd.pod \
collectd-snmp.pod \
+ collectd-tg.pod \
collectd-threshold.pod \
collectd-unixsock.pod \
postgresql_default.conf \
fi
pinba.pb-c.c pinba.pb-c.h: pinba.proto
- protoc-c --c_out . pinba.proto
+ protoc-c -I$(srcdir) --c_out . $(srcdir)/pinba.proto
install-exec-hook:
$(mkinstalldirs) $(DESTDIR)$(sysconfdir)
char *prefix;
char *postfix;
char escape_char;
+ unsigned int graphite_flags;
/* subscribe only */
char *exchange_type;
{
status = format_graphite (buffer, sizeof (buffer), ds, vl,
conf->prefix, conf->postfix, conf->escape_char,
- conf->store_rates);
+ conf->graphite_flags);
if (status != 0)
{
ERROR ("amqp plugin: format_graphite failed with status %i.",
conf->delivery_mode = CAMQP_DM_VOLATILE;
}
else if ((strcasecmp ("StoreRates", child->key) == 0) && publish)
+ {
status = cf_util_get_boolean (child, &conf->store_rates);
+ (void) cf_util_get_flag (child, &conf->graphite_flags,
+ GRAPHITE_STORE_RATES);
+ }
else if ((strcasecmp ("Format", child->key) == 0) && publish)
status = camqp_config_set_format (child, conf);
else if ((strcasecmp ("GraphitePrefix", child->key) == 0) && publish)
return (-1);
}
- curl_easy_setopt (st->curl, CURLOPT_NOSIGNAL, 1);
+ curl_easy_setopt (st->curl, CURLOPT_NOSIGNAL, 1L);
curl_easy_setopt (st->curl, CURLOPT_WRITEFUNCTION, apache_curl_callback);
curl_easy_setopt (st->curl, CURLOPT_WRITEDATA, st);
}
curl_easy_setopt (st->curl, CURLOPT_URL, st->url);
- curl_easy_setopt (st->curl, CURLOPT_FOLLOWLOCATION, 1);
+ curl_easy_setopt (st->curl, CURLOPT_FOLLOWLOCATION, 1L);
if (st->verify_peer != 0)
{
- curl_easy_setopt (st->curl, CURLOPT_SSL_VERIFYPEER, 1);
+ curl_easy_setopt (st->curl, CURLOPT_SSL_VERIFYPEER, 1L);
}
else
{
- curl_easy_setopt (st->curl, CURLOPT_SSL_VERIFYPEER, 0);
+ curl_easy_setopt (st->curl, CURLOPT_SSL_VERIFYPEER, 0L);
}
if (st->verify_host != 0)
{
- curl_easy_setopt (st->curl, CURLOPT_SSL_VERIFYHOST, 2);
+ curl_easy_setopt (st->curl, CURLOPT_SSL_VERIFYHOST, 2L);
}
else
{
- curl_easy_setopt (st->curl, CURLOPT_SSL_VERIFYHOST, 0);
+ curl_easy_setopt (st->curl, CURLOPT_SSL_VERIFYHOST, 0L);
}
if (st->cacert != NULL)
apcups_detail.battv = -1.0;
apcups_detail.loadpct = -1.0;
apcups_detail.bcharge = -1.0;
- apcups_detail.timeleft = -1.0;
+ apcups_detail.timeleft = NAN;
apcups_detail.itemp = -300.0;
apcups_detail.linefreq = -1.0;
return (-1);
}
- curl_easy_setopt (curl, CURLOPT_NOSIGNAL, 1);
+ curl_easy_setopt (curl, CURLOPT_NOSIGNAL, 1L);
curl_easy_setopt (curl, CURLOPT_WRITEFUNCTION, ascent_curl_callback);
curl_easy_setopt (curl, CURLOPT_USERAGENT, PACKAGE_NAME"/"PACKAGE_VERSION);
curl_easy_setopt (curl, CURLOPT_ERRORBUFFER, ascent_curl_error);
}
curl_easy_setopt (curl, CURLOPT_URL, url);
- curl_easy_setopt (curl, CURLOPT_FOLLOWLOCATION, 1);
+ curl_easy_setopt (curl, CURLOPT_FOLLOWLOCATION, 1L);
if ((verify_peer == NULL) || IS_TRUE (verify_peer))
- curl_easy_setopt (curl, CURLOPT_SSL_VERIFYPEER, 1);
+ curl_easy_setopt (curl, CURLOPT_SSL_VERIFYPEER, 1L);
else
- curl_easy_setopt (curl, CURLOPT_SSL_VERIFYPEER, 0);
+ curl_easy_setopt (curl, CURLOPT_SSL_VERIFYPEER, 0L);
if ((verify_host == NULL) || IS_TRUE (verify_host))
- curl_easy_setopt (curl, CURLOPT_SSL_VERIFYHOST, 2);
+ curl_easy_setopt (curl, CURLOPT_SSL_VERIFYHOST, 2L);
else
- curl_easy_setopt (curl, CURLOPT_SSL_VERIFYHOST, 0);
+ curl_easy_setopt (curl, CURLOPT_SSL_VERIFYHOST, 0L);
if (cacert != NULL)
curl_easy_setopt (curl, CURLOPT_CAINFO, cacert);
return (-1);
}
- curl_easy_setopt (curl, CURLOPT_NOSIGNAL, 1);
+ curl_easy_setopt (curl, CURLOPT_NOSIGNAL, 1L);
curl_easy_setopt (curl, CURLOPT_WRITEFUNCTION, bind_curl_callback);
curl_easy_setopt (curl, CURLOPT_USERAGENT, PACKAGE_NAME"/"PACKAGE_VERSION);
curl_easy_setopt (curl, CURLOPT_ERRORBUFFER, bind_curl_error);
curl_easy_setopt (curl, CURLOPT_URL, (url != NULL) ? url : BIND_DEFAULT_URL);
- curl_easy_setopt (curl, CURLOPT_FOLLOWLOCATION, 1);
+ curl_easy_setopt (curl, CURLOPT_FOLLOWLOCATION, 1L);
return (0);
} /* }}} int bind_init */
--- /dev/null
+=head1 NAME
+
+collectd-tg - Traffic generator for collectd.
+
+=head1 SYNOPSIS
+
+collectd-tg B<-n> I<num_vl> B<-H> I<num_hosts> B<-p> I<num_plugins> B<-i> I<interval> B<-d> I<dest> B<-D> I<dport>
+
+=head1 DESCRIPTION
+
+B<collectd-tg> generates bogus I<collectd> network traffic. While host, plugin
+and values are generated randomly, the generated traffic tries to mimic "real"
+traffic as closely as possible.
+
+=head1 ARGUMENTS AND OPTIONS
+
+The following options are understood by I<collectd-tg>. The order of the
+arguments generally doesn't matter, as long as no argument is passed more than
+once.
+
+=over 4
+
+=item B<-n> I<num_vl>
+
+Sets the number of unique I<value lists> (VL) to generate. Defaults to 10000.
+
+=item B<-H> I<num_hosts>
+
+Sets the number of unique hosts to simulate. Defaults to 1000.
+
+=item B<-p> I<num_plugins>
+
+Sets the number of unique plugins to simulate. Defaults to 20.
+
+=item B<-i> I<interval>
+
+Sets the interval in which each I<value list> is dispatched. Defaults to 10.0
+seconds.
+
+=item B<-d> I<dest>
+
+Sets the destination to which to send the generated network traffic. Defaults
+to the IPv6 multicast address, C<ff18::efc0:4a42>.
+
+=item B<-D> I<dport>
+
+Sets the destination port or service to which to send the generated network
+traffic. Defaults to I<collectd's> default port, C<25826>.
+
+=item B<-h>
+
+Print usage summary.
+
+=back
+
+=head1 SEE ALSO
+
+L<collectd(1)>,
+L<collectd.conf(5)>
+
+=head1 AUTHOR
+
+Florian Forster E<lt>octoE<nbsp>atE<nbsp>collectd.orgE<gt>
+
+=cut
#PIDFile "@localstatedir@/run/@PACKAGE_NAME@.pid"
#PluginDir "@libdir@/@PACKAGE_NAME@"
#TypesDB "@prefix@/share/@PACKAGE_NAME@/types.db"
+
+#----------------------------------------------------------------------------#
+# Interval at which to query values. This may be overwritten on a per-plugin #
+# base by using the 'Interval' option of the LoadPlugin block: #
+# <LoadPlugin foo> #
+# Interval 60 #
+# </LoadPlugin> #
+#----------------------------------------------------------------------------#
#Interval 10
+
#Timeout 2
#ReadThreads 5
# ValuesFrom "count"
# </Result>
# </Query>
+# <Writer sqlstore>
+# # See contrib/postgresql/collectd_insert.sql for details
+# Statement "SELECT collectd_insert($1, $2, $3, $4, $5, $6, $7, $8, $9);"
+# StoreRates true
+# </Writer>
# <Database foo>
# Host "hostname"
# Port "5432"
# Query backend # predefined
# Query rt36_tickets
# </Database>
+# <Database qux>
+# Service "collectd_store"
+# Writer sqlstore
+# # see collectd.conf(5) for details
+# CommitInterval 30
+# </Database>
#</Plugin>
#<Plugin powerdns>
default), the I<transient> delivery mode will be used, i.e. messages may be
lost due to high load, overflowing queues or similar issues.
-=item B<Format> B<Command>|B<JSON> (Publish only)
+=item B<Format> B<Command>|B<JSON>|B<Graphite> (Publish only)
Selects the format in which messages are sent to the broker. If set to
B<Command> (the default), values are sent as C<PUTVAL> commands which are
cpu_temp_retry_counter = 0;
cpu_temp_retry_step = 1;
-
- DEBUG ("cpu_temp = %i", (int) cpu_temp);
#endif /* PROCESSOR_TEMPERATURE */
}
/* #endif PROCESSOR_CPU_LOAD_INFO */
return (-1);
}
- curl_easy_setopt (wp->curl, CURLOPT_NOSIGNAL, 1);
+ curl_easy_setopt (wp->curl, CURLOPT_NOSIGNAL, 1L);
curl_easy_setopt (wp->curl, CURLOPT_WRITEFUNCTION, cc_curl_callback);
curl_easy_setopt (wp->curl, CURLOPT_WRITEDATA, wp);
curl_easy_setopt (wp->curl, CURLOPT_USERAGENT,
PACKAGE_NAME"/"PACKAGE_VERSION);
curl_easy_setopt (wp->curl, CURLOPT_ERRORBUFFER, wp->curl_errbuf);
curl_easy_setopt (wp->curl, CURLOPT_URL, wp->url);
- curl_easy_setopt (wp->curl, CURLOPT_FOLLOWLOCATION, 1);
+ curl_easy_setopt (wp->curl, CURLOPT_FOLLOWLOCATION, 1L);
if (wp->user != NULL)
{
curl_easy_setopt (wp->curl, CURLOPT_USERPWD, wp->credentials);
}
- curl_easy_setopt (wp->curl, CURLOPT_SSL_VERIFYPEER, wp->verify_peer);
+ curl_easy_setopt (wp->curl, CURLOPT_SSL_VERIFYPEER, (long) wp->verify_peer);
curl_easy_setopt (wp->curl, CURLOPT_SSL_VERIFYHOST,
- wp->verify_host ? 2 : 0);
+ wp->verify_host ? 2L : 0L);
if (wp->cacert != NULL)
curl_easy_setopt (wp->curl, CURLOPT_CAINFO, wp->cacert);
return (-1);
}
- curl_easy_setopt (db->curl, CURLOPT_NOSIGNAL, 1);
+ curl_easy_setopt (db->curl, CURLOPT_NOSIGNAL, 1L);
curl_easy_setopt (db->curl, CURLOPT_WRITEFUNCTION, cj_curl_callback);
curl_easy_setopt (db->curl, CURLOPT_WRITEDATA, db);
curl_easy_setopt (db->curl, CURLOPT_USERAGENT,
curl_easy_setopt (db->curl, CURLOPT_USERPWD, db->credentials);
}
- curl_easy_setopt (db->curl, CURLOPT_SSL_VERIFYPEER, (int) db->verify_peer);
+ curl_easy_setopt (db->curl, CURLOPT_SSL_VERIFYPEER, (long) db->verify_peer);
curl_easy_setopt (db->curl, CURLOPT_SSL_VERIFYHOST,
- (int) (db->verify_host ? 2 : 0));
+ db->verify_host ? 2L : 0L);
if (db->cacert != NULL)
curl_easy_setopt (db->curl, CURLOPT_CAINFO, db->cacert);
return (-1);
}
- curl_easy_setopt (db->curl, CURLOPT_NOSIGNAL, 1);
+ curl_easy_setopt (db->curl, CURLOPT_NOSIGNAL, 1L);
curl_easy_setopt (db->curl, CURLOPT_WRITEFUNCTION, cx_curl_callback);
curl_easy_setopt (db->curl, CURLOPT_WRITEDATA, db);
curl_easy_setopt (db->curl, CURLOPT_USERAGENT,
* </Plugin>
*/
-static int cdbi_config_set_string (char **ret_string, /* {{{ */
- oconfig_item_t *ci)
-{
- char *string;
-
- if ((ci->values_num != 1)
- || (ci->values[0].type != OCONFIG_TYPE_STRING))
- {
- WARNING ("dbi plugin: The `%s' config option "
- "needs exactly one string argument.", ci->key);
- return (-1);
- }
-
- string = strdup (ci->values[0].value.string);
- if (string == NULL)
- {
- ERROR ("dbi plugin: strdup failed.");
- return (-1);
- }
-
- if (*ret_string != NULL)
- free (*ret_string);
- *ret_string = string;
-
- return (0);
-} /* }}} int cdbi_config_set_string */
-
static int cdbi_config_add_database_driver_option (cdbi_database_t *db, /* {{{ */
oconfig_item_t *ci)
{
}
memset (db, 0, sizeof (*db));
- status = cdbi_config_set_string (&db->name, ci);
+ status = cf_util_get_string (ci, &db->name);
if (status != 0)
{
sfree (db);
oconfig_item_t *child = ci->children + i;
if (strcasecmp ("Driver", child->key) == 0)
- status = cdbi_config_set_string (&db->driver, child);
+ status = cf_util_get_string (child, &db->driver);
else if (strcasecmp ("DriverOption", child->key) == 0)
status = cdbi_config_add_database_driver_option (db, child);
else if (strcasecmp ("SelectDB", child->key) == 0)
- status = cdbi_config_set_string (&db->select_db, child);
+ status = cf_util_get_string (child, &db->select_db);
else if (strcasecmp ("Query", child->key) == 0)
status = udb_query_pick_from_list (child, queries, queries_num,
&db->queries, &db->queries_num);
return (status);
interfaces_num++;
- INFO("ethstat plugin: Registred interface %s",
+ INFO("ethstat plugin: Registered interface %s",
interfaces[interfaces_num - 1]);
return (0);
{
value_map_t *map;
int status;
+ char *key;
if ((ci->values_num < 2)
|| (ci->values_num > 3)
return (-1);
}
+ key = strdup (ci->values[0].value.string);
+ if (key == NULL)
+ {
+ ERROR ("ethstat plugin: strdup(3) failed.");
+ return (ENOMEM);
+ }
+
map = malloc (sizeof (*map));
if (map == NULL)
{
+ sfree (key);
ERROR ("ethstat plugin: malloc(3) failed.");
return (ENOMEM);
}
if (value_map == NULL)
{
sfree (map);
+ sfree (key);
ERROR ("ethstat plugin: c_avl_create() failed.");
return (-1);
}
}
status = c_avl_insert (value_map,
- /* key = */ ci->values[0].value.string,
+ /* key = */ key,
/* value = */ map);
if (status != 0)
{
- sfree (map);
if (status > 0)
- ERROR ("ethstat plugin: Multiple mappings for \"%s\".",
- ci->values[0].value.string);
+ ERROR ("ethstat plugin: Multiple mappings for \"%s\".", key);
else
- ERROR ("ethstat plugin: c_avl_insert(\"%s\") failed.",
- ci->values[0].value.string);
+ ERROR ("ethstat plugin: c_avl_insert(\"%s\") failed.", key);
+
+ sfree (map);
+ sfree (key);
return (-1);
}
return 0;
}
+static int ethstat_shutdown (void)
+{
+ void *key = NULL;
+ void *value = NULL;
+
+ if (value_map == NULL)
+ return (0);
+
+ while (c_avl_pick (value_map, &key, &value) == 0)
+ {
+ sfree (key);
+ sfree (value);
+ }
+
+ c_avl_destroy (value_map);
+ value_map = NULL;
+
+ return (0);
+}
+
void module_register (void)
{
plugin_register_complex_config ("ethstat", ethstat_config);
plugin_register_read ("ethstat", ethstat_read);
+ plugin_register_shutdown ("ethstat", ethstat_shutdown);
}
/* vim: set sw=2 sts=2 et fdm=marker : */
BUILT_SOURCES = collectd/lcc_features.h
libcollectdclient_la_SOURCES = client.c network.c network_buffer.c
-libcollectdclient_la_CPPFLAGS = $(AM_CPPFLAGS)
+libcollectdclient_la_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_builddir)/src/libcollectdclient/collectd -I$(top_srcdir)/src
libcollectdclient_la_LDFLAGS = -version-info 1:0:0
libcollectdclient_la_LIBADD =
if BUILD_WITH_LIBGCRYPT
char *username;
char *password;
+#if HAVE_LIBGCRYPT
gcry_cipher_hd_t encr_cypher;
size_t encr_header_len;
char encr_iv[16];
+#endif
};
#define SSTRNCPY(dst,src,sz) do { \
return (result);
need_init = 0;
+#if HAVE_LIBGCRYPT
gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread);
if (!gcry_check_version (GCRYPT_VERSION))
result = 1;
return (1);
+#else
+ return(0);
+#endif
} /* }}} _Bool have_gcrypt */
static uint64_t htonll (uint64_t val) /* {{{ */
return (0);
} /* }}} int nb_add_value_list */
+#if HAVE_LIBGCRYPT
static int nb_add_signature (lcc_network_buffer_t *nb) /* {{{ */
{
char *buffer;
return (0);
} /* }}} int nb_add_encryption */
+#endif
/*
* Public functions
nb->ptr = nb->buffer;
nb->free = nb->size;
+#if HAVE_LIBGCRYPT
if (nb->seclevel == SIGN)
{
size_t username_len;
ADD_GENERIC (nb, hash, sizeof (hash));
assert ((nb->encr_header_len + nb->free) == nb->size);
}
+#endif
return (0);
} /* }}} int lcc_network_buffer_initialize */
if (nb == NULL)
return (EINVAL);
+#if HAVE_LIBGCRYPT
if (nb->seclevel == SIGN)
nb_add_signature (nb);
else if (nb->seclevel == ENCRYPT)
nb_add_encryption (nb);
+#endif
return (0);
} /* }}} int lcc_network_buffer_finalize */
cdtime_t timestamp_time)
{
FILE *fh;
- int do_close = 0;
+ _Bool do_close = 0;
struct tm timestamp_tm;
char timestamp_str[64];
char level_str[16] = "";
else
fprintf (fh, "%s%s\n", level_str, msg);
- if (do_close != 0)
+ if (do_close) {
fclose (fh);
+ } else {
+ fflush(fh);
+ }
}
pthread_mutex_unlock (&file_lock);
return (-1);
}
- curl_easy_setopt (curl, CURLOPT_NOSIGNAL, 1);
+ curl_easy_setopt (curl, CURLOPT_NOSIGNAL, 1L);
curl_easy_setopt (curl, CURLOPT_WRITEFUNCTION, nginx_curl_callback);
curl_easy_setopt (curl, CURLOPT_USERAGENT, PACKAGE_NAME"/"PACKAGE_VERSION);
curl_easy_setopt (curl, CURLOPT_ERRORBUFFER, nginx_curl_error);
curl_easy_setopt (curl, CURLOPT_URL, url);
}
- curl_easy_setopt (curl, CURLOPT_FOLLOWLOCATION, 1);
+ curl_easy_setopt (curl, CURLOPT_FOLLOWLOCATION, 1L);
if ((verify_peer == NULL) || IS_TRUE (verify_peer))
{
- curl_easy_setopt (curl, CURLOPT_SSL_VERIFYPEER, 1);
+ curl_easy_setopt (curl, CURLOPT_SSL_VERIFYPEER, 1L);
}
else
{
- curl_easy_setopt (curl, CURLOPT_SSL_VERIFYPEER, 0);
+ curl_easy_setopt (curl, CURLOPT_SSL_VERIFYPEER, 0L);
}
if ((verify_host == NULL) || IS_TRUE (verify_host))
{
- curl_easy_setopt (curl, CURLOPT_SSL_VERIFYHOST, 2);
+ curl_easy_setopt (curl, CURLOPT_SSL_VERIFYHOST, 2L);
}
else
{
- curl_easy_setopt (curl, CURLOPT_SSL_VERIFYHOST, 0);
+ curl_easy_setopt (curl, CURLOPT_SSL_VERIFYHOST, 0L);
}
if (cacert != NULL)
#include "plugin.h"
#include "common.h"
-#include <sys/ioctl.h>
-#include <sys/socket.h>
-#include <net/if.h>
+#if HAVE_SYS_IOCTL_H
+# include <sys/ioctl.h>
+#endif
+#if HAVE_SYS_SOCKET_H
+# include <sys/socket.h>
+#endif
+#if HAVE_NET_IF_H
+# include <net/if.h>
+#endif
+
#include <net/pfvar.h>
-#include <paths.h>
-#include <err.h>
-#include <pwd.h>
+
+#ifndef FCNT_NAMES
+# if FCNT_MAX != 3
+# error "Unexpected value for FCNT_MAX"
+# endif
+# define FCNT_NAMES {"search", "insert", "removals", NULL};
+#endif
+
+#ifndef SCNT_NAMES
+# if SCNT_MAX != 3
+# error "Unexpected value for SCNT_MAX"
+# endif
+# define SCNT_NAMES {"search", "insert", "removals", NULL};
+#endif
static char const *pf_reasons[PFRES_MAX+1] = PFRES_NAMES;
static char const *pf_lcounters[LCNT_MAX+1] = LCNT_NAMES;
static char const *pf_fcounters[FCNT_MAX+1] = FCNT_NAMES;
-static char const *pf_scounters[FCNT_MAX+1] = FCNT_NAMES;
+static char const *pf_scounters[SCNT_MAX+1] = SCNT_NAMES;
static char const *pf_device = "/dev/pf";
close (fd);
fd = -1;
- if (!status.running)
+ if (!state.running)
{
WARNING ("pf plugin: PF is not running.");
return (-1);
};
static int def_queries_num = STATIC_ARRAY_SIZE (def_queries);
-static c_psql_database_t *databases = NULL;
-static size_t databases_num = 0;
+static c_psql_database_t **databases = NULL;
+static size_t databases_num = 0;
-static udb_query_t **queries = NULL;
-static size_t queries_num = 0;
+static udb_query_t **queries = NULL;
+static size_t queries_num = 0;
-static c_psql_writer_t *writers = NULL;
-static size_t writers_num = 0;
+static c_psql_writer_t *writers = NULL;
+static size_t writers_num = 0;
static int c_psql_begin (c_psql_database_t *db)
{
static c_psql_database_t *c_psql_database_new (const char *name)
{
- c_psql_database_t *db;
+ c_psql_database_t **tmp;
+ c_psql_database_t *db;
- db = (c_psql_database_t *)realloc (databases,
- (databases_num + 1) * sizeof (*db));
+ db = (c_psql_database_t *)malloc (sizeof(*db));
if (NULL == db) {
log_err ("Out of memory.");
return NULL;
}
- databases = db;
- db = databases + databases_num;
+ tmp = (c_psql_database_t **)realloc (databases,
+ (databases_num + 1) * sizeof (*databases));
+ if (NULL == tmp) {
+ log_err ("Out of memory.");
+ sfree (db);
+ return NULL;
+ }
+
+ databases = tmp;
+ databases[databases_num] = db;
++databases_num;
db->conn = NULL;
sfree (db->service);
/* don't care about freeing or reordering the 'databases' array
- * this is done in 'shutdown' */
+ * this is done in 'shutdown'; also, don't free the database instance
+ * object just to make sure that in case anybody accesses it before
+ * shutdown won't segfault */
return;
} /* c_psql_database_delete */
if ((PGRES_COMMAND_OK != PQresultStatus (res))
&& (PGRES_TUPLES_OK != PQresultStatus (res))) {
+ PQclear (res);
+
if ((CONNECTION_OK != PQstatus (db->conn))
&& (0 == c_psql_check_connection (db))) {
- PQclear (res);
-
/* try again */
res = PQexecParams (db->conn, writer->statement,
STATIC_ARRAY_SIZE (params), NULL,
if ((PGRES_COMMAND_OK == PQresultStatus (res))
|| (PGRES_TUPLES_OK == PQresultStatus (res))) {
+ PQclear (res);
success = 1;
continue;
}
pthread_mutex_unlock (&db->db_lock);
return -1;
}
+
+ PQclear (res);
success = 1;
}
__attribute__((unused)) const char *ident,
user_data_t *ud)
{
- c_psql_database_t *dbs = databases;
+ c_psql_database_t **dbs = databases;
size_t dbs_num = databases_num;
size_t i;
if ((ud != NULL) && (ud->data != NULL)) {
- dbs = ud->data;
+ dbs = (void *)&ud->data;
dbs_num = 1;
}
for (i = 0; i < dbs_num; ++i) {
- c_psql_database_t *db = dbs + i;
+ c_psql_database_t *db = dbs[i];
/* don't commit if the timeout is larger than the regular commit
* interval as in that case all requested data has already been
plugin_unregister_read_group ("postgresql");
for (i = 0; i < databases_num; ++i) {
- c_psql_database_t *db = databases + i;
+ c_psql_database_t *db = databases[i];
if (db->writers_num > 0) {
char cb_name[DATA_MAX_NAME_LEN];
plugin_unregister_flush (cb_name);
plugin_unregister_write (cb_name);
}
+
+ sfree (db);
}
udb_query_free (queries, queries_num);
#endif
#define REDIS_DEF_HOST "localhost"
+#define REDIS_DEF_PASSWD ""
#define REDIS_DEF_PORT 6379
#define REDIS_DEF_TIMEOUT 2000
#define MAX_REDIS_NODE_NAME 64
static int redis_init (void) /* {{{ */
{
- redis_node_t rn = { "default", REDIS_DEF_HOST, REDIS_DEF_PORT,
- REDIS_DEF_TIMEOUT, /* next = */ NULL };
+ redis_node_t rn = { "default", REDIS_DEF_HOST, REDIS_DEF_PASSWD,
+ REDIS_DEF_PORT, REDIS_DEF_TIMEOUT, /* next = */ NULL };
if (nodes_head == NULL)
redis_node_add (&rn);
temperature value:GAUGE:-273.15:U
threads value:GAUGE:0:U
time_dispersion value:GAUGE:-1000000:1000000
-timeleft value:GAUGE:0:3600
+timeleft value:GAUGE:0:U
time_offset value:GAUGE:-1000000:1000000
total_bytes value:DERIVE:0:U
total_connections value:DERIVE:0:U
/**
* collectd - src/utils_complain.c
- * Copyright (C) 2006-2007 Florian octo Forster
+ * Copyright (C) 2006-2013 Florian octo Forster
* Copyright (C) 2008 Sebastian tokkee Harl
*
* This program is free software; you can redistribute it and/or modify it
static int vcomplain (int level, c_complain_t *c,
const char *format, va_list ap)
{
- time_t now;
+ cdtime_t now;
char message[512];
- now = time (NULL);
+ now = cdtime ();
if (c->last + c->interval > now)
return 0;
else
c->interval *= 2;
- if (c->interval > 86400)
- c->interval = 86400;
+ if (c->interval > TIME_T_TO_CDTIME_T (86400))
+ c->interval = TIME_T_TO_CDTIME_T (86400);
vsnprintf (message, sizeof (message), format, ap);
message[sizeof (message) - 1] = '\0';
{
va_list ap;
- /* reset the old interval */
- if (c->interval < 0)
- c->interval *= -1;
-
va_start (ap, format);
- vcomplain (level, c, format, ap);
+ if (vcomplain (level, c, format, ap))
+ c->complained_once = 1;
va_end (ap);
} /* c_complain */
{
va_list ap;
- if (c->interval < 0)
+ if (c->complained_once)
return;
va_start (ap, format);
if (vcomplain (level, c, format, ap))
- c->interval *= -1;
+ c->complained_once = 1;
va_end (ap);
} /* c_complain_once */
return;
c->interval = 0;
+ c->complained_once = 0;
va_start (ap, format);
vsnprintf (message, sizeof (message), format, ap);
/**
* collectd - src/utils_complain.h
- * Copyright (C) 2006-2007 Florian octo Forster
+ * Copyright (C) 2006-2013 Florian octo Forster
* Copyright (C) 2008 Sebastian tokkee Harl
*
* This program is free software; you can redistribute it and/or modify it
#ifndef UTILS_COMPLAIN_H
#define UTILS_COMPLAIN_H 1
-#include <time.h>
+#include "utils_time.h"
typedef struct
{
/* time of the last report */
- time_t last;
+ cdtime_t last;
- /* how long to wait until reporting again
- * 0 indicates that the complaint is no longer valid
- * < 0 indicates that the complaint has been reported once
- * => c_complain_once will not report again
- * => c_complain uses the absolute value to reset the old value */
- int interval;
+ /* How long to wait until reporting again.
+ * 0 indicates that the complaint is no longer valid. */
+ cdtime_t interval;
+
+ _Bool complained_once;
} c_complain_t;
-#define C_COMPLAIN_INIT_STATIC { 0, 0 }
-#define C_COMPLAIN_INIT(c) do { (c)->last = 0; (c)->interval = 0; } while (0)
+#define C_COMPLAIN_INIT_STATIC { 0, 0, 0 }
+#define C_COMPLAIN_INIT(c) do { \
+ (c)->last = 0; \
+ (c)->interval = 0; \
+ (c)->complained_once = 0; \
+} while (0)
/*
* NAME
#include "plugin.h"
#include "common.h"
-#if HAVE_NETINET_IN_SYSTM_H
-# include <netinet/in_systm.h>
-#endif
-#if HAVE_NETINET_IN_H
-# include <netinet/in.h>
-#endif
-#if HAVE_NETINET_IP6_H
-# include <netinet/ip6.h>
-#endif
-#if HAVE_NETINET_IP_COMPAT_H
-# include <netinet/ip_compat.h>
-#endif
-#if HAVE_ARPA_INET_H
-# include <arpa/inet.h>
-#endif
#if HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif
-#if HAVE_ARPA_NAMESER_H
-# include <arpa/nameser.h>
-#endif
-#if HAVE_ARPA_NAMESER_COMPAT_H
-# include <arpa/nameser_compat.h>
-#endif
-
#if HAVE_NET_IF_ARP_H
# include <net/if_arp.h>
#endif
#if HAVE_NET_IF_H
# include <net/if.h>
#endif
-#if HAVE_NETINET_IF_ETHER_H
-# include <netinet/if_ether.h>
-#endif
#if HAVE_NET_PPP_DEFS_H
# include <net/ppp_defs.h>
#endif
# include <net/if_ppp.h>
#endif
-#if HAVE_NETDB_H
-# include <netdb.h>
+#if HAVE_NETINET_IN_SYSTM_H
+# include <netinet/in_systm.h>
+#endif
+#if HAVE_NETINET_IN_H
+# include <netinet/in.h>
+#endif
+#if HAVE_NETINET_IP6_H
+# include <netinet/ip6.h>
+#endif
+#if HAVE_NETINET_IP_COMPAT_H
+# include <netinet/ip_compat.h>
+#endif
+#if HAVE_NETINET_IF_ETHER_H
+# include <netinet/if_ether.h>
#endif
-
#if HAVE_NETINET_IP_H
# include <netinet/ip.h>
#endif
#ifdef HAVE_NETINET_IP_VAR_H
# include <netinet/ip_var.h>
#endif
-#if HAVE_NETINET_IP6_H
-# include <netinet/ip6.h>
-#endif
#if HAVE_NETINET_UDP_H
# include <netinet/udp.h>
#endif
+#if HAVE_ARPA_INET_H
+# include <arpa/inet.h>
+#endif
+#if HAVE_ARPA_NAMESER_H
+# include <arpa/nameser.h>
+#endif
+#if HAVE_ARPA_NAMESER_COMPAT_H
+# include <arpa/nameser_compat.h>
+#endif
+
+#if HAVE_NETDB_H
+# include <netdb.h>
+#endif
+
#if HAVE_PCAP_H
# include <pcap.h>
#endif
#include "plugin.h"
#include "common.h"
+#include "utils_format_graphite.h"
#include "utils_cache.h"
-#include "utils_format_json.h"
#include "utils_parse_option.h"
/* Utils functions to format data sets in graphite format.
}
static int gr_format_name (char *ret, int ret_len,
- const value_list_t *vl,
- const char *ds_name,
- char *prefix,
- char *postfix,
- char escape_char)
+ value_list_t const *vl,
+ char const *ds_name,
+ char const *prefix,
+ char const *postfix,
+ char const escape_char,
+ unsigned int flags)
{
char n_host[DATA_MAX_NAME_LEN];
char n_plugin[DATA_MAX_NAME_LEN];
if (n_plugin_instance[0] != '\0')
ssnprintf (tmp_plugin, sizeof (tmp_plugin), "%s%c%s",
n_plugin,
- '-',
+ (flags & GRAPHITE_SEPARATE_INSTANCES) ? '.' : '-',
n_plugin_instance);
else
sstrncpy (tmp_plugin, n_plugin, sizeof (tmp_plugin));
if (n_type_instance[0] != '\0')
ssnprintf (tmp_type, sizeof (tmp_type), "%s%c%s",
n_type,
- '-',
+ (flags & GRAPHITE_SEPARATE_INSTANCES) ? '.' : '-',
n_type_instance);
else
sstrncpy (tmp_type, n_type, sizeof (tmp_type));
+ /* Assert always_append_ds -> ds_name */
+ assert (!(flags & GRAPHITE_ALWAYS_APPEND_DS) || (ds_name != NULL));
if (ds_name != NULL)
ssnprintf (ret, ret_len, "%s%s%s.%s.%s.%s",
prefix, n_host, postfix, tmp_plugin, tmp_type, ds_name);
}
int format_graphite (char *buffer, size_t buffer_size,
- const data_set_t *ds, const value_list_t *vl, char *prefix,
- char *postfix, char escape_char,
- _Bool store_rates)
+ data_set_t const *ds, value_list_t const *vl,
+ char const *prefix, char const *postfix, char const escape_char,
+ unsigned int flags)
{
int status = 0;
int i;
int buffer_pos = 0;
gauge_t *rates = NULL;
- if (store_rates)
+ if (flags & GRAPHITE_STORE_RATES)
rates = uc_get_rate (ds, vl);
for (i = 0; i < ds->ds_num; i++)
{
- const char *ds_name = NULL;
+ char const *ds_name = NULL;
char key[10*DATA_MAX_NAME_LEN];
char values[512];
size_t message_len;
char message[1024];
- ds_name = ds->ds[i].name;
+ if ((flags & GRAPHITE_ALWAYS_APPEND_DS)
+ || (ds->ds_num > 1))
+ ds_name = ds->ds[i].name;
/* Copy the identifier to `key' and escape it. */
status = gr_format_name (key, sizeof (key), vl, ds_name,
- prefix, postfix, escape_char);
+ prefix, postfix, escape_char, flags);
if (status != 0)
{
ERROR ("format_graphite: error with gr_format_name");
#include "collectd.h"
#include "plugin.h"
+#define GRAPHITE_STORE_RATES 0x01
+#define GRAPHITE_SEPARATE_INSTANCES 0x02
+#define GRAPHITE_ALWAYS_APPEND_DS 0x04
+
int format_graphite (char *buffer,
size_t buffer_size, const data_set_t *ds,
const value_list_t *vl, const char *prefix,
const char *postfix, const char escape_char,
- _Bool store_rates);
+ unsigned int flags);
#endif /* UTILS_FORMAT_GRAPHITE_H */
if (buf[len - 1] != '\n')
break;
buf[len - 1] = '\0';
+ len--;
}
status = callback (data, buf, buflen);
/**
* collectd - src/varnish.c
- * Copyright (C) 2010 Jérôme Renard
- * Copyright (C) 2010 Marc Fournier
- * Copyright (C) 2010 Florian Forster
+ * Copyright (C) 2010 Jérôme Renard
+ * Copyright (C) 2010 Marc Fournier
+ * Copyright (C) 2010-2012 Florian Forster
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Authors:
* Jérôme Renard <jerome.renard at gmail.com>
* Marc Fournier <marc.fournier at camptocamp.com>
- * Florian octo Forster <octo at verplant.org>
+ * Florian octo Forster <octo at collectd.org>
**/
/**
vd = VSM_New();
VSC_Setup(vd);
- if (VSM_n_Arg(vd, conf->instance) == -1)
+
+ if (conf->instance != NULL)
{
- ERROR ("Varnish plugin : unable to load statistics from instance");
- return (-1);
+ int status;
+
+ status = VSM_n_Arg (vd, conf->instance);
+ if (status < 0)
+ {
+ ERROR ("varnish plugin: VSM_n_Arg (\"%s\") failed "
+ "with status %i.",
+ conf->instance, status);
+ return (-1);
+ }
}
+
if (VSC_Open (vd, /* diag = */ 1))
{
ERROR ("varnish plugin: Unable to load statistics.");
* Copyright (C) 2011 Scott Sanders
* Copyright (C) 2009 Paul Sadauskas
* Copyright (C) 2009 Doug MacEachern
- * Copyright (C) 2007-2012 Florian octo Forster
+ * Copyright (C) 2007-2013 Florian octo Forster
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
#include "configfile.h"
#include "utils_cache.h"
+#include "utils_complain.h"
#include "utils_parse_option.h"
#include "utils_format_graphite.h"
char *postfix;
char escape_char;
- _Bool store_rates;
- _Bool separate_instances;
- _Bool always_append_ds;
+ unsigned int format_flags;
char send_buf[WG_SEND_BUF_SIZE];
size_t send_buf_free;
cdtime_t send_buf_init_time;
pthread_mutex_t send_lock;
+ c_complain_t init_complaint;
};
if (cb->sock_fd < 0)
{
char errbuf[1024];
- ERROR ("write_graphite plugin: Connecting to %s:%s failed. "
+ c_complain (LOG_ERR, &cb->init_complaint,
+ "write_graphite plugin: Connecting to %s:%s failed. "
"The last error was: %s", node, service,
sstrerror (errno, errbuf, sizeof (errbuf)));
close (cb->sock_fd);
return (-1);
}
+ else
+ {
+ c_release (LOG_INFO, &cb->init_complaint,
+ "write_graphite plugin: Successfully connected to %s:%s.",
+ node, service);
+ }
wg_reset_buffer (cb);
status = wg_callback_init (cb);
if (status != 0)
{
- ERROR ("write_graphite plugin: wg_callback_init failed.");
+ /* An error message has already been printed. */
pthread_mutex_unlock (&cb->send_lock);
return (-1);
}
status = wg_callback_init (cb);
if (status != 0)
{
- ERROR ("write_graphite plugin: wg_callback_init failed.");
+ /* An error message has already been printed. */
pthread_mutex_unlock (&cb->send_lock);
return (-1);
}
static int wg_write_messages (const data_set_t *ds, const value_list_t *vl,
struct wg_callback *cb)
{
- char buffer[4096];
+ char buffer[WG_SEND_BUF_SIZE];
int status;
if (0 != strcmp (ds->type, vl->type))
memset (buffer, 0, sizeof (buffer));
status = format_graphite (buffer, sizeof (buffer), ds, vl,
- cb->prefix, cb->postfix, cb->escape_char, cb->store_rates);
+ cb->prefix, cb->postfix, cb->escape_char, cb->format_flags);
if (status != 0) /* error message has been printed already. */
return (status);
+ /* Send the message to graphite */
wg_send_message (buffer, cb);
if (status != 0)
{
- ERROR ("write_graphite plugin: wg_send_message failed "
- "with status %i.", status);
+ /* An error message has already been printed. */
return (status);
}
cb->prefix = NULL;
cb->postfix = NULL;
cb->escape_char = WG_DEFAULT_ESCAPE;
- cb->store_rates = 1;
+ cb->format_flags = GRAPHITE_STORE_RATES;
pthread_mutex_init (&cb->send_lock, /* attr = */ NULL);
+ C_COMPLAIN_INIT (&cb->init_complaint);
for (i = 0; i < ci->children_num; i++)
{
else if (strcasecmp ("Postfix", child->key) == 0)
cf_util_get_string (child, &cb->postfix);
else if (strcasecmp ("StoreRates", child->key) == 0)
- cf_util_get_boolean (child, &cb->store_rates);
+ cf_util_get_flag (child, &cb->format_flags,
+ GRAPHITE_STORE_RATES);
else if (strcasecmp ("SeparateInstances", child->key) == 0)
- cf_util_get_boolean (child, &cb->separate_instances);
+ cf_util_get_flag (child, &cb->format_flags,
+ GRAPHITE_SEPARATE_INSTANCES);
else if (strcasecmp ("AlwaysAppendDS", child->key) == 0)
- cf_util_get_boolean (child, &cb->always_append_ds);
+ cf_util_get_flag (child, &cb->format_flags,
+ GRAPHITE_ALWAYS_APPEND_DS);
else if (strcasecmp ("EscapeCharacter", child->key) == 0)
config_set_char (&cb->escape_char, child);
else
return (-1);
}
- curl_easy_setopt (cb->curl, CURLOPT_NOSIGNAL, 1);
+ curl_easy_setopt (cb->curl, CURLOPT_NOSIGNAL, 1L);
curl_easy_setopt (cb->curl, CURLOPT_USERAGENT, PACKAGE_NAME"/"PACKAGE_VERSION);
headers = NULL;
curl_easy_setopt (cb->curl, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
}
- curl_easy_setopt (cb->curl, CURLOPT_SSL_VERIFYPEER, cb->verify_peer);
+ curl_easy_setopt (cb->curl, CURLOPT_SSL_VERIFYPEER, (long) cb->verify_peer);
curl_easy_setopt (cb->curl, CURLOPT_SSL_VERIFYHOST,
- cb->verify_host ? 2 : 0);
+ cb->verify_host ? 2L : 0L);
if (cb->cacert != NULL)
curl_easy_setopt (cb->curl, CURLOPT_CAINFO, cb->cacert);
za_read_derive (ksp, "stolen", "cache_operation", "stolen");
/* Issue indicators */
- za_read_derive (ksp, "mutex_miss", "mutex_operation", "miss");
+ za_read_derive (ksp, "mutex_miss", "mutex_operations", "miss");
za_read_derive (ksp, "hash_collisions", "hash_collisions", "");
/* Evictions */
#!/usr/bin/env bash
-DEFAULT_VERSION="5.2.0.git"
+DEFAULT_VERSION="5.2.1.git"
VERSION="`git describe 2> /dev/null | sed -e 's/^collectd-//'`"