Create a Post
Showing results for 
Search instead for 
Did you mean: 

Get all network objects from a specific group with api

We tried this code

mgmt_cli -r true show-group name 'group name' --format json | jq '.members[] | [.name, ."ipv4-address"] | @scv' -r

we have used this command to get all network object from a specific group (objects names and IP addresses) but we have encountered a problem.

Objects defined as networks (with a subnet mask of or higher) do not have IP addresses assigned to them

0 Kudos
2 Replies

Yeah, objects of type network do not have an element called ipv4-address.
Haven't tried this, but maybe this will work: 

mgmt_cli -r true show-group name 'group name' --format json | jq '.members[] | [.name, ."ipv4-address", .subnet4, ."mask-length4" ] | @scv' -r

For host objects, you'll see the IPv4 address.
For networks, you'll get the IPv4 network and mask length.

0 Kudos

Minor typo: @scv should be @csv in the end. It works otherwise:

[Expert@DallasSA]# mgmt_cli -r true show-group name 'RFC 1918 Addresses' --format json | jq '.members[] | [.name, ."ipv4-address", .subnet4, ."mask-length4" ] | @csv' -r
"RFC 10/8",,"",8
"RFC 192.168/16",,"",16
"RFC 172.16/12",,"",12

Note that this only covers hosts and networks. Address ranges have another set of properties, DNS domains work solely based on the name of the object, and wildcards have yet another set of properties. Groups can also contain groups, which gets really complicated to handle.

As long as you know roughly the contents of the group ahead of time, this is fine.

0 Kudos


Epsum factorial non deposit quid pro quo hic escorol.

Upcoming Events

    CheckMates Events