Archived community.zenoss.org | full text search
Skip navigation
1934 Views 7 Replies Latest reply: May 13, 2013 2:49 PM by Richard Evans RSS
Richard Evans Rank: White Belt 13 posts since
Jan 11, 2012
Currently Being Moderated

May 7, 2013 11:16 AM

JSON parser for zencommand

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

 

 


  • jcurry ZenossMaster 1,021 posts since
    Apr 15, 2008
    Currently Being Moderated
    1. May 8, 2013 4:18 AM (in response to Richard Evans)
    Re: JSON parser for zencommand

    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

  • Shane Scott ZenossMaster 1,373 posts since
    Jul 6, 2009
    Currently Being Moderated
    3. May 10, 2013 4:53 PM (in response to Richard Evans)
    Re: JSON parser for zencommand

    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/

  • Daniel Rich Rank: White Belt 21 posts since
    Mar 5, 2012
    Currently Being Moderated
    4. May 10, 2013 5:00 PM (in response to Shane Scott)
    Re: JSON parser for zencommand

    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.

  • Daniel Rich Rank: White Belt 21 posts since
    Mar 5, 2012
    Currently Being Moderated
    6. May 13, 2013 9:55 AM (in response to Richard Evans)
    Re: JSON parser for zencommand

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

More Like This

  • Retrieving data ...

Legend

  • Correct Answers - 4 points
  • Helpful Answers - 2 points