[collectd] Some thought about the vserver patch

Guillaume Pratte guillaume.pratte at revolutionlinux.com
Thu Oct 5 17:38:33 CEST 2006


Hello Sebastian,

Here are some thoughts about the vserver plugin patch.

First, for the task of associating vservers name to it's context number, 
we can avoid the dependancy on libvserver by reading the content of 
/var/run/vservers/ (in fact, this is how it is implemented in vsmon).

The directory contains files named after the name of the vserver (in 
vserver v2) or vservername.ctx (vserver v1). The content of the file is 
simply the context id (in vserver v2) or contains "S_CONTEXT=contextid" 
(in vserver v1).

We can make a cache of the content of this directory, but we should 
always check the modification time of the files each time collectd 
perform a cycle and load the information again if :
 - a new file is detected
 - a file is modified
(i.e. a "partial load" and not a full load of all the contents).

We could also invalidate the cache if a file is deleted, but it might 
not be necessary. It is important to note that the content of 
/var/run/vservers can be invalid if the system was not shutdown 
properly. This should not be an issue here because we get a valid 
running context id list from /proc/virtual/.

The only problem I have is I am not sure how to properly implement a 
cache in C. In python for example I would use a simple dictionnary, but 
in C it's a little bit more complex :-)

Does collectd implement any data structure that would do the job (like 
some kind of map or dictionary), or should I code it myself, or event 
import code from a compatible license?

Thanks,

-- 
Guillaume Pratte
Recherche et développement
Révolution Linux

Toutes les opinions et les prises de position exprimées dans ce courriel sont celles de son auteur et ne répresentent pas nécessairement celles de Révolution Linux.

Any views and opinions expressed in this email are solely those of the author and do not necessarily represent those of Revolution Linux.





-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.verplant.org/pipermail/collectd/attachments/20061005/a2262eaa/attachment.html


More information about the collectd mailing list