Forum Discussion

SS11's avatar
SS11
Icon for Nimbostratus rankNimbostratus
Jun 06, 2018

Capture the receive string in health monitor

Application designer asked to setup a receive health monitor and the request is below;

 

ADC(any characters except {)Running (trying to match this: "system": "ADC", "status": "Running", ) but not subsequent occurrences of "Running", in total output that looks like this:

 

{ "system": "ADC", "status": "Running", "date": "05-22-2018 18:36:23:913", "details": [ { "service": "Terminology", "description": "Terminology Web Service", "status": "Running", "details": [ { "web_service": "Running" } ] } ]

 

}

 

I tried with [^\w]\"system\":\"ADC\",\"status\": \"Running\" and \"system\":\"ADC\",\"status\": \"Running\" but it doesnt work. what is the correct format to match the receive string?

 

"system": "ADC", "status": "Running"

 

3 Replies

  • Hi,

    Firt of from CLI can you try your query using CURL? In order to see that response. In this way you can validate your request and check response. curl example:

     

    curl -i -k [https://1.1.1.1/url](https://1.1.1.1/url) -H "Host: myappname.domain.com"

     

    where 1.1.1.1 is your backend server and myappname.domain.com the app hostname

    if the backend is not ssl/TLS try this:

     

    curl -i [http://1.1.1.1/url](http://1.1.1.1/url) -H "Host: myappname.domain.com"

     

    Let me now if it's clear or you need additional info (add parameter or other)

    regards

     

  • JG's avatar
    JG
    Icon for Cumulonimbus rankCumulonimbus

    It looks like

     

    "system": "ADC", "status": "Running"

     

    is already a unique string in the output. So why not just use:

    \"system\": \"ADC\", \"status\": \"Running\",

     

    as the receive string, rather than looking for the first occurrence of "Running"?

  • JG's avatar
    JG
    Icon for Cumulonimbus rankCumulonimbus

    So the output is really in multiple lines, not in a single line as it was originally posted:

     

    {
      "system": "ADC",
      "status": "Running",
      "date": "06-07-2018 03:48:12:859",
      "details": [
        {
          "service": "Terminology",
          "description": "Terminology Web Service",
          "status": "Running",
          "details": [
            {
              "web_service": "Running"
            }
          ]
        }
      ]
    

     

    If so, you can try the following instead:

    { "system": "ADC", "status": "Running", "date": "06-07-2018 03:48:12:859", "details": [ { "service": "Terminology", "description": "Terminology Web Service", "status": "Running", "details": [ { "web_service": "Running" } ] } ]

    . This will capture the first occurrence of "Running" with the correct context, no?

    [Edited to replace all spaces with 

    \s\s\"system\":\s\"ADC\",\n\s\s\"status\":\s\"Running\",\n

     to avoid confusion due to incorrect code display.]