Create a Post
cancel
Showing results for 
Search instead for 
Did you mean: 
ram_kum
Participant
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

 

0 Kudos
1 Solution

Accepted Solutions
ram_kum
Participant

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)

 

View solution in original post

0 Kudos
2 Replies
_Val_
Admin
Admin

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

 

0 Kudos
ram_kum
Participant

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)

 

0 Kudos

Leaderboard

Epsum factorial non deposit quid pro quo hic escorol.

Upcoming Events

    CheckMates Events