code: def process(self):
          
          if self.agent.machine.fsm.current is "wait4init":
              # Test the host agent if we're ready to send data
              if self.agent.is_agent_ready():
                  self.agent.machine.fsm.ready()
              else:
                  return
  
          if self.agent.can_send():
              self.snapshot_countdown = self.snapshot_countdown - 1
              ss = None
              cm = self.collect_metrics()
  
              if self.snapshot_countdown < 1:
                  logger.debug("Sending process snapshot data")
                  self.snapshot_countdown = self.SNAPSHOT_PERIOD
                  ss = self.collect_snapshot()
                  md = copy.deepcopy(cm).delta_data(None)
              else:
                  md = copy.deepcopy(cm).delta_data(self.last_metrics)
  
              ed = EntityData(pid=self.agent.from_.pid, snapshot=ss, metrics=md)
              response = self.agent.report_data(ed)
  
              if response:
                  if response.status_code is 200 and len(response.content) > 2:
                      # The host agent returned something indicating that is has a request for us that we
                      # need to process.
                      self.handle_agent_tasks(json.loads(response.content)[0])
  
                  self.last_metrics = cm.__dict__
docs: Collects, processes & reports metrics