Forum Discussion

Raynewalk's avatar
Raynewalk
Icon for Nimbostratus rankNimbostratus
Sep 17, 2012

HEX definition in an irule

We want to build an irule that sends HEX to a server and checks the reponse back in HEX. Base don this we want to build a health monitor to mark the server as up or down.

 

Grateful for any advice or exmaples.

 

 

Cheers

 

 

 

 

8 Replies

  • Are you trying to convert TO/FROM HEX? Are the client and/or server speaking a binary protocol?

     

     

    In any case, the binary scan/format commands will give you HEX conversion. Just need to know more specifics about what you're trying to do.

     

     

    As for the monitor, that's completely different and not based on iRules (unless you point the monitor at a VIP).

     

  • Hi Kevin, Our server applicaitionn guy tells us that the application to be monitored uses EBCDIC so he has supplied a HEX string to input and an expected response in HEX that confirms the server is healthy. So the question is how to form that raw HEX into an irule that quirts this at the server and interprets the response.

     

     

    Thanks for your help.
  • I'm assuming you're only talking about monitoring the app, so there's probably several ways to do this. First and foremost, you wouldn't need an iRule if you can poll the server directly from a scripted monitor. Take a look at something like netcat in the shell. Modify one of the sample monitor scripts in /config/monitors.

     

     

    res=`echo reqfile.txt | nc $1 $2 | grep "somedata"`

     

     

    The reqfile.txt file would contain your HEX data.There's any number of other utilities in the shell to convert the response to HEX, if that's even necessary. Refer to http://www.sans.org/security-resources/sec560/netcat_cheat_sheet_v1.pdf for netcat commands.

     

  • You should be able to just specify the hex characters in the send and receive strings in an inbuilt TCP or HTTP monitor:

     

     

    sol4186: Entering escape sequences in an HTTP health monitor's Send and Receive strings

     

    https://support.f5.com/kb/en-us/solutions/public/4000/100/sol4186.html

     

     

    Escape Sequence

     

    \xHH

     

     

    Description

     

    Insert the character with the hexadecimal ASCII code of HH

     

     

    Aaron
  • That could be very helpful indeed. I will be trying this out tomorrow....
  • Posted By hoolio on 09/20/2012 09:26 AM

     

    You should be able to just specify the hex characters in the send and receive strings in an inbuilt TCP or HTTP monitor:

     

     

    sol4186: Entering escape sequences in an HTTP health monitor's Send and Receive strings

     

    https://support.f5.com/kb/en-us/solutions/public/4000/100/sol4186.html

     

     

    Escape Sequence

     

    \xHH

     

     

    Description

     

    Insert the character with the hexadecimal ASCII code of HH

     

     

    Aaron

     

     

    Hi Aaron,

     

    This worked perfectly. We found we had to precede each HEX character in the string with the escape sequence although we did not try stringing them all together without any gaps, which may have worked.

     

    cheers

     

    Greg