'Handles SIGTERM and SIGINT, which gracefully stops the agent.'

def _handle_sigterm(self, signum, frame):

    log.debug('Caught    sigterm.    Stopping    run    loop.')
    self.run_forever = False
    if self.collector:
        self.collector.stop()
    log.debug('Collector    is    stopped.')
