Maneesh_72711
Mar 11, 2018Cirrostratus
Displaying Client and Server Side connections via i-rule
I am trying to write an i-rule which gives my application users to see which user landed on which server. Got four pool members and below is what I have written.
when CLIENT_ACCEPTED {
table incr client-[IP::client_addr]
table timeout client-[IP::client_addr] 21600
table add -subtable client-tracking client-[IP::client_addr] 3600
}
when SERVER_CONNECTED {
table incr server-[IP::server_addr]
table timeout server-[IP::server_addr] 21600
table add -subtable server-tracking server-[IP::server_addr] 21600
}
when HTTP_REQUEST {
if {[HTTP::uri] ne "/connections" } { return }
set response "Connections\r\n"
foreach ckey [table keys -subtable client-tracking] {
append response "$ckey = [table lookup $ckey]\r\n"
`
}
foreach skey [table keys -subtable server-tracking] {
`append response "$skey = [table lookup $skey]\r\n"
}
HTTP::respond 200 content $response Content-Type "text/plain" Connection Close
event disable
}
when CLIENT_CLOSED {
table delete -subtable client-tracking client-[IP::client_addr]
}
The above i-rule gives me details about how many client connections were received and how many server connections are there.
Connections client-X.Y.Z.P = 141
client-X.Y.Z.P = 38
server-X.Y.Z.P = 4
server-X.Y.Z.P = 15
server-X.Y.Z.P = 3
I want to see all in the same line basically Client-a.b.c.d=10--->Server-p.q.r.s=10. Can you help me how can I concatenate both of the together ?
Additionally I have cookie persistence on my VIP for 6 Hours, hence I chose 21600 seconds there is that correct or not required ?