コード例 #1
0
    def execute(self, jbossHome, controller, user, password):
        self.fillParameters(jbossHome, controller, user, password)
        print chr(27) + "[2J"
        console.flush()
        print("hai chiamato check JGroups Sender")

        try:
            pm = PropertyManager("Domains/domains.properties")
            javaHome = pm.getValue("java.home")
            bindAddress =  FindUtils.getGenericString("inserire il bind address >")
            mcastAddress =  FindUtils.getGenericString("inserire il multicast address >")
            mcastPort = FindUtils.getGenericString("inserire la multicast port >")

            subprocess.check_call([javaHome+"/bin/java","-Djava.net.preferIPv4Stack=true","-cp", jbossHome+"modules/system/layers/base/org/jgroups/main/jgroups-3.2.7.Final-redhat-1.jar", "org.jgroups.tests.McastSenderTest",
                                   "-mcast_addr",mcastAddress, "-bind_addr",bindAddress,"-port",mcastPort ])






        except (CalledProcessError, EapManagerException, ValueError) as e:
            print(e.message)
            pass

        raw_input("premere un tasto per continuare...")
コード例 #2
0
    def execute(self, jbossHome, controller, user, password):
        print chr(27) + "[2J"
        console.flush()
        print("hai chiamato startCluster")

        try:
            domain = FindUtils.getDomain("domains")
            cluster = FindUtils.getCluster(domain)

            print("Avvio cluster: "+cluster)
            self.sendCommand(jbossHome,controller,user,password,cluster)

        except (CalledProcessError, EapManagerException) as e:
            print(e.message)
            pass

        raw_input("premere un tasto per continuare...")
コード例 #3
0
    def execute(self, jbossHome, controller, user, password):
        print chr(27) + "[2J"
        console.flush()
        print("hai chiamato create Cluster")

        try:
            domain = FindUtils.getDomain("domains")
            profile = FindUtils.getGenericString("inserire il nome del profilo>")
            cluster = FindUtils.getGenericString("inserire il nome del cluster>")

            print("Creo cluster: "+cluster)
            self.sendCommand(jbossHome,controller,user,password,cluster, domain, profile)

        except (CalledProcessError, EapManagerException) as e:
            print(e.message)
            pass

        raw_input("premere un tasto per continuare...")
コード例 #4
0
    def execute(self, jbossHome, controller, user, password):
        print chr(27) + "[2J"
        console.flush()
        print("hai chiamato insert JVM option")

        try:
            domain = FindUtils.getDomain("domains")
            cluster = FindUtils.getCluster(domain)
            instanceTuple = FindUtils.getInstance(domain,cluster)
            option = FindUtils.getGenericString("jvm option >")

            self.sendCommand(jbossHome,controller,user,password,instanceTuple[1],instanceTuple[0],option)


        except (CalledProcessError, EapManagerException) as e:
            print(e.message)
            pass

        raw_input("premere un tasto per continuare...")
コード例 #5
0
    def execute(self, jbossHome, controller, user, password):
        print chr(27) + "[2J"
        console.flush()
        print("hai chiamato create Instance")

        try:
            domain = FindUtils.getDomain("domains")
            cluster = FindUtils.getCluster(domain)
            hostcontroller = FindUtils.getGenericString("host controller dovre creare l'istanza>")
            instanceName = FindUtils.getGenericString("nome istanza>")
            offset = FindUtils.getGenericString("port offset>")

            print("Creo Istanza: "+instanceName)
            self.sendCommand(jbossHome,controller,user,password, domain, cluster,hostcontroller,instanceName,offset)


        except (CalledProcessError, EapManagerException) as e:
            print(e.message)
            pass

        raw_input("premere un tasto per continuare...")
コード例 #6
0
    def execute(self, jbossHome, controller, user, password):
        print chr(27) + "[2J"
        console.flush()
        print("hai chiamato deploy")

        try:
            domain = FindUtils.getDomain("domains")
            cluster = FindUtils.getCluster(domain)
            pathTuple = FindUtils.findPath()

            print("Avvio cluster: "+cluster)
            self.sendCommand(jbossHome, controller, user, password, pathTuple[0], cluster, pathTuple[1])

            key="application."+domain+"."+cluster+".name"
            fname = "Domains/"+domain+".properties"
            pm = PropertyManager()
            pm.writeValue(fname,key,pathTuple[1].strip())
            raw_input("premere un tasto per continuare...")

        except (CalledProcessError, EapManagerException) as e:
            print(e.message)
            pass
コード例 #7
0
    def execute(self, jbossHome, controller, user, password):
        self.fillParameters(jbossHome, controller, user, password)
        print chr(27) + "[2J"
        console.flush()
        print("hai chiamato check Http statistics")

        try:
            domain = FindUtils.getDomain("domains")
            cluster = FindUtils.getCluster(domain)
            instanceTuple = FindUtils.getInstance(domain,cluster)
            pollNumb =  FindUtils.getGenericString("inserire il numero di poll >")
            pollInterval =  FindUtils.getGenericString("inserire il polling interval (sec) >")
            startCommand ='"/host='+instanceTuple[1]+'/server='+instanceTuple[0]+'/subsystem=web/connector=http:read-resource(include-runtime=true)"'
            if(pollInterval != None) and (pollNumb != None):

                pollNumb = int(pollNumb)
                pollInterval = int(pollInterval)
                print("Bytes Received | Bytes Sent | Error Count | Request Count |")
                for i in range(pollNumb):
                    psCons = subprocess.Popen(self._complPath+" "+self._cliconn+" "+self._complContr+" "+self._complUser+" "+self._complPwd+" "+startCommand, shell=True, stdout=subprocess.PIPE)
                    output = psCons.stdout.read()
                    psCons.stdout.close()
                    psCons.wait()

                    statsDict = ValueUtils.parseCliOutput(output)

                    print(statsDict['bytesReceived']+" "+
                          "         |"+statsDict['bytesSent']+" "+
                          "    |"+statsDict['errorCount']+" "+
                          "           |"+statsDict['requestCount']+" ")

                    time.sleep(pollInterval)

        except (CalledProcessError, EapManagerException, ValueError) as e:
            print(e.message)
            pass

        raw_input("premere un tasto per continuare...")
コード例 #8
0
    def execute(self, jbossHome, controller, user, password):
        self.fillParameters(jbossHome, controller, user, password)
        print chr(27) + "[2J"
        console.flush()
        print("hai chiamato restartCluster")

        try:
            domain = FindUtils.getDomain("domains")
            cluster = FindUtils.getCluster(domain)

            print("Avvio cluster: "+cluster)

            startCommand = "/server-group="+cluster+":restart-servers"

            print("eseguo: "+self._complPath + " " + self._cliconn + " " + self._complContr + " " + self._complUser + " " + self._complPwd + " " + startCommand)

            subprocess.check_call([self._complPath,self._cliconn,self._complContr,self._complUser,self._complPwd,startCommand])

        except (CalledProcessError, EapManagerException) as e:
            print(e.message)
            pass

        raw_input("premere un tasto per continuare...")
コード例 #9
0
    def execute(self, jbossHome, controller, user, password):
        self.fillParameters(jbossHome, controller, user, password)
        print chr(27) + "[2J"
        console.flush()
        print("hai chiamato check Thread statistics")

        try:
            domain = FindUtils.getDomain("domains")
            cluster = FindUtils.getCluster(domain)
            instanceTuple = FindUtils.getInstance(domain,cluster)
            pollNumb =  FindUtils.getGenericString("inserire il numero di poll >")
            pollInterval =  FindUtils.getGenericString("inserire il polling interval (sec) >")
            startCommand ='"/host='+instanceTuple[1]+'/server='+instanceTuple[0]+'/core-service=platform-mbean/type=threading:read-resource"'
            if(pollInterval != None) and (pollNumb != None):

                pollNumb = int(pollNumb)
                pollInterval = int(pollInterval)
                print("Current Threads Count | Peak Thread Count | Daemon Thread Count ")
                for i in range(pollNumb):
                    psCons = subprocess.Popen(self._complPath+" "+self._cliconn+" "+self._complContr+" "+self._complUser+" "+self._complPwd+" "+startCommand, shell=True, stdout=subprocess.PIPE)
                    output = psCons.stdout.read()
                    psCons.stdout.close()
                    psCons.wait()

                    statsDict = ValueUtils.parseCliOutput(output)

                    print(statsDict['thread-count']+" "+
                          "                  |"+statsDict['peak-thread-count']+" "+
                          "               |"+statsDict['daemon-thread-count']+" ")

                    time.sleep(pollInterval)

        except (CalledProcessError, EapManagerException, ValueError) as e:
            print(e.message)
            pass

        raw_input("premere un tasto per continuare...")
コード例 #10
0
    def execute(self, jbossHome, controller, user, password):
        self.fillParameters(jbossHome, controller, user, password)
        print chr(27) + "[2J"
        console.flush()
        print("hai chiamato startInstance")

        try:
            domain = FindUtils.getDomain("domains")
            cluster = FindUtils.getCluster(domain)
            instanceTuple = FindUtils.getInstance(domain,cluster)
            datasource = FindUtils.getGenericString("inserire il nome del datasource >")
            print("Check Datasource: "+datasource)

            startCommand =  "/host="+instanceTuple[1]+"/server="+instanceTuple[0]+"/subsystem=datasources/data-source="+datasource+":test-connection-in-pool"

            print("eseguo: "+self._complPath+" "+self._cliconn+" "+self._complContr+" "+self._complUser+" "+self._complPwd+" "+startCommand)

            subprocess.check_call([self._complPath,self._cliconn,self._complContr,self._complUser,self._complPwd,startCommand])

        except (CalledProcessError, EapManagerException) as e:
            print(e.message)
            pass

        raw_input("premere un tasto per continuare...")
コード例 #11
0
    def execute(self, jbossHome, controller, user, password):
        self.fillParameters(jbossHome, controller, user, password)
        print chr(27) + "[2J"
        console.flush()
        print("hai chiamato check Datasource statistics")

        try:
            domain = FindUtils.getDomain("domains")
            cluster = FindUtils.getCluster(domain)

            instanceTuple = FindUtils.getInstance(domain,cluster)
            datasource = FindUtils.getGenericString("inserire il nome del datasource >")
            pollNumb =  FindUtils.getGenericString("inserire il numero di poll >")
            pollInterval =  FindUtils.getGenericString("inserire il polling interval (sec) >")
            print("Check Datasource Statistics: "+datasource)
            startCommand ='"/host='+instanceTuple[1]+'/server='+instanceTuple[0]+'/subsystem=datasources/data-source='+datasource+'/statistics=pool:read-resource(include-runtime=true)"'
            print(startCommand)
            if(pollInterval != None) and (pollNumb != None):

                pollNumb = int(pollNumb)
                pollInterval = int(pollInterval)
                print("Available Connections | Created Connections | In use Connections | Active Connections | Max used Connections")
                for i in range(pollNumb):
                    psCons = subprocess.Popen(self._complPath+" "+self._cliconn+" "+self._complContr+" "+self._complUser+" "+self._complPwd+" "+startCommand, shell=True, stdout=subprocess.PIPE)
                    output = psCons.stdout.read()
                    psCons.stdout.close()
                    psCons.wait()

                    statsDict = ValueUtils.parseCliOutput(output)

                    if("outcome" not in statsDict) and (statsDict['outcome'] != "success"):
                        raise EapManagerException("Datasource stats collection failed")


                    print(statsDict['AvailableCount']+" "+
                          "                   |"+statsDict['CreatedCount']+" "+
                          "                   |"+statsDict['InUseCount']+" "+
                          "                  |"+statsDict['ActiveCount']+" "+
                          "                  |"+statsDict['MaxUsedCount']+" ")
                    time.sleep(pollInterval)

        except (CalledProcessError, EapManagerException, ValueError) as e:
            print(e.message)
            pass

        raw_input("premere un tasto per continuare...")
コード例 #12
0
    def execute(self, jbossHome, controller, user, password):
        self.fillParameters(jbossHome, controller, user, password)
        print chr(27) + "[2J"
        console.flush()
        print("hai chiamato deploy drain mode")

        try:
            domain = FindUtils.getDomain("domains")
            print("server group passive...")
            clusterA = FindUtils.getCluster(domain)
            print("server group active...")
            clusterB = FindUtils.getCluster(domain)
            pathTuple = FindUtils.findPath()
            runtimeNameList = pathTuple[0].split('/')
            runtimeNameSingle = runtimeNameList[len(runtimeNameList)-1]
            runtimeName = self._clirname+runtimeNameSingle

            deployCommand =  'deploy'
            sgCompl=self._clisgs+clusterB
            nameCompl=self._cliname+pathTuple[1]

            pm = PropertyManager("Domains/"+domain+".properties")
            hostNumb = pm.getValue("host.number")
            hostPrefix = pm.getValue("host.prefix")
            hostSuffix = pm.getValue("host.suffix")

            appKey="application."+domain+"."+clusterB+".name"

            #appName = pm.getValue(appKey)
            appName=pathTuple[1]
            
            #UNDEPLOY FROM PASSIVE CLUSTER
            #list deployments in group
            listDeploymentsPassiveCommand='ls'+" "+ self._clisg + clusterA+'/deployment'
            print("eseguo: "+self._complPath+" "+self._cliconn+" "+self._complContr+" "+self._complUser+" "+self._complPwd+" "+listDeploymentsPassiveCommand)
            output = subprocess.Popen([self._complPath,self._cliconn,self._complContr,self._complUser,self._complPwd,listDeploymentsPassiveCommand], stdout=subprocess.PIPE ).communicate()[0]
            deploymentList = ValueUtils.parseDeploymentList(output)

            if(appName in deploymentList):
                undeployCommand=self._clisg+clusterA+self._clidpmt+appName+":undeploy()"
                print(undeployCommand)
                subprocess.check_call([self._complPath,self._cliconn,self._complContr,self._complUser,self._complPwd,undeployCommand])
                removeSgCommand=self._clisg+clusterA+self._clidpmt+appName+":remove()"
                print(undeployCommand)
                subprocess.check_call([self._complPath,self._cliconn,self._complContr,self._complUser,self._complPwd,removeSgCommand])
        
        
            #list deployments in domain
            listDeploymentsCommandDomain='ls'+" "+ '/deployment'
            print("eseguo: "+self._complPath+" "+self._cliconn+" "+self._complContr+" "+self._complUser+" "+self._complPwd+" "+listDeploymentsCommandDomain)
            output = subprocess.Popen([self._complPath,self._cliconn,self._complContr,self._complUser,self._complPwd,listDeploymentsCommandDomain], stdout=subprocess.PIPE ).communicate()[0]
            deploymentList = ValueUtils.parseDeploymentList(output)
            #undeploy
            if(appName in deploymentList):
                #list deployments in group
                listDeploymentsCommand='ls'+" "+ self._clisg + clusterB+'/deployment'
                print("eseguo: "+self._complPath+" "+self._cliconn+" "+self._complContr+" "+self._complUser+" "+self._complPwd+" "+listDeploymentsCommand)
                output = subprocess.Popen([self._complPath,self._cliconn,self._complContr,self._complUser,self._complPwd,listDeploymentsCommand], stdout=subprocess.PIPE ).communicate()[0]
                deploymentList = ValueUtils.parseDeploymentList(output)

                if(appName in deploymentList):
                    undeployCommand=self._clisg+clusterB+self._clidpmt+appName+":undeploy()"
                    print(undeployCommand)
                    subprocess.check_call([self._complPath,self._cliconn,self._complContr,self._complUser,self._complPwd,undeployCommand])
                    removeSgCommand=self._clisg+clusterB+self._clidpmt+appName+":remove()"
                    print(undeployCommand)
                    subprocess.check_call([self._complPath,self._cliconn,self._complContr,self._complUser,self._complPwd,removeSgCommand])
                
                removeCommand=self._clidpmt+appName+":remove()"
                print(removeCommand)
                subprocess.check_call([self._complPath,self._cliconn,self._complContr,self._complUser,self._complPwd,removeCommand])

            #deploy
            print(self._complPath+" "+self._cliconn+" "+self._complContr+" "+self._complUser+" "+self._complPwd+" "+deployCommand+" "+pathTuple[0]+" "+sgCompl+" "+nameCompl+" "+runtimeName)
            subprocess.check_call([self._complPath,self._cliconn,self._complContr,self._complUser,self._complPwd,deployCommand+" "+pathTuple[0]+" "+sgCompl+" "+nameCompl+" "+runtimeName])

            #enable contexts
            for i in range(int(hostNumb)):
                instances = pm.getValue("cluster."+clusterB+"."+hostPrefix+str(i+1)+hostSuffix+".instances").split(',')
                for instance in instances:
                    enableCommand = "/host="+hostPrefix+str(i+1)+hostSuffix+"/server="+instance+"/subsystem=modcluster:enable()"
                    print(enableCommand)
                    subprocess.check_call([self._complPath,self._cliconn,self._complContr,self._complUser,self._complPwd,enableCommand])


            #disable contexts
            for i in range(int(hostNumb)):
                print("cluster."+clusterA+"."+hostPrefix+str(i+1)+".instances")
                instances = pm.getValue("cluster."+clusterA+"."+hostPrefix+str(i+1)+hostSuffix+".instances").split(',')
                for instance in instances:
                    disableCommand = "/host="+hostPrefix+str(i+1)+hostSuffix+"/server="+instance+"/subsystem=modcluster:disable()"
                    print(disableCommand)
                    subprocess.check_call([self._complPath,self._cliconn,self._complContr,self._complUser,self._complPwd,disableCommand])

            fname = "Domains/"+domain+".properties"
            pm = PropertyManager()
            pm.updateValue(fname,appKey,pathTuple[1].strip())




        except (CalledProcessError, EapManagerException) as e:
            print(e.message)
            pass


        raw_input("premere un tasto per continuare...")
コード例 #13
0
    def execute(self, jbossHome, controller, user, password):
        self.fillParameters(jbossHome, controller, user, password)
        print chr(27) + "[2J"
        console.flush()
        print("hai chiamato deploy drain mode")

        try:
            domain = FindUtils.getDomain("domains")
            print("server group passive...")
            clusterA = FindUtils.getCluster(domain)
            print("server group active...")
            clusterB = FindUtils.getCluster(domain)
            pathTuple = FindUtils.findPath()

            deployCommand =  'deploy'
            sgCompl=self._clisg+clusterB
            nameCompl=self._cliname+pathTuple[1]

            pm = PropertyManager("Domains/"+domain+".properties")
            hostNumb = pm.getValue("host.number")
            hostPrefix = pm.getValue("host.prefix")

            appKey="application."+domain+"."+clusterB+".name"

            appName = pm.getValue(appKey)

            #undeploy
            if(appName != None):
                undeployCommand="/server-group="+clusterB+"/deployment="+appName+":undeploy()"
                print(undeployCommand)
                subprocess.check_call([self._complPath,self._cliconn,self._complContr,self._complUser,self._complPwd,undeployCommand])
                removeSgCommand="/server-group="+clusterB+"/deployment="+appName+":remove()"
                print(undeployCommand)
                subprocess.check_call([self._complPath,self._cliconn,self._complContr,self._complUser,self._complPwd,removeSgCommand])
                removeCommand="/deployment="+appName+":remove()"
                print(removeCommand)
                subprocess.check_call([self._complPath,self._cliconn,self._complContr,self._complUser,self._complPwd,removeCommand])

            #deploy
            print(self._complPath+" "+self._cliconn+" "+self._complContr+" "+self._complUser+" "+self._complPwd+" "+deployCommand+" "+pathTuple[0]+" "+sgCompl+" "+nameCompl)
            subprocess.check_call([self._complPath,self._cliconn,self._complContr,self._complUser,self._complPwd,deployCommand+" "+pathTuple[0]+" "+sgCompl+" "+nameCompl])

            #enable contexts
            for i in range(int(hostNumb)):
                instances = pm.getValue("cluster."+clusterB+"."+hostPrefix+str(i+1)+".instances").split(',')
                for instance in instances:
                    enableCommand = "/host="+hostPrefix+str(i+1)+"/server="+instance+"/subsystem=modcluster:enable()"
                    print(enableCommand)
                    subprocess.check_call([self._complPath,self._cliconn,self._complContr,self._complUser,self._complPwd,enableCommand])


            #disable contexts
            for i in range(int(hostNumb)):
                print("cluster."+clusterA+"."+hostPrefix+str(i+1)+".instances")
                instances = pm.getValue("cluster."+clusterA+"."+hostPrefix+str(i+1)+".instances").split(',')
                for instance in instances:
                    disableCommand = "/host="+hostPrefix+str(i+1)+"/server="+instance+"/subsystem=modcluster:disable()"
                    print(disableCommand)
                    subprocess.check_call([self._complPath,self._cliconn,self._complContr,self._complUser,self._complPwd,disableCommand])

            fname = "Domains/"+domain+".properties"
            pm = PropertyManager()
            pm.updateValue(fname,appKey,pathTuple[1].strip())




        except (CalledProcessError, EapManagerException) as e:
            print(e.message)
            pass


        raw_input("premere un tasto per continuare...")