Host.get can only get proxy_hostid of proxy can not get name host?
Ad Widget
Collapse
Host.get can only get proxy_hostid of proxy can not get name host?
Collapse
X
-
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 -
This is what I'm doing:
dump proxy and preservekeys and save to proxy.keys.json
dump items from host to hosts.jsonCode:obj = zapi.proxy.get( preservekeys=True, output=('host',), limit=1000, )
run jq:
Depending on the json, you might need to make .hosts[] just .[]Code:jq 'input as { $proxies } | .hosts[] |= . + { proxy_host: $proxies[.proxy_hostid].host }' hosts.json proxies.keys.json > hosts_and_proxyname.json
Anyway, hope that helpsComment
Comment