'Run all instances.'

def run(self):

    (before, after) = (None, None)
    if (self.in_developer_mode and (self.name != AGENT_METRICS_CHECK_NAME)):
        try:
            before = AgentCheck._collect_internal_stats()
        except Exception:
            self.log.debug('Failed    to    collect    Agent    Stats    before    check    {0}'.format(self.name))
    instance_statuses = []
    for (i, instance) in enumerate(self.instances):
        try:
            min_collection_interval = instance.get('min_collection_interval', self.min_collection_interval)
            now = time.time()
            if ((now - self.last_collection_time[i]) < min_collection_interval):
                self.log.debug('Not    running    instance    #{0}    of    check    {1}    as    it    ran    less    than    {2}s    ago'.format(i, self.name, min_collection_interval))
                continue
            self.last_collection_time[i] = now
            check_start_time = None
            if self.in_developer_mode:
                check_start_time = timeit.default_timer()
            self.check(copy.deepcopy(instance))
            instance_check_stats = None
            if (check_start_time is not None):
                instance_check_stats = {'run_time': (timeit.default_timer() - check_start_time)}
            if self.has_warnings():
                instance_status = check_status.InstanceStatus(i, check_status.STATUS_WARNING, warnings=self.get_warnings(), instance_check_stats=instance_check_stats)
            else:
                instance_status = check_status.InstanceStatus(i, check_status.STATUS_OK, instance_check_stats=instance_check_stats)
        except Exception as e:
            self.log.exception(("Check    '%s'    instance    #%s    failed" % (self.name, i)))
            instance_status = check_status.InstanceStatus(i, check_status.STATUS_ERROR, error=str(e), tb=traceback.format_exc())
        finally:
            self._roll_up_instance_metadata()
            self.get_warnings()
        instance_statuses.append(instance_status)
    if (self.in_developer_mode and (self.name != AGENT_METRICS_CHECK_NAME)):
        try:
            after = AgentCheck._collect_internal_stats()
            if self.allow_profiling:
                self._set_internal_profiling_stats(before, after)
                log.info(('\n     DCTB     %s    %s' % (self.name, pretty_statistics(self._internal_profiling_stats))))
        except Exception:
            self.log.debug('Failed    to    collect    Agent    Stats    after    check    {0}'.format(self.name))
    return instance_statuses
