Webservice prepare

From MyLVS
Revision as of 19:31, 27 July 2015 by Admin (talk | contribs)
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');


Install on ALL machines:

  • apt-get install libsoap-lite-perl -s
  • apt-get install libsoap-lite-perl


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


From the 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->REQUESTWEIGHTSTATUS ();
#my $result = $soap->WHATISMYIP ();
#my $result = $soap->REQUESTWEIGHTDOWN ();
my $result = $soap->REQUESTWEIGHTUP ();
unless ($result->fault) {
 print $result->result();
} else {
  print join ', ',
    $result->faultcode,
    $result->faultstring;
}