[collectd] Compiling collectd with write_mongodb plugin support
Giovanni Torres
giovtorres at hotmail.com
Thu Nov 20 05:59:31 CET 2014
Aha. Figured it out. Found a thread (http://mailman.verplant.org/pipermail/collectd/2012-April/005046.html) which pointed to another thread (http://mailman.verplant.org/pipermail/collectd/2012-January/004893.html) which shows that the write_mongodb plugin was compiled against v0.4 of the mongo-c-driver. Ok.
Built mongo-c-driver v0.4. Configured collectd... success. "write_mongodb. . . yes". Beautiful. make... failed! Darkness.
Ran into this issue:
write_mongodb.c:77:3: error: implicit declaration of function ‘bson_create’ [-Werror=implicit-function-declaration]
write_mongodb.c:77:7: error: assignment makes pointer from integer without a cast [-Werror]
write_mongodb.c: In function ‘wm_write’:
write_mongodb.c:246:3: error: implicit declaration of function ‘bson_dispose’ [-Werror=implicit-function-declaration
Which led me to this issue (https://github.com/collectd/collectd/issues/331). API changed. So, took a peek in the HISTORY.MD and saw the following:
"3. Underlying allocation functions are now uniformly named with _alloc_ and _dealloc_ instead of _create_ and _dispose_."
Ok. No problem. Edited collectd/src/write_mongdb.c and changed _create with _allow and _dispose with _dealloc.
configure && make && make install works! Finally. (I ended up using the latest version of the legacy driver, v0.8.1.)
Actually, I ran it like this:
# CPPFLAGS=-I/root/local/mongo-c-driver-0.8.1/usr/local/include ./configure --prefix=/root/local/collectd-5.4.1 --with-libmongoc=/root/local/mongo-c-driver-0.8.1/usr/local --enable-write_mongodb --without-perl-bindings
Now, this brings me to a different set of notes/questions:
1. The write_mongodb plugin wiki pages says this plugin is supported, but I beg to differ given the work above I had to do. It should be marked as experimental in its current state.
2. The plugin only compiles against the 'legacy' branch of the mongo-c-driver, which stopped at v0.8.1. The new version jumped to 0.90.0, at which point, there was no longer the mongo.h header file which is required by write_mongdb.c. The wiki should be updated to make a note of this. You can get to it directly from here (https://github.com/mongodb/mongo-c-driver-legacy). The wiki should also note the API change for bson_create and _dispose.
3. Clearly the mongo-c-driver API/ABI was not stable, at least until the 1.0 release as noted on their github page ("Until the 1.0 release, this driver should be considered alpha. Keep in mind that the API will be in flux until then.") Now that the driver is at version 1.0.2, perhaps the maintainers could revisit the plugin and rebuild the plugin against what may now be a more stable version of the driver API?
4. Lastly, is anyone using this plugin in production? Or, at least have been running it for a while to know what the caveats/advantages/disadvantages/pitfalls/breaking points are and would care to share? If I had 2000 32-core machines that need to run collectd, is it better to write_graphite and scale carbon/graphite or is write_mongodb a better alternative in your opinion?
Thanks,
Giovanni
________________________________
> From: giovtorres at hotmail.com
> To: collectd at verplant.org
> Date: Fri, 11 Apr 2014 14:34:31 -0400
> Subject: [collectd] Compiling collectd with write_mongodb plugin support
>
> I need some help compiling the write_mongodb plugin. I am using
> Scientific Linux 6.5. I successfully compiled the mongo-c-driver.
> When I run $(CPPFLAGS=-I/usr/local/mongo-c-driver/include/libmongoc-1.0
> ./configure --enable-write_mongodb), it fails saying that there is a
> dependency error.
>
> Looking at config.log, I get the following error:
> configure:21546: checking for mongo.h
> configure:21546: gcc -c -g -O2
> -I/usr/local/mongo-c-driver/include/libmongoc-1.0 conftest.c>&5
> conftest.c:182:19: error: mongo.h: No such file or directory
>
> Why is it looking for mongo.h and not mongoc.h? I tried looking for
> mongo.h from some of the available mongodb RPMs, but I can't seem to
> find it.
>
> Thanks,
> Giovanni
>
> _______________________________________________ collectd mailing list
> collectd at verplant.org http://mailman.verplant.org/listinfo/collectd
More information about the collectd
mailing list