예제 #1
0
 def send_generator_info(self):
     from gen_py.sandesh_uve.ttypes import SandeshClientInfo, \
         ModuleClientState, SandeshModuleClientTrace
     if not self._client or not self._client.connection():
         return
     client_info = SandeshClientInfo()
     try:
         client_start_time = self._start_time
     except Exception:
         self._start_time = util.UTCTimestampUsec()
     finally:
         client_info.start_time = self._start_time
         client_info.pid = os.getpid()
         if self._http_server is not None:
             client_info.http_port = self._http_server.get_port()
         client_info.collector_name = \
             self._client.connection().collector_name() or ''
         client_info.collector_ip = \
             self._client.connection().collector() or ''
         client_info.collector_list = self._client.connection().collectors()
         client_info.status = self._client.connection().state()
         client_info.successful_connections = (
             self._client.connection().statemachine().connect_count())
         module_state = ModuleClientState(name=self._source + ':' +
                                          self._node_type + ':' +
                                          self._module + ':' +
                                          self._instance_id,
                                          client_info=client_info,
                                          sm_queue_count=self._client.\
             connection().statemachine()._event_queue.size(),
                                          max_sm_queue_count=self._client.\
             connection().statemachine()._event_queue.max_qlen())
         generator_info = SandeshModuleClientTrace(data=module_state,
                                                   sandesh=self)
         generator_info.send(sandesh=self)
예제 #2
0
 def send_generator_info(self):
     from gen_py.sandesh_uve.ttypes import SandeshClientInfo, \
         ModuleClientState, SandeshModuleClientTrace
     client_info = SandeshClientInfo()
     try:
         client_start_time = self._start_time
     except Exception:
         self._start_time = util.UTCTimestampUsec()
     finally:
         client_info.start_time = self._start_time
         client_info.pid = os.getpid()
         if self._http_server is not None:
             client_info.http_port = self._http_server.get_port()
         client_info.collector_name = self._client.connection().collector()
         client_info.status = self._client.connection().state()
         client_info.successful_connections = (
             self._client.connection().statemachine().connect_count())
         client_info.primary = self._client.connection().primary_collector()
         if client_info.primary is None:
             client_info.primary = ''
         client_info.secondary = (
             self._client.connection().secondary_collector())
         if client_info.secondary is None:
             client_info.secondary = ''
         module_state = ModuleClientState(
             name=self._source + ':' + self._node_type + ':' +
             self._module + ':' + self._instance_id,
             client_info=client_info)
         generator_info = SandeshModuleClientTrace(data=module_state,
                                                   sandesh=self)
         generator_info.send(sandesh=self)