- write_mongodb
Sends data to MongoDB, a NoSQL database.
+ - write_prometheus
+ Publish values using an embedded HTTP server, in a format compatible
+ with Prometheus' collectd_exporter.
+
- write_redis
Sends the values to a Redis key-value database server.
Used by the `gps' plugin.
<http://developer.berlios.de/projects/gpsd/>
- * libhal (optional)
- If present, the `uuid' plugin will check for UUID from HAL.
- <http://hal.freedesktop.org/>
-
* libi2c-dev (optional)
Used for the plugin `barometer', provides just the i2c-dev.h header file
for user space i2c development.
Used by the `memcachec' plugin to connect to a memcache daemon.
<http://tangent.org/552/libmemcached.html>
+ * libmicrohttpd (optional)
+ Used by the write_prometheus plugin to run an http daemon.
+ <http://www.gnu.org/software/libmicrohttpd/>
+
* libmnl (optional)
Used by the `netlink' plugin.
<http://www.netfilter.org/projects/libmnl/>
- flex
- bison
- libtool
-- libtool-ltdl
- pkg-config
The `build.sh' script takes no arguments.
-SUBDIRS = libcollectdclient
-if BUILD_WITH_OWN_LIBOCONFIG
-SUBDIRS += liboconfig
-endif
-SUBDIRS += daemon
+SUBDIRS = libcollectdclient liboconfig daemon
PLUGIN_LDFLAGS = -module -avoid-version -export-symbols-regex '\<module_register\>'
pkglib_LTLIBRARIES += disk.la
disk_la_SOURCES = disk.c
disk_la_CFLAGS = $(AM_CFLAGS)
+disk_la_CPPFLAGS = $(AM_CPPFLAGS)
disk_la_LDFLAGS = $(PLUGIN_LDFLAGS)
disk_la_LIBADD =
if BUILD_WITH_LIBKSTAT
disk_la_LIBADD += $(BUILD_WITH_LIBSTATGRAB_LDFLAGS)
endif
if BUILD_WITH_LIBUDEV
-disk_la_CFLAGS += $(BUILD_WITH_LIBUDEV_CFLAGS)
+disk_la_CPPFLAGS += $(BUILD_WITH_LIBUDEV_CPPFLAGS)
disk_la_LDFLAGS += $(BUILD_WITH_LIBUDEV_LDFLAGS)
disk_la_LIBADD += $(BUILD_WITH_LIBUDEV_LIBS)
endif
if BUILD_PLUGIN_DNS
pkglib_LTLIBRARIES += dns.la
dns_la_SOURCES = dns.c utils_dns.c utils_dns.h
-dns_la_LDFLAGS = $(PLUGIN_LDFLAGS)
-dns_la_LIBADD = -lpcap
+dns_la_CPPFLAGS = $(AM_CPPFLAGS) $(BUILD_WITH_LIBPCAP_CPPFLAGS)
+dns_la_LDFLAGS = $(PLUGIN_LDFLAGS) $(BUILD_WITH_LIBPCAP_LDFLAGS)
+dns_la_LIBADD = $(BUILD_WITH_LIBPCAP_LIBS)
endif
if BUILD_PLUGIN_DPDKSTAT
if BUILD_PLUGIN_EXEC
pkglib_LTLIBRARIES += exec.la
exec_la_SOURCES = exec.c
- exec_la_LDFLAGS = $(PLUGIN_LDFLAGS) libcmds.la
+ exec_la_LDFLAGS = $(PLUGIN_LDFLAGS)
+ exec_la_LIBADD = libcmds.la
endif
if BUILD_PLUGIN_ETHSTAT
if BUILD_PLUGIN_MIC
pkglib_LTLIBRARIES += mic.la
mic_la_SOURCES = mic.c
-mic_la_LDFLAGS = $(PLUGIN_LDFLAGS) $(BUILD_WITH_MIC_LIBPATH)
-mic_la_CFLAGS = $(AM_CFLAGS) $(BUILD_WITH_MIC_CPPFLAGS)
-mic_la_LIBADD = $(BUILD_WITH_MIC_LDADD)
+mic_la_CPPFLAGS = $(AM_CPPFLAGS) $(BUILD_WITH_MIC_CPPFLAGS)
+mic_la_LDFLAGS = $(PLUGIN_LDFLAGS) $(BUILD_WITH_MIC_LDFLAGS)
+mic_la_LIBADD = $(BUILD_WITH_MIC_LIBS)
endif
if BUILD_PLUGIN_MODBUS
if BUILD_PLUGIN_NOTIFY_EMAIL
pkglib_LTLIBRARIES += notify_email.la
notify_email_la_SOURCES = notify_email.c
-notify_email_la_LDFLAGS = $(PLUGIN_LDFLAGS)
-notify_email_la_LIBADD = -lesmtp -lssl -lcrypto
+notify_email_la_CPPFLAGS = $(AM_CPPFLAGS) $(BUILD_WITH_LIBESMTP_CPPFLAGS)
+notify_email_la_LDFLAGS = $(PLUGIN_LDFLAGS) $(BUILD_WITH_LIBESMTP_LDFLAGS)
+notify_email_la_LIBADD = $(BUILD_WITH_LIBESMTP_LIBS)
endif
if BUILD_PLUGIN_NOTIFY_NAGIOS
perl_la_CFLAGS = $(AM_CFLAGS) \
$(PERL_CFLAGS) \
-DXS_VERSION=\"$(VERSION)\" -DVERSION=\"$(VERSION)\"
-# Work-around for issues #41 and #42 - Perl 5.10 incorrectly introduced
-# __attribute__nonnull__(3) for Perl_load_module().
-if HAVE_BROKEN_PERL_LOAD_MODULE
-perl_la_CFLAGS += -Wno-nonnull
-endif
perl_la_LDFLAGS = $(PLUGIN_LDFLAGS) \
$(PERL_LDFLAGS)
perl_la_LIBADD = $(PERL_LIBS)
postgresql_la_CPPFLAGS = $(AM_CPPFLAGS) $(BUILD_WITH_LIBPQ_CPPFLAGS)
postgresql_la_LDFLAGS = $(PLUGIN_LDFLAGS) \
$(BUILD_WITH_LIBPQ_LDFLAGS)
-postgresql_la_LIBADD = -lpq
+postgresql_la_LIBADD = $(BUILD_WITH_LIBPQ_LIBS)
endif
if BUILD_PLUGIN_POWERDNS
if BUILD_PLUGIN_SENSORS
pkglib_LTLIBRARIES += sensors.la
sensors_la_SOURCES = sensors.c
-sensors_la_CFLAGS = $(AM_CFLAGS) $(BUILD_WITH_LIBSENSORS_CFLAGS)
+sensors_la_CPPFLAGS = $(AM_CPPFLAGS) $(BUILD_WITH_LIBSENSORS_CPPFLAGS)
sensors_la_LDFLAGS = $(PLUGIN_LDFLAGS) $(BUILD_WITH_LIBSENSORS_LDFLAGS)
-sensors_la_LIBADD = -lsensors
+sensors_la_LIBADD = $(BUILD_WITH_LIBSENSORS_LIBS)
endif
if BUILD_PLUGIN_SERIAL
if BUILD_WITH_LIBUDEV
pkglib_LTLIBRARIES += smart.la
smart_la_SOURCES = smart.c
-smart_la_CFLAGS = $(AM_CFLAGS) $(BUILD_WITH_LIBATASMART_CPPFLAGS) $(BUILD_WITH_LIBUDEV_CFLAGS)
+smart_la_CPPFLAGS = $(AM_CPPFLAGS) $(BUILD_WITH_LIBATASMART_CPPFLAGS) $(BUILD_WITH_LIBUDEV_CPPFLAGS)
smart_la_LDFLAGS = $(PLUGIN_LDFLAGS) $(BUILD_WITH_LIBATASMART_LDFLAGS) $(BUILD_WITH_LIBUDEV_LDFLAGS)
smart_la_LIBADD = $(BUILD_WITH_LIBATASMART_LIBS) $(BUILD_WITH_LIBUDEV_LIBS)
endif
if BUILD_PLUGIN_UNIXSOCK
pkglib_LTLIBRARIES += unixsock.la
unixsock_la_SOURCES = unixsock.c
- unixsock_la_LDFLAGS = $(PLUGIN_LDFLAGS) libcmds.la
+ unixsock_la_LDFLAGS = $(PLUGIN_LDFLAGS)
+ unixsock_la_LIBADD = libcmds.la
endif
if BUILD_PLUGIN_UPTIME
if BUILD_PLUGIN_UUID
pkglib_LTLIBRARIES += uuid.la
uuid_la_SOURCES = uuid.c
-uuid_la_CFLAGS = $(AM_CFLAGS) $(BUILD_WITH_LIBHAL_CFLAGS)
-uuid_la_LIBADD = $(BUILD_WITH_LIBHAL_LIBS)
uuid_la_LDFLAGS = $(PLUGIN_LDFLAGS)
endif
$(BUILD_WITH_LIBVIRT_CFLAGS) $(BUILD_WITH_LIBXML2_CFLAGS)
virt_la_LIBADD = $(BUILD_WITH_LIBVIRT_LIBS) $(BUILD_WITH_LIBXML2_LIBS)
virt_la_LDFLAGS = $(PLUGIN_LDFLAGS)
+
+# TODO: enable once we support only modern libvirts which depends on libnl-3
+# the libvirt on wheezy is linked in libnl v1, and there is a small leak here,
+# triggered by the library initialization. There are no means to avoid it,
+# and libvirt switched to libnl3 anyway
+#test_plugin_virt_SOURCES = virt_test.c
+#test_plugin_virt_CPPFLAGS = $(AM_CPPFLAGS) \
+# $(BUILD_WITH_LIBVIRT_CFLAGS) $(BUILD_WITH_LIBXML2_CFLAGS)
+#test_plugin_virt_LDFLAGS = $(PLUGIN_LDFLAGS)
+#test_plugin_virt_LDADD = daemon/libplugin_mock.la \
+# $(BUILD_WITH_LIBVIRT_LIBS) $(BUILD_WITH_LIBXML2_LIBS)
+#check_PROGRAMS += test_plugin_virt
+#TESTS += test_plugin_virt
endif
if BUILD_PLUGIN_VMEM
} /* static void *collect (void *) */
static void *open_connection(void __attribute__((unused)) * arg) {
- struct sockaddr_un addr;
-
const char *path = (NULL == sock_file) ? SOCK_PATH : sock_file;
const char *group = (NULL == sock_group) ? COLLECTD_GRP_NAME : sock_group;
pthread_exit((void *)1);
}
- addr.sun_family = AF_UNIX;
+ struct sockaddr_un addr = {
+ .sun_family = AF_UNIX
+ };
sstrncpy(addr.sun_path, path, (size_t)(UNIX_PATH_MAX - 1));
errno = 0;
plugin_register_read("email", email_read);
plugin_register_shutdown("email", email_shutdown);
} /* void module_register */
-
-/* vim: set sw=4 ts=4 tw=78 noexpandtab : */
REPLACE_FIELD("%{type_instance}", vl->type_instance);
if (vl->meta != NULL) {
- char **meta_toc;
+ char **meta_toc = NULL;
int meta_entries = meta_data_toc(vl->meta, &meta_toc);
+ if (meta_entries <= 0)
+ return;
+
for (int i = 0; i < meta_entries; i++) {
char meta_name[DATA_MAX_NAME_LEN];
char *value_str;
ERROR("Target `set': Unable to get replacement metadata value `%s'.",
key);
strarray_free(meta_toc, (size_t)meta_entries);
+ meta_data_destroy(new_meta);
return (status);
}
if (status) {
ERROR("Target `set': Unable to set metadata value `%s'.", key);
strarray_free(meta_toc, (size_t)meta_entries);
+ meta_data_destroy(new_meta);
return (status);
}
}
tproc.invoke = ts_invoke;
fc_register_target("set", tproc);
} /* module_register */
-
-/* vim: set sw=2 sts=2 tw=78 et fdm=marker : */
print_to_socket(fh, "%zu Threshold found\n", i);
if (threshold.host[0] != 0)
- print_to_socket(fh, "Host: %s\n", threshold.host) if (
- threshold.plugin[0] !=
- 0) print_to_socket(fh, "Plugin: %s\n",
- threshold.plugin) if (threshold.plugin_instance[0] !=
- 0)
- print_to_socket(fh, "Plugin Instance: %s\n",
- threshold.plugin_instance) if (threshold.type[0] != 0)
- print_to_socket(fh, "Type: %s\n", threshold.type) if (
- threshold.type_instance[0] !=
- 0) print_to_socket(fh, "Type Instance: %s\n",
- threshold
- .type_instance) if (threshold.data_source
- [0] != 0)
- print_to_socket(
- fh, "Data Source: %s\n",
- threshold.data_source) if (!isnan(threshold.warning_min))
- print_to_socket(
- fh, "Warning Min: %g\n",
- threshold
- .warning_min) if (!isnan(threshold.warning_max))
- print_to_socket(
- fh, "Warning Max: %g\n",
- threshold
- .warning_max) if (!isnan(threshold.failure_min))
- print_to_socket(
- fh, "Failure Min: %g\n",
- threshold
- .failure_min) if (!isnan(threshold
- .failure_max))
- print_to_socket(
- fh, "Failure Max: %g\n",
- threshold.failure_max) if (threshold
- .hysteresis >
- 0.0)
- print_to_socket(
- fh, "Hysteresis: %g\n",
- threshold.hysteresis) if (threshold
- .hits > 1)
- print_to_socket(fh, "Hits: %i\n",
- threshold.hits)
-
- return (0);
+ print_to_socket(fh, "Host: %s\n", threshold.host);
+ if (threshold.plugin[0] != 0)
+ print_to_socket(fh, "Plugin: %s\n", threshold.plugin);
+ if (threshold.plugin_instance[0] != 0)
+ print_to_socket(fh, "Plugin Instance: %s\n", threshold.plugin_instance);
+ if (threshold.type[0] != 0)
+ print_to_socket(fh, "Type: %s\n", threshold.type);
+ if (threshold.type_instance[0] != 0)
+ print_to_socket(fh, "Type Instance: %s\n", threshold.type_instance);
+ if (threshold.data_source[0] != 0)
+ print_to_socket(fh, "Data Source: %s\n", threshold.data_source);
+ if (!isnan(threshold.warning_min))
+ print_to_socket(fh, "Warning Min: %g\n", threshold.warning_min);
+ if (!isnan(threshold.warning_max))
+ print_to_socket(fh, "Warning Max: %g\n", threshold.warning_max);
+ if (!isnan(threshold.failure_min))
+ print_to_socket(fh, "Failure Min: %g\n", threshold.failure_min);
+ if (!isnan(threshold.failure_max))
+ print_to_socket(fh, "Failure Max: %g\n", threshold.failure_max);
+ if (threshold.hysteresis > 0.0)
+ print_to_socket(fh, "Hysteresis: %g\n", threshold.hysteresis);
+ if (threshold.hits > 1)
+ print_to_socket(fh, "Hits: %i\n", threshold.hits);
+
+ return (0);
} /* int handle_getthreshold */
-
-/* vim: set sw=2 sts=2 ts=8 et : */
return fam;
}
- if (!allocate)
+ if (!allocate) {
+ sfree(name);
return NULL;
+ }
fam = metric_family_create(name, ds, vl, ds_index);
if (fam == NULL) {
/* user data = */ NULL);
plugin_register_shutdown("write_prometheus", prom_shutdown);
}
-
-/* vim: set sw=2 sts=2 et fdm=marker : */