Performance Center Practitioners Forum

server/clone name in script

Trusted Contributor.

server/clone name in script

hi all,

Is it possible to capture the server/clone details on which vuser is accessing it from.

For eg: you have 3 servers and one LB. one of the three servers might have problem due to which script will fail 1/3 of the time. is it possible to capture the server name/ip while doing error/exception handling?




Oliver Lloyd
Outstanding Contributor.

Re: server/clone name in script

Your query is a bit ambiguous; it can be read two ways:


1. If you are talking about *from* where the script is running - as in the host name for the Load Generator - then yes. In fact you already have them in your results.


In the Analysis tool you can filter by host name; this will, well, fairly obviously it will filter the resultss by host name!


If you want to get the host name programatically as the script is being executed you can use the predictably named function: lr_get_host_name().


2. If you are talking about where the script is sending requests *to* then it is more specific to your individual situation. Basically, it depends on the method employed by the load balancer to distribute requests and how a session is 'stuck' onto a server. Chances are you can get the server id from the headers for each request and it's likely that cookies are used to stick a session to one location.


The easiest thing is just to hit each server manually and see if it works. You could write some code to log where each request is being sent by parsing the headers but it seems a bit pointless to me. If you must have some sort of automated checking then just have a separate script that bypasses the LB and loops through each server in the farm manually - run this gently as part of your scenario and you will have a simple health log for each server.



Trusted Contributor.

Re: server/clone name in script

thanks Oliver. your second point is what i'm looking for. i know we can do it the way you suggested, but thought if there is some field in header, i can just write it to error log and be done with it. Else i always have monitoring where i can see if servers are utilized evenly.