Ad Widget

Collapse

Using low level discovery macros on url portion for http agent in item prototype?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • zippyzebu
    Junior Member
    • Jul 2020
    • 3

    #1

    Using low level discovery macros on url portion for http agent in item prototype?

    Hi,

    I have json data like (set to userparameter app.discovwry)

    Code:
    {"app1": {"rss": "46565", "pid": "67676", uri: "app1.com"},
     "app2": {"rss": "67879", "pid": "10003", uri: "app2.com"},
    }
    I created a item app.info to get this data and then making discovery with it as dependent item on preprocessing step with smple javascript

    Code:
    return JSON.stringify(Object.keys(JSON.parse(value))
    .map(function (v){return {"{#APP}": v}}));
    This gives output as
    Code:
    [{{#APP}: "app1"}, {{#APP}: "app2"|]
    Then I create item prototype (dependent item)with preprocessing step like

    JSonPath: $.["{#APP}"].pid
    Key: app.pid["{#APP}"]
    Application Prototype: APP: {#APP}

    So we can have App1, App2 in latest data as application and relevant metrics inside it.

    And Everything works at this step.

    My goal is to create item prototype of TYPE http agent (and not as dependent item) and set url host to
    Code:
    $.["{#APP}"].uri
    so that I can make a post/get request with it for example, https://{#APP_URI}/some/fix/path.

    I tried to set LLD macro to {#APP_URI} to
    Code:
    $.["{#APP}"].uri
    but it didn't seem to work since it only allows traverse through json path. Also tried $..uri which pulls an array.

    How can set that macro ? Is there any other way I can make uri of http agent dynamic baed on app1/app2 ?

    Thanks.
    Last edited by zippyzebu; 15-07-2020, 22:33.
Working...