Ad Widget

Collapse

2.2.0 - JSON issues - Value should be a JSON object

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Rataplan626
    Junior Member
    • Jun 2013
    • 9

    #1

    2.2.0 - JSON issues - Value should be a JSON object

    Hi,
    I have several discovery rules that get input through JSON, with zabbix_trapper or external scripts. That worked fine until I updated to 2.2.0. In the what's new for 2.2.0 it states:

    5.25.8 JSON validation on server

    Previously, a slightly incorrect JSON could silently get accepted by the Zabbix server. Starting with Zabbix 2.2, syntax validation is performed, before parsing JSON data. Opening invalid JSON data will immediately return failure and the parsing error will be logged as warning.
    Ok, that's fine with me although excactly WHAT format does zabbix expect? Even the examples given in the 2.2.0 documentation don't work for me anymore.
    The error I get on the discovery-keys 'Value should be a JSON format' and the values are not processed. While I am keeping to the format the Zabbix documentation gives me, I checked with http://jsonlint.com/ and everything is fine (as well as the examples by the way). An example of my JSON string:

    {
    "data":[
    {"{#PSU}":"psu_1.1","{#DESC}":"PSU 1, Left"},
    {"{#PSU}":"psu_1.2","{#DESC}":"PSU 2, Right"}
    ]
    }

    What's wrong?
    Last edited by Rataplan626; 09-12-2013, 18:16.
  • Rataplan626
    Junior Member
    • Jun 2013
    • 9

    #2
    Fixed by updating to 2.2.1

    I've just updated my test environment to 2.2.1 and everything works fine again with the very same JSON data. While I didn't see it mentioned in the release notes, there is probably a JSON parser bugfix in 2.2.1.

    Comment

    • netopier
      Junior Member
      • Mar 2012
      • 16

      #3
      Hello, I have same problem on version 2.2.2. My script output is:

      Code:
      {
      	"data":[
      
      	{
      		"{#SNMPJSONINDEX}":"57",
      		"{#SNMPJSONDESCR}":"Port-channel1"
      	}
      	{
      		"{#SNMPJSONINDEX}":"49",
      		"{#SNMPJSONDESCR}":"GigabitEthernet1/48"
      	}
      	{
      		"{#SNMPJSONINDEX}":"48",
      		"{#SNMPJSONDESCR}":"GigabitEthernet1/47"
      	}
      
      	]
      }

      Some debug:
      Code:
      15484:20140220:110036.308 In substitute_key_macros() data:'snmpbulkwalk.pl[{HOST.HOST}]'
      15484:20140220:110036.308 In substitute_simple_macros() data:'{HOST.HOST}'
      15484:20140220:110036.308 End substitute_simple_macros() data:'brrS00'
      15484:20140220:110036.308 End of substitute_key_macros():SUCCEED data:'snmpbulkwalk.pl[brrS00]'
      15484:20140220:110036.308 In get_value() key:'snmpbulkwalk.pl[{HOST.HOST}]'
      15484:20140220:110036.308 In get_value_external() key:'snmpbulkwalk.pl[{HOST.HOST}]'
      15484:20140220:110036.308 In zbx_popen() command:'/usr/lib/zabbix/externalscripts/snmpbulkwalk.pl "brrS00"'
      15484:20140220:110036.308 End of zbx_popen():7
      15636:20140220:110036.307 End of zbx_vc_add_value():FAIL
      But zabbix still says: value should be json object
      Thanks a lot for any help.
      Last edited by netopier; 20-02-2014, 12:12.

      Comment

      • netopier
        Junior Member
        • Mar 2012
        • 16

        #4
        NVM found problem lost comma between interfaces...

        Comment

        Working...