[collectd] Question about plugin write/flush callbacks (follow-up to "Batching writes from the same plugin?")

Marc marc at baha.mu
Wed Feb 27 22:42:43 CET 2013


Hi all  

I'm a happy collectd user for many years, and I now need to develop a plugin to send collected values to a in-house monitoring/alerting application via ZeroMQ.

I would like to follow up from Dragos Manolescu's email sent yesterday (http://mailman.verplant.org/pipermail/collectd/2013-February/005670.html, sorry for not replying from his email since I wasn't a mailing list subscriber yet), because I have a similar issue: I would like to "pack" several logically linked metrics (e.g. all metrics belonging to the same plugin for a specific time interval) for each host polled in a unique JSON-serialized message. For example, I would like to pack all these values collected by the `load` plugin...

value_list->host=server1 value_list->time=1361810500 value_list->plugin=load value_list->plugin_instance= value_list->type=load value_list->type_instance= ds->name=longterm = gauge
value_list->host=server1 value_list->time=1361810500 value_list->plugin=load value_list->plugin_instance= value_list->type=load value_list->type_instance= ds->name=midterm = gauge
value_list->host=server1 value_list->time=1361810500 value_list->plugin=load value_list->plugin_instance= value_list->type=load value_list->type_instance= ds->name=shortterm = gauge



…into a message similar to this one:

{
"date": 1361810500,
"host": "server1",
"check": "load",
"value": {"shortterm": 0.23,"midterm": 0.13,"longterm": 0.1}
}



Same as Dragos, knowing if all of a plugin's metrics are polled atomically – thus have the same value_list->time timestamp would help.

I'm kind of struggling with the write/flush plugin API, even looking at other existing write_* ones – I'm not a seasoned C developer. Specifically, I don't get when the flush callback is called by collectd with a `timeout` parameter > 0; I noticed it is called at the daemon shutdown, but besides this event and when a user triggers a manual FLUSH command, is this flush callback useful?

Thank you for your time,

m.  





More information about the collectd mailing list