def get_retention_data(self):
        retention_data = {
            'hosts': {}, 'services': {}
        }
        for host in self.hosts:
            h_dict = {}
            properties = host.__class__.properties
            properties.update(host.__class__.running_properties)
            for prop, entry in list(properties.items()):
                if not entry.retention:
                    continue
                val = getattr(host, prop)
                prepare_retention = entry.retention_preparation
                if prepare_retention:
                    val = prepare_retention(host, val)
                h_dict[prop] = val
            retention_data['hosts'][host.host_name] = h_dict
        logger.info('%d hosts sent to retention', len(retention_data['hosts']))
        for service in self.services:
            s_dict = {}
            properties = service.__class__.properties
            properties.update(service.__class__.running_properties)
            for prop, entry in list(properties.items()):
                if not entry.retention:
                    continue
                val = getattr(service, prop)
                prepare_retention = entry.retention_preparation
                if prepare_retention:
                    val = prepare_retention(service, val)
                s_dict[prop] = val
            retention_data['services'][(service.host_name, service.service_description)] = s_dict
        logger.info('%d services sent to retention', len(retention_data['services']))
        return retention_data