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

APIResponse received a response which is not a valid JSON

Hello All:

While testing demo-playbook.yml, I get the following error. Any ideas as to why the response is invalid? 

api status -s outout attached

[root@Ansible-Cent Playbooks]# ansible-playbook -C demo-playbook.yml

PLAY [localhost] ***************************************************************

TASK [Gathering Facts] *********************************************************
ok: [127.0.0.1]

TASK [login] *******************************************************************
ok: [127.0.0.1]

TASK [add host] ****************************************************************
fatal: [127.0.0.1]: FAILED! => {"changed": false, "msg": "Command 'add-host {u'name': u'host_demo_1', u'ip-address': u'1.1.1.1'}' failed with error message: APIResponse received a response which is not a valid JSON.. All changes are discarded and the session is invalidated."}
to retry, use: --limit @/root/cpAnsible/Playbooks/demo-playbook.retry

PLAY RECAP *********************************************************************
127.0.0.1 : ok=2 changed=0 unreachable=0 failed=1

0 Kudos
1 Solution

Accepted Solutions
PhoneBoy
Admin
Admin

From the api status output, it looks like the API server crashed for some reason.

If I had to guess, it's because you've configured this VM with only 4GB of RAM.

The stated minimum in the release notes for R80.20.M2 is 6GB of RAM.

I highly recommend more. 

In my own lab, my management VM has 16GB of RAM allocated (but I'm also using SmartEvent).

View solution in original post

0 Kudos
6 Replies
PhoneBoy
Admin
Admin

From the api status output, it looks like the API server crashed for some reason.

If I had to guess, it's because you've configured this VM with only 4GB of RAM.

The stated minimum in the release notes for R80.20.M2 is 6GB of RAM.

I highly recommend more. 

In my own lab, my management VM has 16GB of RAM allocated (but I'm also using SmartEvent).

0 Kudos
Yunus_Badar
Participant

Thanks Dameon:

Your guess is right, the demo mgr was setup with 4 GB ram.

While, I didn't notice spike in memory on Manager when playbook was run but  after upgrading the memory to 8 GB, the error didn't occur. 

0 Kudos
dassouka
Explorer

Hello,

 

can someone please, give the commande line to upgrade max_ram in checkpoint management server,

Thanks

0 Kudos
PhoneBoy
Admin
Admin
We're talking about adding RAM to the appliance or VM.
That is not something you can do over a command line.
0 Kudos
dassouka
Explorer

thanks for feedback,

 

actualy my appliance already have 16G of RAM, but my i still getting errors when calling checkpoint API using Ansible.

 something like  NGM_CPM_MAX_HEAP

 

this is the error i get 

fatal: [localhost]: FAILED! => {"changed": false, "msg": "Command 'add-service-tcp {u'name': u'tcp_1005', u'port': u'1005'}' failed with error message: APIResponse received a response which is not a valid JSON.. All changes are discarded and the session is invalidated."}

 

Regards 

0 Kudos
PhoneBoy
Admin
Admin
That error usually means the API server is not enabled.
Make sure it's enabled and access is allowed from your IP address.
https://community.checkpoint.com/t5/API-CLI-Discussion-and-Samples/Enabling-web-api/m-p/32641
0 Kudos

Leaderboard

Epsum factorial non deposit quid pro quo hic escorol.

Upcoming Events

    CheckMates Events