Collectd plugin is reporting an absolute value instead of the delta, for RRD like “Counter” type, to mongo

StackOverflow https://stackoverflow.com/questions/9472126

Question

So I am writing a read plugin, openvz_guest_bandwidth, for Collectd where I read how much bandwidth Openvz guests are doing, by using libiptc to query how much external bandwidth each guest is doing.

I am then reporting this information to the write_mongodb plugin that I wrote, (which could be related to the breakage)

The issue is that I am seeing records in mongo like,

{ "_id" : ObjectId("4f480c15573fa191fa838140"), "ts" : ISODate("2012-02-24T22:15:33Z"), "h" : "62f34634-0fac-4b5f-a7a5-45532ef6dd3b", "i" : "rx", "t" : "counter", "ti" : "", "value" : NumberLong("3970318241") }
{ "_id" : ObjectId("4f480c15573fa191fa838141"), "ts" : ISODate("2012-02-24T22:15:34Z"), "h" : "62f34634-0fac-4b5f-a7a5-45532ef6dd3b", "i" : "tx", "t" : "counter", "ti" : "", "value" : NumberLong(50070094) }
{ "_id" : ObjectId("4f480c15573fa191fa838142"), "ts" : ISODate("2012-02-24T22:15:34Z"), "h" : "62f34634-0fac-4b5f-a7a5-45532ef6dd3b", "i" : "rx", "t" : "counter", "ti" : "", "value" : NumberLong("3970322447") }
{ "_id" : ObjectId("4f480c15573fa191fa838143"), "ts" : ISODate("2012-02-24T22:15:35Z"), "h" : "62f34634-0fac-4b5f-a7a5-45532ef6dd3b", "i" : "tx", "t" : "counter", "ti" : "", "value" : NumberLong(50070094) }
{ "_id" : ObjectId("4f480c15573fa191fa838144"), "ts" : ISODate("2012-02-24T22:15:35Z"), "h" : "62f34634-0fac-4b5f-a7a5-45532ef6dd3b", "i" : "rx", "t" : "counter", "ti" : "", "value" : NumberLong("3970325247") }

Where the interesting values are at the end. I would expect the reported values to be the difference between the consecutive records, instead of what the counter reads.

This is analogous to the RRD counter type of COUNTER instead of ABSOLUTE as I understand it.

I am pretty stuck on this and am unsure where the fault may lie, and even further how to correct it. The fault could either be in reading or with writing.

As a side note, before the values reach write_mongodb, they are sent over the collectd network plugin.

More over I seem to be confused between value_list.plugin and value_list.plugin_instance. Other plugins seem to use types which give a really useless field such as "t: 'memory'" inside the memory collection.

Was it helpful?

Solution

Octo, the collectd maintainer pointed out that the write_mongodb plugin didn't use a certain function call and configuration check to see if it should write deltas.

The commit can be found Here https://github.com/collectd/collectd/pull/38

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top