List running Virtual Servers using PerlThe following code uses ZXTM's Control API to list all the running virtual servers on a cluster. The code is written in Perl, using the SOAP::Lite module. listVS.pl
#!/usr/bin/perl -w
use SOAP::Lite 0.60;
# This is the url of the ZXTM admin server
my $admin_server = 'https://username:password@host:9090';
my $conn = SOAP::Lite
-> uri('http://soap.zeus.com/zxtm/1.0/VirtualServer/')
-> proxy("$admin_server/soap");
# Get a list of virtual servers
my $res = $conn->getVirtualServerNames();
my @names = @{$res->result};
# Establish which are enabled
$res = $conn->getEnabled( \@names );
my @enabled = @{$res->result};
# Print those which are enabled
for( my $i = 0; $i <= $#names; $i++ ) {
if( $enabled[$i] ) {
print "$names[$i]\n";
}
}
NotesTo run this example, you will need Perl, SOAP::Lite and IO::Socket::SSL. On Debian-based systems, you may install the packages libsoap-lite-perl and libio-socket-ssl-perl. On RedHat based systems, you'll need the perl-SOAP-Lite and perl-IO-Socket-SSL rpms. Perl's SOAP::Lite module does not use the WSDL file to perform any type checking, so calling errors will be detected at runtime. The SSL layer is happy to accept self-signed certificates. Running the Example$ ./listVS.pl Main website Mail servers Test site
Owen Garrett
[Zeus Dev Team] 20 October 2005
|
Recent Articles
Other Resources
|


