Merge branch 'sh/collectd-5.1' into collectd-5.1
authorFlorian Forster <octo@collectd.org>
Mon, 27 Aug 2012 08:12:11 +0000 (10:12 +0200)
committerFlorian Forster <octo@collectd.org>
Mon, 27 Aug 2012 08:12:11 +0000 (10:12 +0200)
src/varnish.c
src/write_mongodb.c

index 357b5f1..de60e39 100644 (file)
@@ -412,6 +412,11 @@ static int varnish_read (user_data_t *ud) /* {{{ */
 
        vd = VSM_New();
        VSC_Setup(vd);
+       if (VSM_n_Arg(vd, conf->instance) == -1)
+       {
+               ERROR ("Varnish plugin : unable to load statistics from instance");
+               return (-1);
+       }
        if (VSC_Open (vd, /* diag = */ 1))
        {
                ERROR ("varnish plugin: Unable to load statistics.");
index 8d76b60..c7b7682 100644 (file)
@@ -195,7 +195,14 @@ static int wm_write (const data_set_t *ds, /* {{{ */
   /* Assert if the connection has been established */
   assert (mongo_is_connected (node->conn));
 
-  status = mongo_insert (node->conn, collection_name, bson_record);
+  #if MONGO_MINOR >= 6
+    /* There was an API change in 0.6.0 as linked below */
+    /* https://github.com/mongodb/mongo-c-driver/blob/master/HISTORY.md */
+    status = mongo_insert (node->conn, collection_name, bson_record, NULL);
+  #else
+    status = mongo_insert (node->conn, collection_name, bson_record);
+  #endif
+
   if(status != MONGO_OK)
   {
     ERROR ( "write_mongodb plugin: error inserting record: %d", node->conn->err);