- CheckMates
- :
- Products
- :
- Developers
- :
- API / CLI Discussion
- :
- Re: ha state in json format
Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
Are you a member of CheckMates?
×
Sign in with your Check Point UserCenter/PartnerMap account to access more great content and get a chance to win some Apple AirPods! If you don't have an account, create one now for free!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jump to solution
ha state in json format
Hi checkpoint guru's,
I am trying to print ha state info from firewalls but the output i am getting is not a json format, any tips to return my output in json or readable format?, below is my script and attached is my current output, thank you all
ha_state = self.run_script("clish -c '''show cluster state'''")
time.sleep(3)
show_ha_config = self.show_task(ha_state)
show_ha_config = show_ha_config["tasks"][0]["task-details"][0][
"output"
]
ha_decoded = base64.b64decode(
bytes(show_ha_config, "utf-8")
).decode("ascii")
ha_conf = ha_decoded.split("\n")
logout_result = self.api_call(self.node, "443", "logout", {}, self.sid)
return ha_conf
1 Solution
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
thank you @_Val_ , i have changed my api call to below and able to get ha state output in json
sh_state = api_call('my_ipaddress', 443,'show-cluster-state', {} ,sid) return (sh_state)
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There is a Gaia API call for this, check out https://sc1.checkpoint.com/documents/latest/GaiaAPIs/#web/show-cluster-state~v1.7%20
This command should work for you, I think:
# mgmt_cli show cluster state --context gaia_api
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
thank you @_Val_ , i have changed my api call to below and able to get ha state output in json
sh_state = api_call('my_ipaddress', 443,'show-cluster-state', {} ,sid) return (sh_state)
