AC_PLUGIN([wireless], [$plugin_wireless], [Wireless statistics])
AC_PLUGIN([write_http], [$with_libcurl], [HTTP output plugin])
AC_PLUGIN([write_redis], [$with_libcredis], [Redis output plugin])
-AC_PLUGIN([write_mongo], [yes], [Mongo output plugin])
+AC_PLUGIN([write_mongo], [$with_libmongoc], [MongoDB output plugin])
AC_PLUGIN([xmms], [$with_libxmms], [XMMS statistics])
AC_PLUGIN([zfs_arc], [$plugin_zfs_arc], [ZFS ARC statistics])
collectd_DEPENDENCIES += write_http.la
endif
+if BUILD_PLUGIN_WRITE_MONGO
+pkglib_LTLIBRARIES += write_mongo.la
+write_mongo_la_SOURCES = write_mongo.c
+write_mongo_la_LDFLAGS = -module -avoid-version
+write_mongo_la_LIBADD = -lmongoc
+collectd_LDADD += "-dlopen" write_mongo.la
+collectd_DEPENDENCIES += write_mongo.la
+endif
+
if BUILD_PLUGIN_WRITE_REDIS
pkglib_LTLIBRARIES += write_redis.la
write_redis_la_SOURCES = write_redis.c
collectd_DEPENDENCIES += write_redis.la
endif
-if BUILD_PLUGIN_WRITE_MONGO
-pkglib_LTLIBRARIES += write_mongo.la
-write_mongo_la_SOURCES = write_mongo.c
-write_mongo_la_LDFLAGS = -module -avoid-version
-write_mongo_la_CFLAGS = -DMONGO_HAVE_STDINT $(AM_CFLAGS)
-write_mongo_la_LIBADD = libmongo/libmongo.la
-write_mongo_la_DEPENDENCIES = libmongo/libmongo.la
-collectd_LDADD += "-dlopen" write_mongo.la
-collectd_DEPENDENCIES += write_mongo.la
-endif
-
if BUILD_PLUGIN_XMMS
pkglib_LTLIBRARIES += xmms.la
xmms_la_SOURCES = xmms.c
#include "configfile.h"
#include <pthread.h>
-#include "libmongo/bson.h"
-#include "libmongo/mongo.h"
+
+#if HAVE_STDINT_H
+# define MONGO_HAVE_STDINT 1
+#else
+# define MONGO_USE_LONG_LONG_INT 1
+#endif
+#include <mongo.h>
struct wm_node_s
{
if (node->connected == 0)
{
- strcpy(node->opts->host, node->host);
+ sstrncpy(node->opts->host, node->host,
+ sizeof (node->opts->host));
node->opts->port = node->port;
status = mongo_connect(node->conn,node->opts);