First, some background. I'm working on integrating systemtap and pcp,
and I wrote a python PMDA that will be similar to the mmv pmda in that
it will need to monitor a directory for new data. After working on it, I
found out that the pcp python support doesn't really allow adding new
metrics (or clearing metrics) after PMDA.run() has been called.
So, commit 38983a5 in the pcpfans.git dsmith/dev branch adds a 'refresh
metrics' callback to the pcp python support. This allows a python pmda
to add/remove metrics after PMDA.run() has been called.
Nathan helped a bit with the idea (but blame all errors on me).
Here's how you'd use it. In your PMDA.init() function, you'd set the
callback, like this:
self.set_refresh_metrics(self.__refresh_metrics)
Then your __refresh_metrics (or whatever you want to call it) function
will get called when needed. I based this code on the mmv pmda, so it
could get called during several PDUs. Then your callback function could
add metrics. New code in the PMDA class will update everything.
Comments welcome on the patch.
--
David Smith
dsmith@xxxxxxxxxx
Red Hat
http://www.redhat.com
256.217.0141 (direct)
256.837.0057 (fax)
|