Forum Discussion

BenConrad_10265's avatar
Icon for Nimbostratus rankNimbostratus
May 27, 2011

Can a custom HTTP monitor work with a JSON response?




My Devs have created a health check page on our Tst web servers that returns a JSON response.



HTTP/1.1 200 OK (application/json)



So, a couple of questions/comments:



1) Can I use a LTM monitor to inspect the contents of a JSON response? So far, I've had no luck getting this to work. I can successfully monitor static pages on the same servers so I know I've got things setup properly.



2) I noticed that If I hit our URL with WGET I can see the contents of the JSON file in Wireshark. If I hit the URL with Internet Explorer or Firefox they both pop up a "download" window and I see binary data in Wireshark.



Any thoughts?








10 Replies

  • Hi Ben,



    You can send any TCP or HTTP request and check for any response with a TCP or HTTP monitor. But both need to be a single static string that's sent and a static string that's checked for in the response. You can use the steps in these two links to troubleshoot a failing monitor:






    tcpdump might be the simplest method to start troubleshooting this issue. You can use tcpdump to see the exact request bigd is sending and the response the pool member is sending.



    If you want to look for a specific sequence of bytes in the response binary data, you can use ascii escape sequences (without the spaces between \ x and the two characters):



    \ x 00 - null


    \ x 01 - SOH





    sol4186: Entering escape sequences in an ECV health monitor's send and receive strings




  • Can you try to change the content type from "application/json" to "text/html"?



    Btw, how do you inspect the contents? Any error message?
  • Thanks Aaron and Hum. It seems that it should be possible to change the response to "text/html", I've asked our Devs to look into this. Currently, in order to inspect the results of the JSON repsonse I have to download the file (Firefox/IE) or use wget which dowloads automatically. Worst case I'll have to look at the bits as Aaron suggested. Ben
  • As an alternative, you might want to use curl command also ... curl can show the contents directly to standard output
  • Hi Aaron,



    So my Devs say changing the response is not going to happen, I'm going to need to go the HEX route.



    Using Wireshark, I sniffed the health check coming from the LTM on the web server, I see the response going back to the LTM self IP as 10 bytes of data representing:



    {"d":true} , this equates to 7b 22 64 22 3a 74 72 75 65 7d



    To make things easy for my initial test I'm just going to look for "true" which is 74727565



    So I thought my receive string should be:






    But that is not matching.



    I'm running :


    BIG-IP 9.4.5 Build 1049.10 Final



    Any thoughts?





    • PSPK's avatar
      Icon for Nimbostratus rankNimbostratus

      How did you take the tcpdump


      Appreciate if you can provide the command here


  • I got this working using \x74\x72\x75\x65. The reason it was not working is because our Active LTM was all screwed up and needed a reboot, the LTM it was not syncing the configs from the GUI to the internals. Why? That is for us to find out another day... :-)



    Thanks all!




  • Hi Ben,



    You could probably simplify this a bit and just use "true" in the receive statement (without the quotes).



  • For anyone reading this post! There's better ways to do this now.

  is available now to do this in pure shell,


    I've written up an example using as the basis; which should be able to handle most JSON responses generically.