Ad Widget

Collapse

Need help in creating preprocessing to have the items of JSON data through discovery

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ganesh.singavarapu
    Junior Member
    • Nov 2022
    • 2

    #1

    Need help in creating preprocessing to have the items of JSON data through discovery

    Hello team,
    I'm using JSON formatted data in Zabbix discovery and I want to create items separately for each UNIQUEIDENTIFIER. I were unable to create items with necessary items data since the index of JSONPath in preprocessing starts from 0, where as I have combination of letters, characters & symbols in UNIQUEIDENTIFIER. Please help me to create individual items dynamically for each UNIQUEIDENTIFIER from the below data.

    [
    {
    "{#UNIQUEIDENTIFIER}": "ABAP System not available BA4~ABAP",
    "{#ALERTNAME}": "ABAP System not available",
    "{#MANAGEDOBJECT}": "BA4~ABAP",
    "{#TYPE}": "Technical System",
    "{#SYSTEMID}": "BA4",
    "{#TSTYPE}": "ABAP",
    "{#INSTANCEDESCRIPTION}": "",
    "{#CURRENT}": "Green",
    "{#PRIORITY}": "Medium",
    "{#WORST}": "Red",
    "{#TOTAL}": "3",
    "{#CHANGES}": "1"
    },
    {
    "{#UNIQUEIDENTIFIER}": "High number of ABAP Short Dumps BA4~ABAP",
    "{#ALERTNAME}": "High number of ABAP Short Dumps",
    "{#MANAGEDOBJECT}": "BA4~ABAP",
    "{#TYPE}": "Technical System",
    "{#SYSTEMID}": "BA4",
    "{#TSTYPE}": "ABAP",
    "{#INSTANCEDESCRIPTION}": "",
    "{#CURRENT}": "Green",
    "{#PRIORITY}": "Medium",
    "{#WORST}": "Yellow",
    "{#TOTAL}": "210",
    "{#CHANGES}": "2"
    },
    {
    "{#UNIQUEIDENTIFIER}": "Batch Job Errors BA4~ABAP",
    "{#ALERTNAME}": "Batch Job Errors",
    "{#MANAGEDOBJECT}": "BA4~ABAP",
    "{#TYPE}": "Technical System",
    "{#SYSTEMID}": "BA4",
    "{#TSTYPE}": "ABAP",
    "{#INSTANCEDESCRIPTION}": "",
    "{#CURRENT}": "Green",
    "{#PRIORITY}": "Medium",
    "{#WORST}": "Red",
    "{#TOTAL}": "478",
    "{#CHANGES}": "38"
    },
    {
    "{#UNIQUEIDENTIFIER}": "Bad system response time BA4~ABAP",
    "{#ALERTNAME}": "Bad system response time",
    "{#MANAGEDOBJECT}": "BA4~ABAP",
    "{#TYPE}": "Technical System",
    "{#SYSTEMID}": "BA4",
    "{#TSTYPE}": "ABAP",
    "{#INSTANCEDESCRIPTION}": "",
    "{#CURRENT}": "Grey",
    "{#PRIORITY}": "Low",
    "{#WORST}": "Red",
    "{#TOTAL}": "264",
    "{#CHANGES}": "47"
    }
    ]
    Last edited by ganesh.singavarapu; 05-03-2025, 09:52.
  • Brambo
    Senior Member
    • Jul 2023
    • 245

    #2
    Simply said get rid of those # in the json.
    Use LLD {#UID} $.UNIQUEIDENTIFIER
    Item priority
    key: yoursupedupajson.priority[{#UID}}
    Item prototype > depending item > Pre-Processing > Jsonpath $[?(@.UNIQUEIDENTIFIER=="{#UID}")].PRIORITY.first()

    Comment

    • cyber
      Senior Member
      Zabbix Certified SpecialistZabbix Certified Professional
      • Dec 2006
      • 4806

      #3
      Originally posted by Brambo
      Simply said get rid of those # in the json.
      i have said it somewhere before and will say again... it is OK to use LLD macros as keys in json. If you look on any of "discovery" items like vfs.fs.discovery, they return data preformatted, so you do not need to have those LLD macro definitions any more..

      Code:
      [
      {
      "{#FSNAME}": "/sys",
      "{#FSTYPE}": "sysfs"
      },
      {
      "{#FSNAME}": "/proc",
      "{#FSTYPE}": "proc"
      },
      ...
      ]

      Comment

      Working...