Webservice prepare

From MyLVS
Jump to navigation Jump to search

Webservice prepare

INSERT INTO `tblMaintenance` (`mID`,`enabled`,`ip`,`hostname`,`groupID`,`requestUP`,`requestDOWN`,`WeightDownTime`,`WeightDownPending`,`TurnOffTime`,
`TurnOffPending`,`response`,`message`,`updatepending`,`requestDate`,`responseDate`,`receivedfrom`,`CurWeightDownTime`,`CurTurnOffTime`,`DSLMaintenance`,
`DSLRenewRequest`,`DSLDate`,`DSLEpoche`,`DSLIP`) VALUES 
(1,1,'192.168.2.221','hh',1,0,0,30,0,30,0,200,'Host has been turned on',0,'0','20150727143609','0','0','0',0,0,'0',0,'0'),
(2,1,'192.168.2.222','hh',1,0,0,30,0,30,0,200,'Host has been turned on',0,'0','20150727143230','0','0','0',0,0,'0',0,'0');


Installing Soap-Lite modules for Linux

  • apt-get install libsoap-lite-perl




Installing Soap-Lite modules for Windows

C:\Users\Administrator\Documents\lvs>ppm install Soap-Lite
Downloading SOAP-Lite-1.17...done
Downloading Class-Inspector-1.28...done
Downloading IO-SessionData-1.03...done
Unpacking SOAP-Lite-1.17...done
Unpacking Class-Inspector-1.28...done
Unpacking IO-SessionData-1.03...done
Generating HTML for SOAP-Lite-1.17...done
Generating HTML for Class-Inspector-1.28...done
Generating HTML for IO-SessionData-1.03...done
Updating files in site area...done
 63 files installed
  • Hosts
C:\>notepad c:\Windows\System32\drivers\etc\hosts
192.168.2.220	ws.mylvs.foo
ipconfig /flushdns


root@mylvs01:/var/www/mylvs/ws/cgi-bin# chmod 777 lvs.cgi
root@mylvs01:/var/www/mylvs/ws/modules# chmod 777 lvs.pm


  • Note: The webservice requires mylvsmon to run


Sample call from Linux client

#!/usr/bin/perl -w
use SOAP::Lite; # + qw/ trace /;
my $soap = SOAP::Lite
  -> uri('urn:lvs')
  -> proxy('http://ws.mylvs.foo/cgi-bin/lvs.cgi');
my $result = $soap->WHATISMYIP ();
unless ($result->fault) {
 print $result->result();
} else {
  print join ', ',
    $result->faultcode,
    $result->faultstring;
}
root@myLVS-LinuxClient:/usr/local/dev/mylvs# perl test.pl
200 192.168.2.222


Sample call from Windows client

Same as above

#!/usr/bin/perl -w
use SOAP::Lite; # + qw/ trace /;
my $soap = SOAP::Lite
 -> uri('urn:lvs')
 -> proxy('http://ws.mylvs.foo/cgi-bin/lvs.cgi');
my $result = $soap->WHATISMYIP ();
unless ($result->fault) {
 print $result->result();
} else {
  print join ', ',
  $result->faultcode,
  $result->faultstring;
}
C:\Users\Administrator\Documents\lvs>perl test.pl
200 192.168.2.221


Functions

  • The LVS-WFE Webservice offers the following functions:


Function Optional Paramter Description Return
REQUESTWEIGHTDOWN String (a ip address like 192.168.1.1) Request to set the host offline String (Code(d{3}) Description
REQUESTWEIGHTUP String (a ip address like 192.168.1.1) Request to set the host online String (Code(d{3}) Description
REQUESTWEIGHTSTATUS String (a ip address like 192.168.1.1) Request the current status String (Code(d{3}) Description
REQUESTGROUPINFORMATION String (a ip address like 192.168.1.1) Request the current group configuration String (Code(d{3}) Description


Return Codes

  • The LVS-WFE Webservice retruns the following codes:
  • Log Categories
    • 2nn = Success
    • 3nn = Logical Errors
    • 4nn = Functional Errors
    • 5nn = Access or Request Errors


Code Description Return
200 Request accepted (function defined message) True
300 WeigthDown in process False
301 TurnOff in process False
302 Another maintenance service is already running False
304 Host has already maintenance running, please come back later False
305 Host has already ip renew set, please come back later False
306 Host has already ip renewed a few minutes ago, please come back later False
307 Host not found in inventory False
407 IP renew is not set (debugging only) False
408 Function not supported (debugging only) False
500 Access denied or Request Refused False
501 Access denied - update failed, contact IT-Admin False