List running Virtual Servers using Ruby and SOAP

The 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

Notes

As 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 example

Run the Ruby script as follows:

$ listVS.rb
Main website
Mail servers
Test site
Owen Garrett [Zeus Dev Team] 20 March 2008 Bookmark with del.icio.us Post this article to Digg Post this article to reddit Post this article to Facebook Tweet this article 1 comment  

Comments:

This public messageboard is not a forum for technical support. To report technical support problems, please contact our dedicated Support team using the instructions at the bottom of this page.

I've integrated this into a class for easy use:

http://github.com/touchlocal/ruby_zxtm_manager
Permalink 16 December 2009 @ 00:51
Leave a comment ...
Your email address will not be displayed.
Your URL will be displayed.
This public messageboard is not a forum for technical support. To report technical support problems, please contact our dedicated Support team using the instructions at the bottom of this page.
Options:
 
(Line breaks become <br />)
(Set cookies for name, email & url)

Recently...

Other Resources