Ad Widget

Collapse

Require help in config JSONPath in item prototype preprocessing.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vijayk
    Senior Member
    • May 2023
    • 305

    #1

    Require help in config JSONPath in item prototype preprocessing.

    Hi,

    I have configured the discovery rule with the help of external script and retrieve the JSON data as below format.
    {
    "data": [
    {
    "{#IPCNO}": "1",
    "{#IPCNAME}": "Main Road ",
    "{#IPCIP}": "192.168.1.1",
    "{#IPCPORT}": "80",
    "{#IPCSTATUS}": "ONLINE",
    "{#IPCMODEL}": "IPC2343EBR-DZ28 IPC.Software: DIPC-B1219.6.13.220512 ",
    "{#IPCSOFTWARE}": "DIPC-B1219.6.13.220512 "
    },
    {
    "{#IPCNO}": "2",
    "{#IPCNAME}": "Gate Road ",
    "{#IPCIP}": "192.168.1.2",
    "{#IPCPORT}": "80",
    "{#IPCSTATUS}": "OFLINE",
    "{#IPCMODEL}": "IPC3A33LB-F60K IPC.Software: DIPC-B1219.6.13.220512 ",
    "{#IPCSOFTWARE}": "DIPC-B1219.6.13.220512 "
    }
    ]
    }

    Now I want to create the item prototype which return the IPCSTATUS in value.

    I have tried the JSONPath preprocessing but it's not working.

    Can someone please help me?
  • bbonno
    Junior Member
    • Apr 2025
    • 22

    #2
    The following JSONPath works with the JSON you provided above, and returns the status of ICPNO 2.

    However, from your question i can't tell where in the prototype createn you are stuck, and there are number of things you need to get right before your first item prototype will work.
    Can you provide some screenshots, especially of any errors?


    $.data[?(@["{#IPCNO}"]==1)].["{#IPCSTATUS}"]
    Click image for larger version

Name:	image.png
Views:	50
Size:	87.4 KB
ID:	502340

    Comment

    • vijayk
      Senior Member
      • May 2023
      • 305

      #3
      bbonno Thanks for the help. My issue is resolved with JavaScript instead of JSONPath.

      Comment

      Working...