Created
July 2, 2018 10:21
-
-
Save iRedds/2c9865f7cb43bc286b8a72fb9cfe7d3c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import sys | |
obj = json.loads(sys.stdin.read()) | |
for row in obj["result"]: | |
ip = [] | |
for ifs in row["interfaces"]: | |
ip.append("[id:{0},ip:{1}]".format(ifs["interfaceid"], ifs["ip"])) | |
print ("hostid : {0}, host : {1}, interfaces : {2}".format(row["hostid"], row["host"], ', '.join([str(x) for x in ip]))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment