'Main method of this registry hook.
StatsServer implementation may be overriden. If there\'s a "stats_server"
module present in grr/local directory then
grr.local.stats_server.StatsServer implementation will be used instead of
a default one.'

def RunOnce(self):

    port = config.CONFIG['Monitoring.http_port']
    if (port != 0):
        logging.info('Starting    monitoring    server    on    port    %d.', port)
        try:
            from grr.lib.local import stats_server
            server_obj = stats_server.StatsServer(port)
            logging.debug('Using    local    StatsServer')
        except ImportError:
            server_obj = StatsServer(port)
        server_obj.Start()
    else:
        logging.info('Monitoring    server    disabled.')
