JSON Parser

From Zenoss Wiki
This is the approved revision of this page, as well as being the most recent.
Jump to: navigation, search

General purpose JSON parser for handling JSON objects matching the following template. This allows many datapoints for many components to be collected from a single COMMAND datasource. It also allows for collection of many events from a single COMMAND datasource. The event capabilities are a significant reason to choose this parser instead of the older Nagios parser for example.

If you specify a blank component eg "" it refers to a device level entry. If you want to parse many components in one go (typical usage for component template) use component value "${here/id}"

To allow "Clear" events to close events from a device, you will want to specify "event_key" as one of the fields in your events. A Clear event will close all events with the same event_key value on the device.

This example is from Products/ZenRRD/parsers/JSON.py

  "values": {
     "component_id_1": {
        "datapoint1": 123.4,
        "datapoint2": 987.6
      "component_id_2": {
        "datapoint1": 56.7,
        "datapoint2": 54.3
    "events": [
           "severity": 2,
           "other_field_1": "value for other field",
           "summary": "event summary"
           "severity": 3,
           "other_field_1": "another value for other field",
           "summary": "another event summary"