Forum Discussion
What is the correct way to script multiple newline characters in iApp (to create a monitor)
I have a HTTP monitor which requires a \r\n\r\n at the end. For the life of me, I cannot fix the syntax on this.
I end up with the following debugs in /var/tmp/scriptd.out (sanitised obviously).
With the following line:
set monitor_send "\"GET /hosting/discovery HTTP/1.1\r\nHost: $::deploy__monitor_dns_name\r\nConnection: Close\r\n \r\n\""
I get the following result:
create / ltm monitor http test_lync_wac_internal_http_monitor defaults-from http interval 30 timeout 91 send "GET /hosting/discovery HTTP/1.1\r\nHost: myserver.mydomain.local\r\nConnection: Close\r\n \r\n" recv "wopi-discovery"
With the following line:
set monitor_send "\"GET /hosting/discovery HTTP/1.1\r\nHost: $::deploy__monitor_dns_name\r\nConnection: Close\r\n\r\n\""
I get the following result:
create / ltm monitor http test_lync_wac_internal_http_monitor defaults-from http interval 30 timeout 91 send "GET /hosting/discovery HTTP/1.1\r\nHost: myserver.mydomain.local\r\nConnection: Close\r\n" recv "wopi-discovery"
The final part of the send string must read "Connection: Close\r\n\r\n" to work correctly.
In both cases this is using the f5.app_utils:create_monitor procedure.
set monitor_name [tmsh::run_proc f5.app_utils:create_monitor \
$app_name $monitor_type $monitor_interval "$monitor_send" \
"$monitor_recv" $::HTTP_11_VERSION_STRING $monitor_dns_name]
I did try making one directly with LTM commands but I experienced difficulty with escaping and it sent the \r\n as linefeed characters instead of literal text.
This means a manual edit of the monitor each time a setting is changed in the iApp, which isn't going to be regular, but will cause an outage when someone forgets to check (and they will). What's the right way to escape two newlines?
Any help is appreciated, thanks.