Difference between revisions of "JSON Parser"
From Zenoss Wiki
(Created page with "General purpose JSON parser for handling JSON objects matching the followingtemplate. This allows many datapoints for many components to be collectedfrom a single COMMAND data...") |
|||
Line 4: | Line 4: | ||
This example is from Products/ZenRRD/parsers/JSON.py | This example is from Products/ZenRRD/parsers/JSON.py | ||
− | |||
− | |||
+ | <syntaxhighlight lang=javascript> | ||
+ | { | ||
+ | "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" | ||
+ | } | ||
+ | ] | ||
+ | } | ||
+ | </syntaxhighlight> | ||
[[Category:Tips]] | [[Category:Tips]] |
Revision as of 20:08, 10 January 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.
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" } ] }