Ad Widget

Collapse

Discovery Rule with HTTP Agent and Item Prototype

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hildebrd
    Junior Member
    • Jan 2022
    • 6

    #1

    Discovery Rule with HTTP Agent and Item Prototype

    my goal is to create a list of port Items that i can then fill with the information "portname" and "alias description" and so one

    I try to get a Switch Port List (Names and Alias) from a Discovery Rule type HTTP_AGENT. I get the Information from our InfluxDB.
    From my HTTP Request i get a CSV and after Preprossing (1) CSV To JSON and (2) JSONPATH $.[4:-1] i have These json formatet String:

    [
    {"1":"","2":"","3":"0","4":"2022-05-04T10:09:00.861155712Z","5":"2022-05-04T10:19:00.861155712Z","6":"Fa0","7":""},
    {"1":"","2":"","3":"0","4":"2022-05-04T10:09:00.861155712Z","5":"2022-05-04T10:19:00.861155712Z","6":"Gi1/0/25","7":""},
    {"1":"","2":"","3":"0","4":"2022-05-04T10:09:00.861155712Z","5":"2022-05-04T10:19:00.861155712Z","6":"Gi1/0/26","7":""},
    {"1":"","2":"","3":"0","4":"2022-05-04T10:09:00.861155712Z","5":"2022-05-04T10:19:00.861155712Z","6":"Gi1/0/27","7":""},
    {"1":"","2":"","3":"0","4":"2022-05-04T10:09:00.861155712Z","5":"2022-05-04T10:19:00.861155712Z","6":"Gi1/0/12","7":"*** Access LAN ***"},
    {"1":"","2":"","3":"0","4":"2022-05-04T10:09:00.861155712Z","5":"2022-05-04T10:19:00.861155712Z","6":"Gi1/0/13","7":"*** Access LAN ***"},
    {"1":"","2":"","3":"0","4":"2022-05-04T10:09:00.861155712Z","5":"2022-05-04T10:19:00.861155712Z","6":"Gi1/0/14","7":"*** Access LAN ***"},
    ...
    {,{"1":"","2":"","3":"0","4":"2022-05-04T10:09:00.861155712Z","5":"2022-05-04T10:19:00.861155712Z","6":"Gi2/0/17","7":"AP"},
    {"1":"","2":"","3":"0","4":"2022-05-04T10:09:00.861155712Z","5":"2022-05-04T10:19:00.861155712Z","6":"Gi2/0/18","7":"AP"},
    {"1":"","2":"","3":"0","4":"2022-05-04T10:09:00.861155712Z","5":"2022-05-04T10:19:00.861155712Z","6":"Gi1/0/21","7":""FW Node 1","8":" Port 0","9":" Internet","10":" Backup""},
    ...
    ,{}
    ]

    My LLD Macros ({#PORT}=$.[*]["6"]

    ITEM Prototype has a Type Trapper

    Name: portname"{#PORT}"
    Type: Zabbix trapper
    Key: port[{#PORT}]
    Type of information:Text

    If i execute the Discovery Role i get
    "Cannot create item: item with the same key "port[{#PORT}]" already exists.
    Cannot create item: item with the same key "port[{#PORT}]" already exists."



    ...

    Click image for larger version

Name:	DiscoveryRole.png
Views:	603
Size:	78.6 KB
ID:	444119

    Click image for larger version

Name:	2022-05-04 13.07.18 hamdcsvmon090.gh.de 9079b1c8a362.png
Views:	480
Size:	72.4 KB
ID:	444120


    Click image for larger version

Name:	2022-05-04 13.08.08 hamdcsvmon090.gh.de 0f84bad43d7c.png
Views:	503
Size:	22.9 KB
ID:	444121
    Click image for larger version

Name:	2022-05-04 13.08.24 hamdcsvmon090.gh.de a2fe6899ede0.png
Views:	471
Size:	26.8 KB
ID:	444122
    Click image for larger version

Name:	2022-05-04 13.08.38 hamdcsvmon090.gh.de 1c7c619e7049.png
Views:	475
Size:	32.8 KB
ID:	444123

  • junkangli
    Junior Member
    • Oct 2023
    • 5

    #2
    The JSONPath for your LLD macro should be from individual item in the data array. So, for {#PORT} instead of $.[*]["6"], it should just be $["6"].
    Make use of the preprocessing testing1 to test your expression.
    [1]https://www.zabbix.com/documentation...essing/testing

    Comment

    Working...