Exemplo n.º 1
0
    def __init__(self, agentId, startTimeStamp, host):
        self.state = TAgentStat()
        self.cup_load = TCpuLoad()
        self.state.agentId = agentId
        self.state.startTimestamp = startTimeStamp
        self.stateBatch = TAgentStatBatch()
        self.stateBatch.agentId = agentId
        self.stateBatch.startTimestamp = startTimeStamp
        self.stateBatch.agentStats = []
        self.remote = host

        self.trans_layer = DgramLayer(host, None)
        self.trans_layer.start()

        TrainLayer.registerTimers(self.sendState, 20)
        TCLogger.debug("register state timer")
Exemplo n.º 2
0
 def sendState(self, layer):
     self._upDateCurState()
     body = CollectorPro.obj2bin(self.stateBatch, AGENT_STAT_BATCH)
     TCLogger.debug("send state:%s", self.stateBatch)
     self.trans_layer.sendData(body)