Difference between revisions of "JSON Parser"

From Zenoss Wiki
Jump to: navigation, search
(Added information about setting the eventKey.)
Line 1: Line 1:
 
General purpose JSON parser for handling JSON objects matching the followingtemplate. This allows many datapoints for many components to be collectedfrom a single COMMAND datasource. It also allows for collection of manyevents from a single COMMAND datasource.  The event capabilities are a significant reason to choose this parser instead of the older Nagios parser for example.
 
General purpose JSON parser for handling JSON objects matching the followingtemplate. This allows many datapoints for many components to be collectedfrom a single COMMAND datasource. It also allows for collection of manyevents 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 specify a blank component eg "" it refers to a device level entry. 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
 
This example is from Products/ZenRRD/parsers/JSON.py

Revision as of 16:55, 15 August 2013

General purpose JSON parser for handling JSON objects matching the followingtemplate. This allows many datapoints for many components to be collectedfrom a single COMMAND datasource. It also allows for collection of manyevents 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. 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"
        }
    ]
}