Discussion:
JSON parser for zencommand
Richard Evans
2013-05-07 15:16:43 UTC
Permalink
Richard Evans [http://community.zenoss.org/people/Richard.evans%40schwab.com] created the discussion

"JSON parser for zencommand"

To view the discussion, visit: http://community.zenoss.org/message/73085#73085

--------------------------------------------------------------
I found an old ZenPack for createing Event Histograms (see: http://community.zenoss.org/docs/DOC-4538 http://community.zenoss.org/docs/DOC-4538 http://community.zenoss.org/docs/DOC-4538 Event 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



--------------------------------------------------------------

Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/73085#73085]

Start a new discussion in zenoss-users at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
jcurry
2013-05-08 08:18:36 UTC
Permalink
jcurry [http://community.zenoss.org/people/jcurry] created the discussion

"Re: JSON parser for zencommand"

To view the discussion, visit: http://community.zenoss.org/message/73090#73090

--------------------------------------------------------------
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 http://jira.zenoss.com/jira/browse/ZEN-2633 .

Cheers,
Jane
--------------------------------------------------------------

Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/73090#73090]

Start a new discussion in zenoss-users at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
Richard Evans
2013-05-08 14:57:30 UTC
Permalink
Richard Evans [http://community.zenoss.org/people/Richard.evans%40schwab.com] created the discussion

"Re: JSON parser for zencommand"

To view the discussion, visit: http://community.zenoss.org/message/73103#73103

--------------------------------------------------------------
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

--------------------------------------------------------------

Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/73103#73103]

Start a new discussion in zenoss-users at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
Shane Scott
2013-05-10 20:53:34 UTC
Permalink
Shane Scott [http://community.zenoss.org/people/hackman238] created the discussion

"Re: JSON parser for zencommand"

To view the discussion, visit: http://community.zenoss.org/message/73166#73166

--------------------------------------------------------------
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)
http://www.linkedin.com/in/shanewilliamscott/ http://www.linkedin.com/in/shanewilliamscott/
--------------------------------------------------------------

Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/73166#73166]

Start a new discussion in zenoss-users at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
Daniel Rich
2013-05-10 21:00:41 UTC
Permalink
Daniel Rich [http://community.zenoss.org/people/sjthespian] created the discussion

"Re: JSON parser for zencommand"

To view the discussion, visit: http://community.zenoss.org/message/73153#73153

--------------------------------------------------------------
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 http://wiki.zenoss.org/JSON_Parser.
--------------------------------------------------------------

Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/73153#73153]

Start a new discussion in zenoss-users at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
Richard Evans
2013-05-10 23:55:56 UTC
Permalink
Richard Evans [http://community.zenoss.org/people/Richard.evans%40schwab.com] created the discussion

"Re: JSON parser for zencommand"

To view the discussion, visit: http://community.zenoss.org/message/73154#73154

--------------------------------------------------------------
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.
--------------------------------------------------------------

Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/73154#73154]

Start a new discussion in zenoss-users at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
Daniel Rich
2013-05-13 13:55:44 UTC
Permalink
Daniel Rich [http://community.zenoss.org/people/sjthespian] created the discussion

"Re: JSON parser for zencommand"

To view the discussion, visit: http://community.zenoss.org/message/73160#73160

--------------------------------------------------------------
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 "
       }
   ]
--------------------------------------------------------------

Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/73160#73160]

Start a new discussion in zenoss-users at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
Richard Evans
2013-05-13 18:49:32 UTC
Permalink
Richard Evans [http://community.zenoss.org/people/Richard.evans%40schwab.com] created the discussion

"Re: JSON parser for zencommand"

To view the discussion, visit: http://community.zenoss.org/message/73182#73182

--------------------------------------------------------------
So, all we need now is a generic JSON modeler plugin.

Thanks all!
--------------------------------------------------------------

Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/73182#73182]

Start a new discussion in zenoss-users at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
Loading...