Forum Discussion
cmaloy_15909
Nimbostratus
May 20, 2010Help getting PerlVirtualShow to print info on only one virtual server
I'm new to iControls and Perl but I have managed to install SOAP::Lite and configure mod_perl on an Apache instance and get some sample scripts running.
I am invoking PerlVirtualShow (http://devcentral.f5.com/wiki/default.aspx/iControl/PerlVirtualShow.html) from a browser and it works as advertised out of the box. If I browse to http://mywebsite/perl/PerlVirtualShow.pl then I will see something like.
VIRTUAL SERVER vs_myweb1.com 10.x.x.x:443
vip_IP = '10.x.x.x
vip_Name = 'vs_myweb1.com'
vip_Port = '443
vip_Pool_Name = 'p_myweb1.com'
vip_Port_Status = 'ENABLED'
pool_LB_Method = 'round_robin'
+-pool_Member_IP = '10.x.x.x'
pool_Member_Port = '88'
pool_Member_State = 'UP-ENABLED'
pool_Member_Priority = '0'
VIRTUAL SERVER vs_myweb2.com 10.x.x.x:443
vip_IP = '10.x.x.x
vip_Name = 'vs_myweb2.com'
vip_Port = '443
vip_Pool_Name = 'p_myweb2.com'
vip_Port_Status = 'ENABLED'
pool_LB_Method = 'round_robin'
+-pool_Member_IP = '10.x.x.x'
pool_Member_Port = '88'
pool_Member_State = 'UP-ENABLED'
pool_Member_Priority = '0'
VIRTUAL SERVER vs_myweb3.com 10.x.x.x:443
vip_IP = '10.x.x.x
vip_Name = 'vs_myweb3.com'
vip_Port = '443
vip_Pool_Name = 'p_myweb3.com'
vip_Port_Status = 'ENABLED'
pool_LB_Method = 'round_robin'
+-pool_Member_IP = '10.x.x.x'
pool_Member_Port = '88'
pool_Member_State = 'UP-ENABLED'
pool_Member_Priority = '0'
The first few entries which are listed when I run the script from the command line do not appear in the browser output but at least I am getting some output here.
I only want information on one virtual server at a time so I edited the PerlVirtualShow.pl and changed the virtual server argument as follows:
my $sVirtual = "vs_myweb1.com";
When I run PerlVirtualShow.pl from the command line it gives me only the information for the virtual server specified which is what I expect.
linuxbox ./virtualshow.pl
Querying 1 elements
VIRTUAL SERVER vs_myweb1.com 10.x.x.x:443
vip_IP = '10.x.x.x
vip_Name = 'vs_myweb1.com'
vip_Port = '443
vip_Pool_Name = 'p_myweb1.com'
vip_Port_Status = 'ENABLED'
pool_LB_Method = 'round_robin'
+-pool_Member_IP = '10.x.x.x'
pool_Member_Port = '99'
pool_Member_State = 'UP-ENABLED'
pool_Member_Priority = '0'
+-pool_Member_IP = '10.x.x.x'
pool_Member_Port = '99'
pool_Member_State = 'UP-ENABLED'
pool_Member_Priority = '0'
Total execution time: 1 s.
If I now browse to http://mywebsite/perl/PerlVirtualShow.pl I get a blank screen. Does anyone know why this could be? Thanks.
- The PerlVirtualShow.pl sample is meant for command line output. You can't put a command line app behind a web server and have it serve the content to a browser request. In order to do so, you must add the appropriate CGI support code to the script and ensure that your virtual directory configuration in your web server that contains the cgi script is configured for CGI. Do a web search on "Perl CGI" and you'll find a bunch of example on how to add the appropriate CGI headers so that the web server will know how to interpret the output and pass it back to the client.
- hwidjaja_37598
Altostratus
Do you put the script in a folder with ExecCGI option set?print "Content-type: text/plain\n\n" if ($ENV{'SCRIPT_NAME'});
- cmaloy_15909
Nimbostratus
Thanks Joe. I got it to display by using the CGI module.
Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects