Create a Post
cancel
Showing results for 
Search instead for 
Did you mean: 
Rabindra_Khadka
Contributor
Jump to solution

How to list and export the objects member from the network group in checkpoint management server

Hello everyone,

 

We need to list all the objects members along with the name and IP-Address from the particular network group to the CSV format. The checkpoint management server is in R80.20 version. Is there any way from commandline or others to exports the object members along with the name and ip address from the particular network group in csv format.

Please help if there is any solution.

@phoneboy 

 

 

 

Thanks 

0 Kudos
38 Replies
Kevin_Stanton
Contributor

found this one courtesy of Bob_Zimmerman and PhoneBoy

https://community.checkpoint.com/t5/API-CLI-Discussion/Get-all-network-objects-from-a-specific-group...

[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",,"10.0.0.0",8
"RFC 192.168/16",,"192.168.0.0",16
"RFC 172.16/12",,"172.16.0.0",12


 

0 Kudos
Agent_Smith
Contributor

This doesn't work with smart1 because we don't have CLI access

How can we export objects from a group to CSV? @PhoneBoy 

0 Kudos
cdooer
Participant

Sorry to revive an old thread, but do you have any idea why I would get this error when attempting to use the above command?

[Expert@fwmgr1:0]# mgmt_cli -r true show-group name ”servers” --format json | jq '.members[] | [.name, ."ipv4-address",.subnet4,."mask-length4"] |@csv' -r
jq: error: Cannot iterate over null

Running R81.10, latest JHF.

0 Kudos
Eric_Beasley
Employee
Employee

The default details level of show-group does not include the information you want show, you can test this by just running the command without piping to JQ, which will reveal the issue.

Add "details-level full" after the name <group_name> and you should get the desired results.

 

 

mgmt_cli -r true -f json show-group name "_your_groupname_here_" details-level full | jq '.members[] | [.name, ."ipv4-address",.subnet4,."mask-length4"] |@csv' -r

 

 

0 Kudos
cdooer
Participant

Thx Eric, that command works. Funny thing is when I manually type it in, it gives me the info I need. When I copy and paste the exact line from notepad, it gives me the Cannot iterate over null error...LOL. Wonder if Notepad is putting a character in somewhere that I can't see. 

0 Kudos
IOB
Explorer

after running the cmd ( mgmt_cli -r true show-group name "groupname" --format json | jq '.members[] | [.name, ."ipv4-address"] |@csv' -r )where can we find the file ???

 

 

0 Kudos
_Val_
Admin
Admin

Try the local folder you are rinning the command from, and also user's home folder

 

0 Kudos
Eric_Beasley
Employee
Employee

The command jq DOES NOT create a CSV file it creates the output in a CSV compliant format, so you need to first create the file with the necessary column headers, then pipe APPEND the output from the mgmt_cli command to that file with the header, which is how you get an actual file.

You should have had a dump of the values to your shell screen, if run without piping the output.

CORRECTED:  Added "details-level full" to ensure all values are available for parsing with JQ

 

 

echo "name","ipv4-address" > groupmembers.csv
mgmt_cli -r true -f json show-group name "_your_groupname_here_" details-level full | jq '.members[] | [.name, ."ipv4-address"] |@csv' -r >> groupmembers.csv

 

 

 

Leaderboard

Epsum factorial non deposit quid pro quo hic escorol.

Upcoming Events

    Tue 23 Apr 2024 @ 11:00 AM (EDT)

    East US: What's New in R82

    Thu 25 Apr 2024 @ 11:00 AM (SGT)

    APAC: CPX 2024 Recap

    Tue 30 Apr 2024 @ 03:00 PM (CDT)

    EMEA: CPX 2024 Recap

    Thu 02 May 2024 @ 11:00 AM (SGT)

    APAC: What's new in R82

    Tue 23 Apr 2024 @ 11:00 AM (EDT)

    East US: What's New in R82

    Thu 25 Apr 2024 @ 11:00 AM (SGT)

    APAC: CPX 2024 Recap

    Tue 30 Apr 2024 @ 03:00 PM (CDT)

    EMEA: CPX 2024 Recap

    Thu 02 May 2024 @ 11:00 AM (SGT)

    APAC: What's new in R82
    CheckMates Events