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

Unable to Export the objects name and ip under the network object group from full ha Standalone

Hi,

 

Unable to Export the objects name and ip under the network object group from full ha Standalone through below command but shows error.

[Expert@PATNA-CP1:0]# mgmt_cli -r true show-group name "CYBERSECURITY-BLOCKED-IP" --format json | jq '.members[] | [.name, ."ipv4-address"] |@csv' -r > File.csv
parse error: Invalid numeric literal at line 1, column 9
Logout failed
[Expert@PATNA-CP1:0]#

0 Kudos
6 Replies
PhoneBoy
Admin
Admin

Start with the mgmt_cli command without piping it into JQ, e.g. mgmt_cli -r true show-group name "CYBERSECURITY-BLOCKED-IP" --format json
Does it return what looks like valid results or does it fail somehow?
Also note that groups can contain many different types of objects.
More discussion around this topic here: https://community.checkpoint.com/t5/API-CLI-Discussion/How-to-list-and-export-the-objects-member-fro...

0 Kudos
Satya2021
Contributor

Still not able to export and through below command just showing all ip under Group 

[Expert@INT-FW-CONSOLE:0]# mgmt_cli -r true show-group name "ADC_PC" --format json
{
"uid" : "44020209-ea3d-4de6-8c5f-dbc484a59cdc",
"name" : "ADC_PC",
"type" : "group",
"domain" : {
"uid" : "41e821a0-3720-11e3-aa6e-0800200c9fde",
"name" : "SMC User",
"domain-type" : "domain"
},
"members" : [ {
"uid" : "cf416de0-e3ba-4d19-88e0-954731d34785",
"name" : "ADC_10.192.8.173",
"type" : "host",
"domain" : {
"uid" : "41e821a0-3720-11e3-aa6e-0800200c9fde",
"name" : "SMC User",
"domain-type" : "domain"
},
"ipv4-address" : "10.192.8.173"
}, {
"uid" : "5d956a72-8f5c-4216-8392-99e54e410f84",
"name" : "CBS_10.192.8.151",
"type" : "host",
"domain" : {
"uid" : "41e821a0-3720-11e3-aa6e-0800200c9fde",
"name" : "SMC User",
"domain-type" : "domain"
},
"ipv4-address" : "10.192.8.151"
}, {
"uid" : "88e5919b-9c2c-4787-9564-edb2acf82ba9",
"name" : "ADC_10.192.8.179",
"type" : "host",
"domain" : {
"uid" : "41e821a0-3720-11e3-aa6e-0800200c9fde",
"name" : "SMC User",
"domain-type" : "domain"
},
"ipv4-address" : "10.192.8.179"
}, {
"uid" : "2244e5eb-959b-4aae-b216-794c1c0a4412",
"name" : "ADC_10.192.8.162",
"type" : "host",
"domain" : {
"uid" : "41e821a0-3720-11e3-aa6e-0800200c9fde",
"name" : "SMC User",
"domain-type" : "domain"
},
"ipv4-address" : "10.192.8.162"
}, {
"uid" : "f445ff53-1adb-4f11-85af-9f09b37a583d",
"name" : "IP_10.192.8.120",
"type" : "host",
"domain" : {
"uid" : "41e821a0-3720-11e3-aa6e-0800200c9fde",
"name" : "SMC User",
"domain-type" : "domain"
},
"ipv4-address" : "10.192.8.120"
}, {
"uid" : "03e6483b-d08d-4d9a-ba88-e78c86f342e7",
"name" : "ADC_10.192.8.167",
"type" : "host",
"domain" : {
"uid" : "41e821a0-3720-11e3-aa6e-0800200c9fde",
"name" : "SMC User",
"domain-type" : "domain"
},
"ipv4-address" : "10.192.8.167"
}, {
"uid" : "91067dd8-e8be-46da-a586-86edab17d607",
"name" : "CBS_10.192.8.153",
"type" : "host",
"domain" : {
"uid" : "41e821a0-3720-11e3-aa6e-0800200c9fde",
"name" : "SMC User",
"domain-type" : "domain"
},
"ipv4-address" : "10.192.8.153"
}, {
"uid" : "eb2f295d-1b0c-4520-8b6c-1416818fff82",
"name" : "IP_10.192.8.149",
"type" : "host",
"domain" : {
"uid" : "41e821a0-3720-11e3-aa6e-0800200c9fde",
"name" : "SMC User",
"domain-type" : "domain"
},
"ipv4-address" : "10.192.8.149"
}, {
"uid" : "a1d67181-6c47-48f6-9a13-8d66593ee36a",
"name" : "ADC_10.192.8.175",
"type" : "host",
"domain" : {
"uid" : "41e821a0-3720-11e3-aa6e-0800200c9fde",
"name" : "SMC User",
"domain-type" : "domain"
},
"ipv4-address" : "10.192.8.175"
}, {
"uid" : "b668e4ff-3f99-4ca6-b813-f5e68b276f85",
"name" : "IP_10.192.8.176",
"type" : "host",
"domain" : {
"uid" : "41e821a0-3720-11e3-aa6e-0800200c9fde",
"name" : "SMC User",
"domain-type" : "domain"
},
"ipv4-address" : "10.192.8.176"
} ],
"groups" : [ ],
"comments" : "",
"color" : "black",
"icon" : "General/group",
"tags" : [ ],
"meta-info" : {
"lock" : "unlocked",
"validation-state" : "ok",
"last-modify-time" : {
"posix" : 1578592817565,
"iso-8601" : "2020-01-09T23:30+0530"
},
"last-modifier" : "System",
"creation-time" : {
"posix" : 1578592817565,
"iso-8601" : "2020-01-09T23:30+0530"
},
"creator" : "System"
},
"read-only" : false
}
[Expert@INT-FW-CONSOLE:0]#

0 Kudos
PhoneBoy
Admin
Admin

I didn't mean for you to paste the output 🙂
However, when I took that output and piped it through the jq part of that command, I got a valid result.

In general, when troubleshooting these issues, I take the first part of the command and make sure I get valid output.
Then add to it.
So, I'd start with all the stuff before you pipe to jq, then add in the other parts a bit at a time.
For example:

  • mgmt_cli -r true show-group name "CYBERSECURITY-BLOCKED-IP" --format json
  • mgmt_cli -r true show-group name "CYBERSECURITY-BLOCKED-IP" --format json | jq '.members[]'
  • mgmt_cli -r true show-group name "CYBERSECURITY-BLOCKED-IP" --format json | jq '.members[] | [.name, ."ipv4-address"]'

That gives you a clue where the error might be.
However, I suspect you ran into some sort of transient error. when you first ran the command.

0 Kudos
Satya2021
Contributor

Thanks for this!! 

But actually I want to export ips under Group object(CYBERSECURITY-BLOCKED-IP) in csv format and for this I am running below command and output is showing error.

 

[Expert@PATNA-CP1:0]# mgmt_cli -r true show-group name "CYBERSECURITY-BLOCKED-IP" --format json | jq '.members[] | [.name, ."ipv4-address"] |@csv' -r > File.csv
parse error: Invalid numeric literal at line 1, column 9
Logout failed
[Expert@PATNA-CP1:0]#

0 Kudos
PhoneBoy
Admin
Admin

Clearly there is something about your jq that is failing for that particular object.
Please go through the commands I provided in order and see what command gives you an error.

Remember that a group can contain host, network, or group objects. 
My guess is that group contains more than just host objects.
The attributes for network and group objects are different, thus the jq command as provided won't work.

0 Kudos
Satya2021
Contributor

hanks PhoneBoy!!

Same command I have run other customer and it workred but if i run this command on this customer, its not working

0 Kudos

Leaderboard

Epsum factorial non deposit quid pro quo hic escorol.

Upcoming Events

    CheckMates Events