Ad Widget

Collapse

Host.get can only get proxy_hostid of proxy can not get name host?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • duzhuo
    Junior Member
    • Jan 2016
    • 2

    #1

    Host.get can only get proxy_hostid of proxy can not get name host?

    Host.get can only get proxy_hostid of proxy can not get name host?
  • dmarsh
    Junior Member
    • Jun 2009
    • 17

    #2
    I'm struggling with this problem as well. I asked a question in stack overflow on how to do this with json files:

    https://stackoverflow.com/questions/...le-as-a-source

    Comment

    • dmarsh
      Junior Member
      • Jun 2009
      • 17

      #3
      This is what I'm doing:

      dump proxy and preservekeys and save to proxy.keys.json

      Code:
      obj = zapi.proxy.get(
          preservekeys=True,
          output=('host',),
          limit=1000,
      )
      dump items from host to hosts.json

      run jq:

      Code:
      jq 'input as { $proxies } | .hosts[] |= . + { proxy_host: $proxies[.proxy_hostid].host }' hosts.json proxies.keys.json > hosts_and_proxyname.json
      Depending on the json, you might need to make .hosts[] just .[]

      Anyway, hope that helps

      Comment

      Working...