[collectd] Questions about coding standards & writing plugins

Richard W.M. Jones rjones at redhat.com
Fri Nov 2 14:08:01 CET 2007


Hi,

The libvirt plugin is coming along.  I have a few questions about coding 
which don't seem to be covered in the developer documentation or FAQ:

(1) You say 'Only reentrant- and threadsafe functions may be used'.  The 
problem is that libvirt functions aren't reentrant, so I guess, if this 
is a real concern, then I'll need to put locking around them.  Do you 
have locking functions?  Is collectd really threaded, because if my 
plugin can be called from different threads then I'm going to need to 
think harder about the implementation.

(2) Many of the stats that can be collected through libvirt are of the 
"counting up from zero" variety, eg. number of disk blocks processed by 
a guest since the guest was booted.  My reading of plugins such as 
'interface.c' seems to indicate that collectd can handle such stats 
natively, so that I don't need to subtract the earlier reading and 
divide by time passed.  But I'm a bit baffled by how to use this.  Do I 
need to define a type and add it to src/types.db, and if so what do the 
fields in this file mean & how is it generated?  And what is the precise 
meaning of the fields in value_list_t?

Rich.

-- 
Emerging Technologies, Red Hat - http://et.redhat.com/~rjones/
Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod
Street, Windsor, Berkshire, SL4 1TE, United Kingdom.  Registered in
England and Wales under Company Registration No. 03798903
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3237 bytes
Desc: S/MIME Cryptographic Signature
Url : http://mailman.verplant.org/pipermail/collectd/attachments/20071102/3335c466/attachment.bin 


More information about the collectd mailing list