Hi -
As requested, I added a fetchgroup-flavoured PM_TYPE_EVENT processor
to the work. pcpfans.git fche/fetchgroup. The new commit is:
commit e3e0b564111b6636ce1d81e91820bacee1c3645e
Author: Frank Ch. Eigler <fche@xxxxxxxxxx>
Date: Sat Jan 2 00:19:10 2016 -0500
fetchgroups: event-field support
Extend the fetchgroup api with an _event variant, which processes
named fields from named event metrics through the extract/convert/cast
pipeline. This lets the following toy program trace systemd/journal
events:
from pcp import pmapi
import cpmapi as c_api
import time
pmfg = pmapi.fetchgroup(c_api.PM_CONTEXT_HOST, "local:")
vvv = pmfg.extend_event("systemd.journal.records",
field="systemd.journal.field.string")
while True:
pmfg.fetch()
for ts, line in vvv():
print ("%s : %s" % (ts, line()))
time.sleep(1.0)
Python & docs & QA included.
|