Forum Discussion
External TCP port monitor 5150
Hi all,
We have a crapy app that crashes internally even though the monitored service (TCP Half Open on port 29029) stays up. The app developer wrote a small program that will return a "1" if the application is functioning properly or a "0" if the app is down (due to database connections and other issues) on TCP port 5150. What I have been researching is how to write an external port monitor that will check TCP port 5150 and mark down a pool member if a "0" is received. I have looked through the links below and they are very helpful, at least I know it can be done and I am now in the ball park as far as the solution goes. I am wondering if anyone has advice on this or has done something similar to this in the past. Thanks!
https://devcentral.f5.com/community/group/aft/61530/asg/44
https://devcentral.f5.com/tech-tips/articles/ltm-external-monitors-the-basics.UPm-q-z_Fog
https://devcentral.f5.com/community/group/aft/1172462/asg/52
6 Replies
- Michael_Yates
Nimbostratus
Hi Leo D,
I am guessing that this will be an HTTP Monitor running a get?
If so, just input your Send String, Recieve String, and Alais Service Port and it should work.
Example:
Send String: GET /server/f5.html\r\n
Send String: 0
Alias Port: 5150
I would suggest creating a dummy pool to put the target server into and then apply the Health Monitor to it for testing. When you verify that it is working properly you can apply the monitor to the Pool (or the Node) and set the Availability Requirement to All.
Then if either Health Monitor Fails it will remove the node from the pool.
Hope this helps. - hoolio
Cirrostratus
Hi Leo,
You could potentially write an inbuilt TCP monitor for this. What's the string the client needs to send to get the status of the app?
An inbuilt monitor will be more efficient than an external monitor. See this SOL for details on writing a custom inbuilt TCP 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
Aaron - Leo_D_53884
Nimbostratus
Michael,
Thanks for the reply. I did not think of doing it with an HTTP get, I was thinking about using a custom build external TCP monitor. If an HTTP GET will work as in your post that would be great. I just need to determine the TCP response on port 5150. Would the node I monitor need to be running an HTTP server to respond to the HTTP GET? I am thinking it would, currently the server is not running but I am checking to see if it can. I also appreciate the advice on the dummy pool as I do not have a Dev environment for this testing.Leo
- Leo_D_53884
Nimbostratus
Aaron,
Thanks for the reply. I just run the following: telnet 10.10.10.10 5150 and after about 5 seconds it returned a 0 and indicates connection is closed. If it returns a "1" then I know that the server has some internal app issues. I would really prefer to use the existing mechanisms if possible. So I would like to maybe Telnet to the server and somehow check the responce.
Leo - nitass
Employee
e.g.1. find response in hex when server returns 0 and 1. for example, 300a is 0 and 310a is 1 (0x30 is 0, 0x31 is 1, 0x0a is new line). returning 0 [root@ve10:Active] config telnet 200.200.200.101 5150 Trying 200.200.200.101... Connected to 200.200.200.101 (200.200.200.101). Escape character is '^]'. 0 Connection closed by foreign host. [root@ve10:Active] config tcpdump -nni 0.0 -s0 port 5150 -X tcpdump: verbose output suppressed, use -v or -vv for full protocol decode listening on 0.0, link-type EN10MB (Ethernet), capture size 65535 bytes ...snippe... 00:24:49.071099 IP 200.200.200.101.5150 > 200.200.200.10.60808: P 1:3(2) ack 1 win 46 in slot1/tmm0 lis= 0x0000: 0ffd 0800 4500 0036 9130 4000 4006 8790 ....E..6.0@.@... 0x0010: c8c8 c865 c8c8 c80a 141e ed88 6a64 c8c1 ...e........jd.. 0x0020: 305e 94d7 8018 002e 25ef 0000 0101 080a 0^......%....... 0x0030: 23fc 59f1 5ded 28ad 300a 0114 0001 0000 .Y.].(.0....... 0x0040: 0000 0000 0000 0000 0000 0000 0000 0000 ................ ...snippe... returning 1 [root@ve10:Active] config telnet 200.200.200.101 5150 Trying 200.200.200.101... Connected to 200.200.200.101 (200.200.200.101). Escape character is '^]'. 1 Connection closed by foreign host. [root@ve10:Active] config tcpdump -nni 0.0 -s0 port 5150 -X tcpdump: verbose output suppressed, use -v or -vv for full protocol decode listening on 0.0, link-type EN10MB (Ethernet), capture size 65535 bytes ...snipped... 00:26:19.146301 IP 200.200.200.101.5150 > 200.200.200.10.60825: P 1:3(2) ack 1 win 46 in slot1/tmm0 lis= 0x0000: 0ffd 0800 4500 0036 4240 4000 4006 d680 ....E..6B@@.@... 0x0010: c8c8 c865 c8c8 c80a 141e ed99 f54f fb90 ...e.........O.. 0x0020: 647e 06bf 8018 002e 015f 0000 0101 080a d~......._...... 0x0030: 23fd b9d0 5dee 8888 310a 0114 0001 0000 ...]...1....... 0x0040: 0000 0000 0000 0000 0000 0000 0000 0000 ................ ...snipped... 2. configure tcp health monitor [root@ve10:Active] config b monitor mytcp list monitor mytcp { defaults from tcp recv "\x31\x0a" } 3. assign monitor to pool [root@ve10:Active] config b pool foo list pool foo { monitor all mytcp members 200.200.200.101:5150 {} } 4. test when returning 1 [root@ve10:Active] config b pool foo|grep -i pool\ member +-> POOL MEMBER foo/200.200.200.101:5150 active,up when returning 0 [root@ve10:Active] config b pool foo|grep -i pool\ member +-> POOL MEMBER foo/200.200.200.101:5150 inactive,down - Leo_D_53884
Nimbostratus
nitass,
Thanks, this is a big help. I plan to test this as soon as I can. I will update this post with my results!
Leo
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
