jack99trade commented on issue #6722: URL: https://github.com/apache/cloudstack/issues/6722#issuecomment-1248926600
> @jack99trade so the data input structure would depend on the specific d3 library that's being used I believe. For example, if you are using a network graph ( https://d3-graph-gallery.com/network.html) then we could structure it as follows: > > ``` > { "nodes": [ > { "id": 1, "name": "Net1" }, > { "id": 2, "name": "VM1" } > ], > "links": [ > { "source": 1, "target": 2 } ---> which would connect Net1 to VM1 > ]} > ``` > > But if you want to view it in a hierarchical manner then the data is structured differently something like - https://github.com/bumbeishvili/sample-data/blob/main/sample.json and we need to take care of how the parentId is set in this case Hi @Pearl1594 , I am unbale to convert my data in format of Nodes and Links, Programmatically like below:- { "nodes": [ { "id": 1, "name": "Net1" }, { "id": 2, "name": "VM1" } ], "links": [ { "source": 1, "target": 2 } ---> which would connect Net1 to VM1 ]} So this is what i have done so far :- A. downloaded the JSON using API = /client/api/?command=listVirtualMachinesMetrics&response=json B. Able to get list of all VMs and connection to Network from each VM # cat data.json | jq '.listvirtualmachinesmetricsresponse.virtualmachine[] .name' | wc -l 3 # cat data.json | jq '.listvirtualmachinesmetricsresponse.virtualmachine[] .name' "UbuntuMachine" "FortinetFW" "PaloAltoFW" # cat data.json | jq '.listvirtualmachinesmetricsresponse.virtualmachine[0] .nic[] .networkname' "MGMT_NET" "WAN_NET" "LAN_NET" # cat data.json | jq '.listvirtualmachinesmetricsresponse.virtualmachine[1] .nic[] .networkname' "LAN_NET" # cat data.json | jq '.listvirtualmachinesmetricsresponse.virtualmachine[2] .nic[] .networkname' "LAN_NET" now I want to represent this in Nodes and Links format , I am still researching on this. This is tricky for me. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
