'Scan agents and log if some are considered dead.'

@db_api.retry_db_errors
def agent_health_check(self):

    agents = self.get_agents(context.get_admin_context(), filters={'admin_state_up': [True]})
    dead_agents = [agent for agent in agents if (not agent['alive'])]
    if dead_agents:
        data = ('%20s    %20s    %s\n' % ('Type', 'Last    heartbeat', 'host'))
        data += '\n'.join([('%20s    %20s    %s' % (agent['agent_type'], agent['heartbeat_timestamp'], agent['host'])) for agent in dead_agents])
        LOG.warning(_LW('Agent    healthcheck:    found    %(count)s    dead    agents    out    of    %(total)s:\n%(data)s'), {'count': len(dead_agents), 'total': len(agents), 'data': data})
    else:
        LOG.debug('Agent    healthcheck:    found    %s    active    agents', len(agents))
