List running Virtual Servers using Ruby and SOAPThe following code uses ZXTM's Control API to list all the running virtual servers on a cluster. The code is written in Ruby. listVS.rb
#!/usr/bin/ruby
require 'http-access2'
require 'soap/rpc/driver'
# Fix these for your admin server, password etc
url = 'https://10.100.1.31:9090/soap'
user = 'admin'
pass = 'admin'
client = SOAP::RPC::Driver.new( url, 'http://soap.zeus.com/zxtm/1.0/VirtualServer/' )
client.add_method( 'getVirtualServerNames' )
client.add_method( 'getEnabled', 'names' )
client.options[ 'protocol.http.ssl_config.verify_mode' ] = OpenSSL::SSL::VERIFY_NONE
client.options[ 'protocol.http.basic_auth' ] << [ url, user, pass ]
vservers = client.getVirtualServerNames
enabled = client.getEnabled( vservers )
vservers.length.times do |i|
if enabled[i]
puts vservers[i]
end
end
NotesAs well as Ruby 1.8, you will need to install the http-access2 and openssl Ruby packages in order for the HTTPS Basic Authentication used by ZXTM's SOAP server to functions correctly. Running the exampleRun the Ruby script as follows: $ listVS.rb Main website Mail servers Test site
Owen Garrett
[Zeus Dev Team] 20 March 2008
|
Recent Articles
Other Resources
|


