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...")
    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...")
    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...")