LVS
lvs-users
Google
 
Web LinuxVirtualServer.org

Re: XML ipvsadm

To: Skliarouk Peter <skliaroukp@xxxxxxxxxxx>
Subject: Re: XML ipvsadm
Cc: lvs-users@xxxxxxxxxxxxxxxxxxxxxx
From: Michael Sparks <zathras@xxxxxxxxxxxxxxxxxx>
Date: Sat, 18 Dec 1999 22:25:16 +0000 (GMT)
Hi,

On Wed, 8 Dec 1999, Skliarouk Peter wrote:
> Could you add an option to ipvsadm to print results in XML?
> 
> I want to parse the results, put in an database and calculate some
> statistics (Perl,PHP,MySQL) with web frontend.
> 
> DTD could be anything, but forewer.

For various reasons I'mn writing code that needs to process the
output of ipvsadm -l (or more accurately I suppose, the contents of
/proc/net/ip_masq/vs). It's only a part of a larger admin tool I'm
writing for our 10-node LVS cluster, but can be modified to produce most
sorts of output you might like.

Writing something that produces an XML version would probably be trivial,
limited to changing 3 templates from this:

VIRTUAL_HOST_LOADING_TEMPLATE
VIRTUAL SERVER HOST : (SERVER_HOST)
VERSION : (LVS_VERSION)

(SERVICES)
----------------------------
VIRTUAL_SERVICE_TEMPLATE
Service Description :
   TYPE (TYPE) Running on: (IP) Port: (PORT)
   Scheduling method : (SCHEDULER)

   Real Servers:
(SERVERS)
-----------------------------
REAL_SERVER_DISPLAY_TEMPLATE
\t(SERVER)\t(FORWARDING)\t(WEIGHT)\t(ACTIVE)\t(INACTIVE)
-----------------------------

To something like this:

VIRTUAL_HOST_LOADING_TEMPLATE
<VirtualServerRecord>
<IPVSHOST> (SERVER_HOST) </IPVSHOST>
<IPVSVERSION> (LVS_VERSION) </IPVSVRSION>

<services>
(SERVICES)
</services>
</VirtualServerRecord>
-----------------------------
VIRTUAL_SERVICE_TEMPLATE
<Service>
   <TYPE> (TYPE) </type>
   <serviceIP> (IP) </serviceIP>
   <Port> (PORT) </port>
   <scheduler> (SCHEDULER) </scheduler>

   <Servers>
(SERVERS)
   </servers>
</service>
-----------------------------
REAL_SERVER_DISPLAY_TEMPLATE
     <server> (SERVER) </server>
     <forwarding> (FORWARDING) </forwarding>
     <weight> (WEIGHT) </weight>
     <activeconns> (ACTIVE) </activeconns>
     <inactiveconns> (INACTIVE) </inactiveconns>
-----------------------------

NB, I haven't actually read up much XML stuff so if this seems junk then
that's why. I'll make the code available sometime later this week that
does this stuff if it'd be useful to you. (After all you'll be able to
customise it to suit your purposes :-)

I'll probably make it so that the realserver template can contain infoon
the service it belongs to as well, since this would enable the same
program to use a template to build the appropriate set of commands
necessary to setup routing table based on the current weights/etc. (Useful
in the case of failover on the LVS director)


Michael.
--
National & Local Web Cache Support        R: G117
Manchester Computing                      T: 0161 275 7195
University of Manchester                  F: 0161 275 6040
Manchester UK M13 9PL                     M: Michael.Sparks@xxxxxxxxxxxxxxx



----------------------------------------------------------------------
LinuxVirtualServer.org mailing list - lvs-users@xxxxxxxxxxxxxxxxxxxxxx
To unsubscribe, e-mail: lvs-users-unsubscribe@xxxxxxxxxxxxxxxxxxxxxx
For additional commands, e-mail: lvs-users-help@xxxxxxxxxxxxxxxxxxxxxx

<Prev in Thread] Current Thread [Next in Thread>
  • XML ipvsadm, Skliarouk Peter
    • Re: XML ipvsadm, Michael Sparks <=