TECHZEN Zenoss User Community ARCHIVE  

JSON interface returning unexpected results

Subject: JSON interface returning unexpected results
Author: Larry Virden
Posted: 2016-06-07 14:23

So, I am trying to gather information about one specific event in my event console. I type:

[root@b00f10944a2e bin]# source /serviced/movedir/bin/json_api.sh

[root@b00f10944a2e bin]# zenoss_api evconsole_router EventsRouter query '{"limit":1,"params":{"eventKey":7603098}}' > /tmp/json

[root@b00f10944a2e bin]# cat /tmp/json

{"uuid": "44134118-190b-43ba-9fce-1ec1db4ddf42", "action": "EventsRouter", "result": {"totalCount": 3, "events": [{"prodState": "Production", "firstTime": 1465322083.331, "facility": null, "eventClassKey": null, "agent": "myApplication", "dedupid": "mydevice|myApplication|/Status/Heartbeat|4|mydevice myApplication heartbeat failure", "Location": [], "ownerid": null, "eventClass": {"text": "/Status/Heartbeat", "uid": "/zport/dmd/Events/Status/Heartbeat"}, "id": "0242ac11-0016-9c31-11e6-2cd8ea19183c", "DevicePriority": null, "monitor": "mydevice", "priority": null, "details": {"zenoss.device.production_state": ["1000"]}, "DeviceClass": [], "eventKey": null, "evid": "0242ac11-0016-9c31-11e6-2cd8ea19183c", "eventClassMapping": "", "component": {"url": null, "text": "myApplication", "uid": null, "uuid": null}, "clearid": null, "DeviceGroups": [], "eventGroup": null, "device": {"url": null, "text": "mydevice", "uuid": null, "uid": null}, "message": "mydevice myApplication heartbeat failure", "severity": 4, "count": 3, "stateChange": 1465322083.331, "ntevid": null, "summary": "mydevice myApplication heartbeat failure", "eventState": "New", "lastTime": 1465322203.335, "ipAddress": "", "Systems": []}], "success": true, "asof": 1465322258.592518}, "tid": 1, "type": "rpc", "method": "query"}

[root@b00f10944a2e bin]#

The value returned does not match the key supplied - even though the key is on the screen when I am running the command



Subject: Well, I think I have solved the issue
Author: Larry Virden
Posted: 2016-06-08 07:09

I didn't have the eventKey quoted - when I changed to use query '{"limit":1,"params":{"eventKey":"7603098"}}'

I began getting the results expected.



< Previous
Zenoss Core 5 event console no longer displaying new events in the event archive
  Next
User Restriction, Graph, Incidents
>