Пример #1
0
    def prepare_exec(self):
        # extracting list of vms that will be used to extract values
        vmObj = TransformXmlToVM()
        vmObj.readXml("/home/khaled/listeVMsTest.xml")
        vms = vmObj.getVM()
        self.host = "%s,%s,%s" % (vms[0].host, vms[0].user, vms[0].password)
        print "VM:"
        print self.host

        # extracting of command from xml file:
        cmdCl = TransformXmlToCmd()
        cmdCl.readXml("/home/khaled/cmdCrTest.xml")

        # preapring list of indicator used
        listCr = []
        listCr.append("disk")
        self.cmd = cmdCl.getcmd(listCr)
        # cmd is a list containing objects that contain the indicator and her command
        # print 'commande extraite'
        print self.cmd[0].cmd
        # preparing connexion to run commands
        self.cnx = RunCommand()

        # adding hosts extracted early
        self.cnx.do_add_host(self.host)
        self.cnx.do_connect()
Пример #2
0
stdin.close()
data = stdout.read().splitlines()
for line in data:
    print line
"""
from run_command import RunCommand
from extract_cmd import TransformXmlToCmd, Cmd
from extractVM import TransformXmlToVM, VM
from extract_value import obj_extract
from extract_cr import Indicator
from thread_exec import threadCR
import logging


#extracting list of vms that will be used to extract values
vmObj = TransformXmlToVM()
vmObj.readXml('listeVMsTest.xml')
vms = vmObj.getVM()
v = "%s,%s,%s" % (vms[0].host, vms[0].user, vms[0].password)
print 'VM:'
print v

cr=Indicator()
cr.name='disk'
cr.maxApp=100
cr.maxPhy=150
cr.minApp=0
th=threadCR(v,cr)
th.start()
th.join()
print 'Fin thread'