Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-21205

Oracle by Zabbix Agent 2 - oracle.custom.query makes wrong json for LLD

XMLWordPrintable

      My configuration is:

      Name: Oracle: Get jobs status
      Type: Zabbix agent
      Key: oracle.custom.query["\{$ORACLE.CONNSTRING}","\{$ORACLE.USER}","\{$ORACLE.PASSWORD}","\{$ORACLE.SERVICE}",jobs]
      Type of intformation: Text

      I want to use this item in Item Prototype of Discovery rule as a master item.

      My jobs.sql is:

      SELECT JSON_ARRAYAGG(JSON_OBJECT(to_char(JOB) VALUE JSON_OBJECT('broken' VALUE BROKEN)) RETURNING CLOB) JOBS FROM DBA_JOBS
      

      From PL/SQL Developer I've got this output (column name is JOBS):

      [{"84":{"broken":"N"}},{"41":{"broken":"N"}},{"1":{"broken":"N"}},{"21":{"broken":"N"}}]
      

      But oracle plugin returns incorrect JSON object:

      $ zabbix_get -s db.corp -k 'oracle.custom.query["tcp://192.168.1.4:1521","zabbix_mon","******","TEST",jobs]'
      [{"JOBS":"[{\"84\":{\"broken\":\"N\"}},{\"41\":{\"broken\":\"N\"}},{\"1\":{\"broken\":\"N\"}},{\"21\":{\"broken\":\"N\"}}]"}]
      

      Here is the `JOBS` have a string, not array. I thnk it's because of json.Marshal(), there's HTMLEscape by default. Any solutions?
       

            sjurgensons Stanislavs Jurgensons
            dsd7150 Denis
            Team INT
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: