Ejemplo n.º 1
0
class GlanceAgentDaemon(Daemon):
    def __init__(self):
        self.server_key = CONF.server_key
        super(GlanceAgentDaemon, self).__init__(PIDFILE)
        self.glanceagentapi = GlanceAgentAPI()

    def start(self):
        try:
            self.glanceagentapi.getServer(self.server_key)
        except:
            LOG.exception("Get server  info failed")
        super(GlanceAgentDaemon, self).start()

    def run(self):
        flag = 2
        while True:
            # Checks the system every 60 seconds
            self.glanceagentapi.getSystem()
            self.glanceagentapi.getProcess(self.server_key)
            self.glanceagentapi.getPortScan()
            if flag == 2:
                self.glanceagentapi.getTraffic()
                flag = 0
            time.sleep(CONF.SYSTEM_CHECK_PERIOD)
            flag += 1
Ejemplo n.º 2
0
class GlanceAgentDaemon(Daemon):

    def __init__(self):
        self.server_key = CONF.server_key
        super(GlanceAgentDaemon, self).__init__(PIDFILE)
        self.glanceagentapi = GlanceAgentAPI()
	
    def start(self):
        try:
            self.glanceagentapi.getServer(self.server_key)
        except:
            LOG.exception("Get server  info failed")
        super(GlanceAgentDaemon, self).start()

    def run(self):
        flag = 2
        while True:
            # Checks the system every 60 seconds
            self.glanceagentapi.getSystem()
            self.glanceagentapi.getProcess(self.server_key)
            self.glanceagentapi.getPortScan()
            if flag == 2 :
                self.glanceagentapi.getTraffic()
                flag = 0 
            time.sleep(CONF.SYSTEM_CHECK_PERIOD)
            flag += 1
Ejemplo n.º 3
0
class GlanceTestCase(unittest.TestCase):
    def setUp(self):
        self.api = GlanceAgentAPI()

    def tearDown(self):
        pass

    #def test_Glance_getSystem(self):
    #    system = self.api.getSystem()
    #    print system

    #def test_Glance_getServer(self):
    #    server_key = '0.0.0.0'
    #    server = self.api.getServer(server_key)
    #    print server

    #def test_Glances_getLoad(self):
    #    loadavg = self.api.getLoad()
    #    print loadavg

    #def test_Glances_getFs(self):
    #    Fs = self.api.getFs()
    #    print Fs

    #def test_Glances_getProcess(self):
    #    process = self.api.getProcess()
    #    print process

    #def test_Glances_getPortScan(self):
    #    portScan = self.api.getPortScan()
    #    print portScan

    def test_Glances_getTraffic(self):
        traffic = self.api.getTraffic()
        print traffic
Ejemplo n.º 4
0
class GlanceTestCase(unittest.TestCase):
        
    def setUp(self):
        self.api = GlanceAgentAPI()

    def tearDown(self):
        pass

    #def test_Glance_getSystem(self):
    #    system = self.api.getSystem()
    #    print system

    #def test_Glance_getServer(self):
    #    server_key = '0.0.0.0'
    #    server = self.api.getServer(server_key)
    #    print server

    #def test_Glances_getLoad(self):
    #    loadavg = self.api.getLoad()
    #    print loadavg

    #def test_Glances_getFs(self):
    #    Fs = self.api.getFs()
    #    print Fs
            
    #def test_Glances_getProcess(self):
    #    process = self.api.getProcess()
    #    print process

    #def test_Glances_getPortScan(self):
    #    portScan = self.api.getPortScan()
    #    print portScan

    def test_Glances_getTraffic(self):
        traffic = self.api.getTraffic()
        print traffic
Ejemplo n.º 5
0
 def setUp(self):
     self.api = GlanceAgentAPI()
Ejemplo n.º 6
0
 def __init__(self):
     self.server_key = CONF.server_key
     super(GlanceAgentDaemon, self).__init__(PIDFILE)
     self.glanceagentapi = GlanceAgentAPI()
Ejemplo n.º 7
0
 def __init__(self):
     self.server_key = CONF.server_key
     super(GlanceAgentDaemon, self).__init__(PIDFILE)
     self.glanceagentapi = GlanceAgentAPI()
Ejemplo n.º 8
0
 def setUp(self):
     self.api = GlanceAgentAPI()