This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

JSON PMDA


Here's a pointer to the latest version of the JSON PMDA I'm working on.
Note that the JSON PMDA is now much more generic, and (in theory) should
support lots of JSON data sources, so I've renamed it from 'stap_json'
to just 'json'. I've used it with systemtap
(https://sourceware.org/systemtap/) and ceph (http://ceph.com/).

Here's how the JSON PMDA works. When adding a new JSON data source, you
write a JSON "metadata" file that maps a metric to the JSON that
contains the metric data via a JSON pointers. Here's an excerpt from a
ceph metadata file:

====
{
  "data-exec": "/usr/bin/ceph --admin-daemon
/var/run/ceph/ceph-osd.0.asok perf
dump",
  "metrics": [
    {
      "name": "WBThrottle.bytes_dirtied",
      "pointer": "/WBThrottle/bytes_dirtied",
      "type": "integer"
    },
    {
      "name": "WBThrottle.bytes_wb",
      "pointer": "/WBThrottle/bytes_wb",
      "type": "integer"
    },
    ... more metrics here ...
   ]
}
====

In this case the optional 'data-exec' item tells the PMDA what command
to run to get the JSON data, then the 'metrics' item describes the data.

The JSON PMDA is in the 'dsmith/dev' branch of pcpfans.git. You can see
it here:

<https://www.sourceware.org/git/gitweb.cgi?p=pcpfans.git;a=tree;f=src/pmdas/json;h=d62facaf3f1b0972ba783852b59e4e4e9eb5cc04;hb=refs/heads/dsmith/dev>

As I mentioned earlier, I've used the JSON PMDA to provide metrics from
2 different data sources:

1) Ceph support. For ceph, the json pmda directory also contains a
python script called 'generate_ceph_metadata.py' that when given a ceph
admin socket name, will produce an associated metadata file. Then the
JSON PMDA config file would need to be pointed at the directory
containing the metadata file. Then pcp will use the JSON PMDA to be able
to provide ceph metrics.

2) Systemtap support. For systemtap, I've written a JSON tapset that
provides scripts with the ability to export JSON data. The tapset is
checked into the dsmith/json systemtap git branch or can be seen here
(with its associated macros file):

<https://www.sourceware.org/git/gitweb.cgi?p=systemtap.git;a=blob;f=tapset/linux/json.stp;h=b54a83aabb6ec362c946a5811be35def5f349957;hb=refs/heads/dsmith/json>
<https://www.sourceware.org/git/gitweb.cgi?p=systemtap.git;a=blob;f=tapset/linux/json.stpm;h=6f35a6e187f5ce67cd6a62f22a9d6b6623f56bc6;hb=refs/heads/dsmith/json>

I've also attached 2 sample systemtap scripts:

- net_xmit_json.stp: A script written by Will Cohen to monitor network
transmit counts and latency

- netfilter_summary_json.stp: I took an existing systemtap sample script
(netfilter_summary.stp) and converted it to output JSON instead.


What's next? I could certainly use any suggestions on the JSON PMDA.
Here's a short to-do list:

- Add support to the PMDA for floating point values (right now any
floating point ceph values are skipped).
- Debug an issue with the PMDA where the command to get the ceph data is
run too often.
- Try this with other JSON data sources. Suggestions welcome.

-- 
David Smith
dsmith@redhat.com
Red Hat
http://www.redhat.com
256.217.0141 (direct)
256.837.0057 (fax)

Attachment: netfilter_summary_json.stp
Description: Text document

Attachment: net_xmit_json.stp
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]