Monitor the state - JSON data - body mismatch




  • type: http
    urls: ["https://x.x.x.x:xxx/x/x/x"]
    ssl.verification_mode: none
    method: GET
    'x-auth-token': 'xxxxx'
    status: 200
    body: '{"state": "copy"}'
    schedule: '@every 10s'

When I use the following curl cmd I get the json response
curl -k --request GET --url https://x.x.x.x:xxx/x/x/x --header 'x-auth-token: xxxx'

Json response

"server": {
"status": "ok",
"code": "",
"message": "Operation done successfully."
"counts": {
"data_counts": 21,
"total_counts": 21
"data": {
"xxx": [
"sourcevolume": {
"id": "xxx",
"link": {
"rel": "self",
"href": "https://x.x.x.x:xxx/x/x/x"
"targetvolume": {
"id": "xxx",
"link": {}
"targetsystem": {
"id": "xxx",
"link": {}
"type": "globalcopy",
"state": "copy"

I get body mismatch error, how do I use the json data 'state' in body?

(Jaime Soriano) #2

Hi @shiv94,

The check you are trying to do looks for the string in plain text, so it is looking literally for {"state": "copy"}, what is not present as is in the response body.
This would probably work if you remove the curly brackets:

  status: 200
      - '"state": "copy"'

Notice also that the body field needs to be defined as a list that contains a list of expressions.

Starting on heartbeat 6.6.0 (see #8667) it will be also possible to use specific JSON checks. Though your case would need quite complex conditions (not sure if even possible) as this state field is inside a list and an object of unknown name.

But you will be able to check for example the server status with:

    status: 200
      - description: 'check server status' 
            status: ok

Heartbeat 7.0.0-alpha1 pre-release already contains this feature in case you want to give it a try :wink:


Thanks for your response @jsoriano

(system) closed #4

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.