Hello,
I need to do some HTTP keepalive based on the http page itself (no error code returned by the server).
With the CSS we were able to do it because the css was doing a checksum of the http page. So when there was changes the service was considered to be down.
I have not seen a similar option with the CSM so it is why I am looking for a tcl script that get the page and look for a regexp in it.
I am having some trouble seeing the service up :( so I don't know if my script is good. I see that it is doing the http get on the server but it does not seem to succeed doing the regexp match...
Here is my script :
# !name = HTTP_TEST
# get the IP address of the real server from a predefined global array csm_env
set ip $csm_env(realIP)
set port 80
set url "GET /supervision/test.jsp"
# Open a socket to the server. This creates a TCP connection to the real server
set sock [socket $ip $port]
fconfigure $sock -buffering none -eofchar {}
# Send the get request as defined
puts -nonewline $sock $url;
# Wait for the response from the server and read that in variable line
set line [ read $sock ]
# Parse the response
if { [ regexp "BD \+ SA OK.*\<BR\>Gateway OK.*\<BR\>Gateway2 OK" $line ] } {
exit 5000
} else {
exit 5001
}
And the regexp should be looking for :
BD + SA OK
<BR>Gateway OK
<BR>Gateway2 OK
any help is welcome !
Thanks