TECHZEN Zenoss User Community ARCHIVE  

bug: wrongly formatted JSON in zenoss_zep / event_summary / notes_json

Subject: bug: wrongly formatted JSON in zenoss_zep / event_summary / notes_json
Author: Charles Bueche
Posted: 2016-10-13 04:03

Hi,

I think the content of theevent_summary / notes_json field is not correct JSON, here is how to reproduce the problem:add at least two text entries to an event log, e.g. using the GUI. The connect to zenoss_zep daabase andrun this query for your device:

SELECT details_json, notes_jsonFROM event_summaryWHERE element_identifier = 'your-device'

Example value for notes_json:

{"uuid":"00505680-6126-b764-11e6-90e297bb93fa","user_uuid":"7d39251d-a734-45af-9b3a-e0b7acf169d7","user_name":"admin","created_time":1476321356404,"message":"maintenance: False"},
{"uuid":"00505680-6126-b764-11e6-90e29786ef68","user_uuid":"7d39251d-a734-45af-9b3a-e0b7acf169d7","user_name":"admin","created_time":1476321356059,"message":"UUID: NdKMC"}

correct value would be (see the enclosing []):

[{"uuid":"00505680-6126-b764-11e6-90e297bb93fa","user_uuid":"7d39251d-a734-45af-9b3a-e0b7acf169d7","user_name":"admin","created_time":1476321356404,"message":"maintenance: False"},
{"uuid":"00505680-6126-b764-11e6-90e29786ef68","user_uuid":"7d39251d-a734-45af-9b3a-e0b7acf169d7","user_name":"admin","created_time":1476321356059,"message":"UUID: NdKMC"}]

For the record, the beautified result would looks like this:

[
{
"uuid": "00505680-6126-b764-11e6-90e297bb93fa",
"user_uuid": "7d39251d-a734-45af-9b3a-e0b7acf169d7",
"user_name": "admin",
"created_time": 1476321356404,
"message": "maintenance: False"
},
{
"uuid": "00505680-6126-b764-11e6-90e29786ef68",
"user_uuid": "7d39251d-a734-45af-9b3a-e0b7acf169d7",
"user_name": "admin",
"created_time": 1476321356059,
"message": "UUID: NdKMC"
}
]

Now I do need to enclose the string myself and be tolerant in case it gets fixed at some point.

Regs,
Charles



< Previous
Need to create custom event field for zenoss console
  Next
Zenoss Core 5 API or Zendmd script - How Do I create a new SNMPv3 Command using ...
>