May 7, 2013 11:16 AM
JSON parser for zencommand
-
Like (0)
I found an old ZenPack for createing Event Histograms (see: docs/DOC-4538Event Histograms), but it doesn't appear to be current. So, I took a look at what I could do now.
I found: getEventSeveritiesCount() which when scripted like:
dmd = ZenScriptBase(connect=True).dmd
print dmd.Devices.getEventSeveritiesCount()
gives me what I think I want:
{'info': {'count': 1057, 'acknowledged_count': 0}, 'clear': {'count': 0, 'acknowledged_count': 0}, 'warning': {'count': 333, 'acknowledged_count': 0}, 'critical': {'count': 376, 'acknowledged_count': 0}, 'error': {'count': 2937, 'acknowledged_count': 2}, 'debug': {'count': 244, 'acknowledged_count': 0}}
which is very nicely formatted JSON (and, if I want, i can iterated over the Device sub-classes).
I've read that the zencommand collector can parse JSON.
1. Is that the "Auto" parser? (nothing in the list says "JSON")
2. How do I structure the datapoints under this datasource?
TIA!
Richard Evans
Hi Richard,
If you are on Zenoss 4.x then when you create a Command template there should be a dropdown for JSON in the COMMAND data source dropdown. It is new with 4 though.
The only "documentation" that I know of is a ticket (now closed) that defined what needed to happen - http://jira.zenoss.com/jira/browse/ZEN-2633 .
Cheers,
Jane
Thanks Jane, good to hear from you again.
No Joy – I am v4.1.1, and the JIRA ticket sites build 4.1.70 (the JSON parser is not present in my list of available parsers for a command data source).
Since I’m enterprise, I’ll open a support ticket and see if there’s a back-port available
Rich / Jane:
I heard drich in #zenoss talking about writting a zencommand json parser today. I'm unsure if it'll be OSS, but I'd ping him.
--Shane Scott (Hackman238)
My ears were burning (I'm drich on IRC) so I thought I'd stop by... :-)
I have converted a couple of old nagios plugins to output JSON and I can confirm that it does work in 4.2. However, I've never tried it in 4.1. It is as simple as selecting it in the command data source drop-down however and following this format: http://wiki.zenoss.org/JSON_Parser.
Thanks all!
I have seen the information about the input format.
What I'm trying to understand (before I just stand it up and jump in, fingers crossed) is what needs to be done with the datasource and datapoints? (And Jane, OBTW - yes, this is in the 4.2 branch but might work in 4.1.1).
For example; if I send in JSON with a list of components, and data points for each of them, must those components already exist? Do I also have to write a modeler which complements what will be expected from the JSON parser? OR is the JSON parser smart enough to actually create the corresponding components / items on the fly?
I'm guessing the former, but hopeful for the later.
Richard.
Unfortunately the components have to already exist. If you output metric data with no compent it will be graphed for the device.
For example, here is what my NetApp check outputs. It only passes a single metric, nfsops:
{ "values": { "": { "nfsops": 2191 } }, "events": [ { "severity": 0, "summary": "OK Temp OK failedfan = 0 failedpsu = 0 " } ]
So, all we need now is a generic JSON modeler plugin.
Thanks all!
Follow Us On Twitter »
|
Latest from the Zenoss Blog » | Community | Products | Services Resources | Customers Partners | About Us | ||
Copyright © 2005-2011 Zenoss, Inc.
|
||||||||