Ad Widget

Collapse

How to use HOST.NAME in Preprocessing Step

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • admin@hilton
    Junior Member
    • Jun 2022
    • 7

    #1

    How to use HOST.NAME in Preprocessing Step

    I have created a HTTP Item in a template. The response of the url has the form
    Code:
    {
       "AP-1020": {
          "name": "AP-1020",
          "2g-users": 3,
          "5g-users": 0,
          "online": "Ja"
       },
       "AP-1030": {
          "name": "AP-1030",
          "2g-users": 1,
          "5g-users": 5,
          "online": "Ja"
       },
       ...
    }
    Now I want to use the JSONPath Preprocessing Step with the following selection
    `$.['{HOST.NAME}'].['2g-users']` which should expand to `$.['AP-1030'].['2g-users']` for the Host "AP-1030".
    But all I get is "cannot extract value from json by path "$.['{HOST.NAME}'].['2g-users']": no data matches the specified path". So the {HOST.NAME} macro is not expanded. What am i doing wrong?
  • josoko
    Junior Member
    • Feb 2021
    • 25

    #2
    Maybe are just LLD Macros supported => https://www.zabbix.com/documentation..._functionality

    A JavaScript preprocessing could perhaps help, to fulfill your requirements:
    - https://www.zabbix.com/documentation...ing/javascript

    similar to that:

    Code:
    yourvar = {HOST.NAME}.2g-users;
    return yourvar;

    Comment

    Working...