Exemple #1
0
    def get_contact(self):
        """
        Get contacts from alignak_backend

        :return: None
        """
        backend = Backend()
        all_contacts = backend.method_get(self.endpoint('contact?embedded={"use":1,'
                                                        '"contactgroups":1,'
                                                        '"host_notification_period":1,'
                                                        '"service_notification_period":1,'
                                                        '"host_notification_commands":1,'
                                                        '"service_notification_commands":1}'))
        for contact in all_contacts:
            contact['imported_from'] = 'alignakbackend'
            # use
            self.single_relation(contact, 'use', 'name')
            # host_notification_period
            self.single_relation(contact, 'host_notification_period', 'timeperiod_name')
            # service_notification_period
            self.single_relation(contact, 'service_notification_period', 'timeperiod_name')
            # contactgroups
            self.multiple_relation(contact, 'contactgroups', 'contactgroup_name')
            # host_notification_commands
            self.multiple_relation(contact, 'host_notification_commands',
                                   'command_name')
            # service_notification_commands
            self.multiple_relation(contact, 'service_notification_commands',
                                   'command_name')

            self.backend_ids['contacts'][contact['_id']] = contact['contact_name']
            self.clean_unusable_keys(contact)
            self.config['contacts'].append(contact)
Exemple #2
0
    def hook_save_retention(self, scheduler):
        """
        Save retention data from alignak-backend

        :param scheduler: scheduler instance of alignak
        :type scheduler: object
        :return: None
        """
        backend = Backend()
        headers = {'Content-Type': 'application/json'}
        data_to_save = scheduler.get_retention_data()
        # clean all hosts first
        backend.method_delete(self.endpoint('retentionhost'))
        # Add all hosts after
        for host in data_to_save['hosts']:
            data_to_save['hosts'][host]['host'] = host
            backend.method_post(self.endpoint('retentionhost'),
                                ujson.dumps(data_to_save['hosts'][host]),
                                headers=headers)

        # clean all services first
        backend.method_delete(self.endpoint('retentionservice'))
        # Add all services after
        for service in data_to_save['services']:
            data_to_save['services'][service]['service'] = service
            backend.method_post(self.endpoint('retentionservice'),
                                ujson.dumps(data_to_save['services'][service]),
                                headers=headers)
Exemple #3
0
    def get_services(self):
        """
        Get services from alignak_backend

        :return: None
        """
        backend = Backend()
        all_services = backend.method_get(self.endpoint('service?embedded={"use":1,"host_name":1,'
                                                        '"servicegroups":1,"check_command":1,'
                                                        '"check_period":1,"notification_period":1,'
                                                        '"contacts":1,"contact_groups":1,'
                                                        '"escalations":1,"maintenance_period":1,'
                                                        '"service_dependencies":1}'))
        logger.warning("[Alignak Backend Arbit] Got %d services", len(all_services))
        for service in all_services:
            service['imported_from'] = 'alignakbackend'
            # check_command
            if 'check_command' in service:
                if service['check_command'] is None:
                    del service['check_command']
                elif 'command_name' in service['check_command']:
                    service['check_command'] = service['check_command']['command_name']
                else:
                    del service['check_command']
            if 'check_command_args' in service:
                if 'check_command' not in service:
                    service['check_command'] = ''
                else:
                    service['check_command'] += '!'
                service['check_command'] += service['check_command_args']
                del service['check_command_args']
            # use
            self.single_relation(service, 'use', 'name')
            # host_name
            self.single_relation(service, 'host_name', 'host_name')
            # check_period
            self.single_relation(service, 'check_period', 'timeperiod_name')
            # notification_period
            self.single_relation(service, 'notification_period', 'timeperiod_name')
            # maintenance_period
            self.single_relation(service, 'maintenance_period', 'timeperiod_name')
            # servicegroups
            self.multiple_relation(service, 'servicegroups', 'servicegroup_name')
            # contacts
            self.multiple_relation(service, 'contacts', 'contact_name')
            # contact_groups
            self.multiple_relation(service, 'contact_groups', 'contactgroup_name')
            # escalations
            self.multiple_relation(service, 'escalations', 'escalation_name')
            # service_dependencies
            self.multiple_relation(service, 'service_dependencies', 'service_name')

            self.clean_unusable_keys(service)
            self.config['services'].append(service)
    def test_patch_works(self):
        headers = {
            'Content-Type': 'application/json',
            'If-Match': '27f88f9749259b53ccaf48331074fa54d092e1cc'
        }
        data = {'state': 'UP'}

        backend = Backend()

        with HTTMock(response_patch):
            resp = backend.method_patch('http://alignakbackend.local/livehost/55d113976376e9835e1b2feb', ujson.dumps(data), headers)

        self.assertEqual({"_updated": "Wed, 19 Aug 2015 07:59:51 GMT", "_links": {"self": {"href": "livehost/55d113976376e9835e1b2feb", "title": "Livehost"}}, "_created": "Sun, 16 Aug 2015 22:49:59 GMT", "_status": "OK", "_id": "55d113976376e9835e1b2feb", "_etag": "fff582e398e47bce29e7317f25eb5068aaac3c4a"}, resp)
    def test_get_single(self):
        """
        Get single data (get on object to get properties)

        :return: None
        """

        backend = Backend()

        with HTTMock(response_get_simple):
            resp = backend.method_get('http://alignakbackend.local/host/55d113586376e9835e1b2fe6?projection={"host_name":1}')

        self.assertEqual({u'_updated': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_links': {u'self': {u'href': u'host/55d113586376e9835e1b2fe6', u'title': u'Host'}, u'parent': {u'href': u'/', u'title': u'home'}, u'collection': {u'href': u'host', u'title': u'host'}}, u'host_name': u'alix', u'_created': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_id': u'55d113586376e9835e1b2fe6', u'_etag': u'694909e730bf5da80f10ee386eea03d73ab9ec76'}, resp)
Exemple #6
0
    def get_hosts(self):
        """
        Get hosts from alignak_backend

        :return: None
        """
        backend = Backend()
        all_hosts = backend.method_get(self.endpoint('host?embedded={"use":1,"parents":1,'
                                                     '"hostgroups":1,"check_command":1,'
                                                     '"contacts":1,"contact_groups":1,'
                                                     '"escalations":1,"check_period":1,'
                                                     '"notification_period":1}'))
        logger.warning("[Alignak Backend Arbit] Got %d hosts", len(all_hosts))
        for host in all_hosts:
            host['imported_from'] = 'alignakbackend'
            # use
            self.single_relation(host, 'use', 'name')
            # check_command
            if 'check_command' in host:
                if host['check_command'] is None:
                    host['check_command'] = ''
                elif 'command_name' in host['check_command']:
                    host['check_command'] = host['check_command']['command_name']
                else:
                    host['check_command'] = ''
            if 'check_command_args' in host:
                if 'check_command' not in host:
                    host['check_command'] = ''
                else:
                    host['check_command'] += '!'
                host['check_command'] += host['check_command_args']
                del host['check_command_args']
            # check_period
            self.single_relation(host, 'check_period', 'timeperiod_name')
            # notification_period
            self.single_relation(host, 'notification_period', 'timeperiod_name')
            # parents
            self.multiple_relation(host, 'parents', 'host_name')
            # hostgroups
            self.multiple_relation(host, 'hostgroups', 'hostgroup_name')
            # contacts
            self.multiple_relation(host, 'contacts', 'contact_name')
            # contact_groups
            self.multiple_relation(host, 'contact_groups', 'contactgroup_name')
            # escalations
            self.multiple_relation(host, 'escalations', 'escalation_name')
            if host['realm'] is None:
                del host['realm']
            self.backend_ids['hosts'][host['_id']] = host['host_name']
            self.clean_unusable_keys(host)
            self.config['hosts'].append(host)
Exemple #7
0
    def get_commands(self):
        """
        Get commands from alignak_backend

        :return: None
        """
        backend = Backend()
        all_commands = backend.method_get(self.endpoint('command?embedded={"use":1}'))
        logger.warning("[Alignak Backend Arbit] Got %d commands", len(all_commands))
        for command in all_commands:
            command['imported_from'] = 'alignakbackend'
            # use
            self.single_relation(command, 'use', 'name')

            self.backend_ids['commands'][command['_id']] = command['command_name']
            self.clean_unusable_keys(command)
            self.config['commands'].append(command)
Exemple #8
0
    def get_timeperiods(self):
        """
        Get timeperiods from alignak_backend

        :return: None
        """
        backend = Backend()
        all_timeperiods = backend.method_get(self.endpoint('timeperiod?embedded={"use":1}'))
        for timeperiod in all_timeperiods:
            timeperiod['imported_from'] = 'alignakbackend'
            # use
            self.single_relation(timeperiod, 'use', 'name')
            for daterange in timeperiod['dateranges']:
                timeperiod.update(daterange)
            del timeperiod['dateranges']
            self.backend_ids['timeperiods'][timeperiod['_id']] = timeperiod['timeperiod_name']
            self.clean_unusable_keys(timeperiod)
            self.config['timeperiods'].append(timeperiod)
Exemple #9
0
    def hook_load_retention(self, scheduler):
        """
        Load retention data from alignak-backend

        :param scheduler: scheduler instance of alignak
        :type scheduler: object
        :return: None
        """
        backend = Backend()
        all_data = {'hosts': {}, 'services': {}}
        response = backend.method_get(self.endpoint('retentionhost'))
        for host in response:
            all_data['hosts'][host['host']] = host
        response = backend.method_get(self.endpoint('retentionservice'))
        for service in response:
            all_data['services'][(service['service'][0], service['service'][1])] = service

        scheduler.restore_retention_data(all_data)
    def test_patch_etag_notok_notok(self):
        """
        Test Patch method with _etag not ok + 1 retry _etag not ok

        :return: None
        """

        headers = {
            'Content-Type': 'application/json',
            'If-Match': '27f88f9749259b53ccaf48331074fa54d092e1cd'
        }
        data = {'state': 'UP'}

        backend = Backend()

        with HTTMock(response_patch_notok):
            resp = backend.method_patch('http://alignakbackend.local/livehost/55d113976376e9835e1b2feb', ujson.dumps(data), headers)

        self.assertEqual('{}', resp)
Exemple #11
0
    def get_hostgroups(self):
        """
        Get hostgroups from alignak_backend

        :return: None
        """
        backend = Backend()
        all_hostgroups = backend.method_get(self.endpoint('hostgroup?embedded='
                                                          '{"hostgroup_members":1,"members":1}'))
        logger.info("[Alignak Backend Arbit] Got %d hostgroups", len(all_hostgroups))
        for hostgroup in all_hostgroups:
            hostgroup['imported_from'] = 'alignakbackend'
            # members
            self.multiple_relation(hostgroup, 'members', 'host_name')
            # hostgroup_members
            self.multiple_relation(hostgroup, 'hostgroup_members', 'hostgroup_name')
            # realm
            if hostgroup['realm'] is None:
                del hostgroup['realm']

            self.backend_ids['hostgroups'][hostgroup['_id']] = hostgroup['hostgroup_name']
            self.clean_unusable_keys(hostgroup)
            self.config['hostgroups'].append(hostgroup)
Exemple #12
0
    def get_refs(self, type_data):
        """
        Get the _id in the backend for hosts and services

        :param type_data: livestate type to get: livehost or liveservice
        :type type_data: str
        :return: None
        """
        backend = Backend()
        if type_data == 'livehost':
            content = backend.method_get(self.endpoint('host?projection={"host_name":1}'
                                                       '&where={"register":true}'))
            hosts = {}
            for item in content:
                hosts[item['_id']] = item['host_name']
                self.mapping['host'][item['host_name']] = item['_id']
            # get all livehost
            contentlh = backend.method_get(self.endpoint('livehost?embedded={"host_name":1}'
                                                         '&projection={"host_name":1}'))
            for item in contentlh:
                self.ref_live['host'][item['host_name']['_id']] = {
                    '_id': item['_id'],
                    '_etag': item['_etag']
                }
                del hosts[item['host_name']['_id']]
            # create livehost for hosts not added
            for key_id in hosts:
                data = {'host_name': key_id}
                headers = {'Content-Type': 'application/json'}
                contentadd = backend.method_post(self.endpoint('livehost'), ujson.dumps(data),
                                                 headers=headers)
                self.ref_live['host'][key_id] = {
                    '_id': contentadd['_id'],
                    '_etag': contentadd['_etag']
                }
        elif type_data == 'liveservice':
            content = backend.method_get(self.endpoint('service?projection={'
                                                       '"service_description":1,"host_name":1}'
                                                       '&embedded={"host_name":1}'
                                                       '&where={"register":true}'))
            services = {}
            for item in content:
                services[item['_id']] = item['service_description']
                self.mapping['service'][''.join([item['host_name']['host_name'],
                                                 item['service_description']])] = item['_id']
            # get all liveservice
            contentls = backend.method_get(self.endpoint('liveservice?'
                                                         'embedded={"service_description":1}'
                                                         '&projection={"service_description":1}'))
            for item in contentls:
                self.ref_live['service'][item['service_description']['_id']] = {
                    '_id': item['_id'],
                    '_etag': item['_etag']
                }
                del services[item['service_description']['_id']]
            # create liveservice for services not added
            for key_id in services:
                data = {'service_description': key_id}
                headers = {'Content-Type': 'application/json'}
                contentadd = backend.method_post(self.endpoint('liveservice'), ujson.dumps(data),
                                                 headers=headers)
                self.ref_live['service'][key_id] = {
                    '_id': contentadd['_id'],
                    '_etag': contentadd['_etag']
                }
Exemple #13
0
    def send_to_backend(self, type_data, name, data):
        """
        Send data to alignak backend livehost or liveservice

        :param type_data: one of ['livehost', 'liveservice', 'loghost', 'logservice']
        :type type_data: str
        :param name: name of host or service
        :type name: str
        :param data: dictionary with data to add / update
        :type data: dict
        :return: True if send is ok, False otherwise
        :rtype: bool
        """
        backend = Backend()
        headers = {
            'Content-Type': 'application/json',
        }
        ret = True
        if type_data == 'livehost':
            headers['If-Match'] = self.ref_live['host'][self.mapping['host'][name]]['_etag']
            response = backend.method_patch(
                self.endpoint('livehost/%s'
                              % self.ref_live['host'][self.mapping['host'][name]]['_id']),
                ujson.dumps(data),
                headers=headers
            )
            if response['_status'] == 'ERR':
                logger.error(response['_issues'])
                ret = False
            else:
                self.ref_live['host'][self.mapping['host'][name]]['_etag'] = response['_etag']
        elif type_data == 'liveservice':
            headers['If-Match'] = self.ref_live['service'][self.mapping['service'][name]]['_etag']
            response = backend.method_patch(
                self.endpoint('liveservice/%s'
                              % self.ref_live['service'][self.mapping['service'][name]]['_id']),
                ujson.dumps(data),
                headers=headers
            )
            if response['_status'] == 'ERR':
                logger.error(response['_issues'])
                ret = False
            else:
                self.ref_live['service'][self.mapping['service'][name]]['_etag'] = response['_etag']
        elif type_data == 'loghost':
            data['host_name'] = self.mapping['host'][name]
            response = backend.method_post(
                self.endpoint('loghost'), ujson.dumps(data), headers=headers
            )
            if response['_status'] == 'ERR':
                logger.error(response['_issues'])
                ret = False
        elif type_data == 'logservice':
            data['service_description'] = self.mapping['service'][name]
            response = backend.method_post(
                self.endpoint('logservice'), ujson.dumps(data), headers=headers
            )
            if response['_status'] == 'ERR':
                logger.error(response['_issues'])
                ret = False
        return ret
    def test_get_all(self):
        """
        Test to get all data (like all hosts). It manage the pagination

        :return: none
        """

        backend = Backend()

        with HTTMock(response_get_all):
            resp = backend.method_get('http://alignakbackend.local/host?projection={"host_name":1}', )

        self.assertEqual([{u'_updated': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_links': {u'self': {u'href': u'host/55d46cf26376e91e92122256', u'title': u'Host'}}, u'host_name': u'server2', u'_created': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_id': u'55d46cf26376e91e92122256', u'_etag': u'f4433b9dfd4fce9b07bc3ad8e64708d7013b9b0b'},
                          {u'_updated': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_links': {u'self': {u'href': u'host/55d46cf66376e91e92122257', u'title': u'Host'}}, u'host_name': u'server3', u'_created': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_id': u'55d46cf66376e91e92122257', u'_etag': u'f9cd8d7f09d8e1343d5c6717aa96cbe20077f1fa'},
                          {u'_updated': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_links': {u'self': {u'href': u'host/55d46cfa6376e91e92122258', u'title': u'Host'}}, u'host_name': u'server4', u'_created': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_id': u'55d46cfa6376e91e92122258', u'_etag': u'928b0e11c389843851984353a77b9b5d0f91c331'},
                          {u'_updated': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_links': {u'self': {u'href': u'host/55d113586376e9835e1b2fe6', u'title': u'Host'}}, u'host_name': u'alix', u'_created': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_id': u'55d113586376e9835e1b2fe6', u'_etag': u'694909e730bf5da80f10ee386eea03d73ab9ec76'},
                          {u'_updated': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_links': {u'self': {u'href': u'host/55d113616376e9835e1b2fe7', u'title': u'Host'}}, u'host_name': u'charnay', u'_created': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_id': u'55d113616376e9835e1b2fe7', u'_etag': u'0f47f7ae688f68e62b412cdf41bd1e20439f15c5'},
                          {u'_updated': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_links': {u'self': {u'href': u'host/55d113666376e9835e1b2fe8', u'title': u'Host'}}, u'host_name': u'localhost', u'_created': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_id': u'55d113666376e9835e1b2fe8', u'_etag': u'5b3c959511085ac1eed5b8c934a4639dd72adc8c'},
                          {u'_updated': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_links': {u'self': {u'href': u'host/55d46cee6376e91e92122255', u'title': u'Host'}}, u'host_name': u'server1', u'_created': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_id': u'55d46cee6376e91e92122255', u'_etag': u'296d463c81e05a813fd16d901445aceea21b4beb'},
                          {u'_updated': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_links': {u'self': {u'href': u'host/55d46cfe6376e91e92122259', u'title': u'Host'}}, u'host_name': u'server5', u'_created': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_id': u'55d46cfe6376e91e92122259', u'_etag': u'0cd36fce7a570b5f6521f5527baac895a1b88856'},
                          {u'_updated': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_links': {u'self': {u'href': u'host/55d46d016376e91e9212225a', u'title': u'Host'}}, u'host_name': u'server6', u'_created': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_id': u'55d46d016376e91e9212225a', u'_etag': u'd0519006726c2fec2134da50bec17d425455a2d8'},
                          {u'_updated': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_links': {u'self': {u'href': u'host/55d46d056376e91e9212225b', u'title': u'Host'}}, u'host_name': u'server7', u'_created': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_id': u'55d46d056376e91e9212225b', u'_etag': u'5adb41be14f654126ed10b6d4c4118512afd1018'},
                          {u'_updated': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_links': {u'self': {u'href': u'host/55d46d116376e91e9212225c', u'title': u'Host'}}, u'host_name': u'server8', u'_created': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_id': u'55d46d116376e91e9212225c', u'_etag': u'b0f232121b3d9c39462e30eb86ac14a1b8359f04'},
                          {u'_updated': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_links': {u'self': {u'href': u'host/55d46d156376e91e9212225d', u'title': u'Host'}}, u'host_name': u'server9', u'_created': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_id': u'55d46d156376e91e9212225d', u'_etag': u'a9cbf4a11b3aad90e513e95cf8fb43d9b19ca703'},
                          {u'_updated': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_links': {u'self': {u'href': u'host/55d46d196376e91e9212225e', u'title': u'Host'}}, u'host_name': u'server10', u'_created': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_id': u'55d46d196376e91e9212225e', u'_etag': u'035606a6809bbe5ab850bffc707e31d5f9f2a92e'},
                          {u'_updated': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_links': {u'self': {u'href': u'host/55d46d1d6376e91e9212225f', u'title': u'Host'}}, u'host_name': u'server11', u'_created': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_id': u'55d46d1d6376e91e9212225f', u'_etag': u'e9fb82a8b31f61f532d494085c11e0a11d091ccc'},
                          {u'_updated': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_links': {u'self': {u'href': u'host/55d46d206376e91e92122260', u'title': u'Host'}}, u'host_name': u'server12', u'_created': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_id': u'55d46d206376e91e92122260', u'_etag': u'908884beef70ab411dcab27f9c90d462cfb7e28d'},
                          {u'_updated': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_links': {u'self': {u'href': u'host/55d46d236376e91e92122261', u'title': u'Host'}}, u'host_name': u'server13', u'_created': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_id': u'55d46d236376e91e92122261', u'_etag': u'afd02f7e58a623394ded8a614616ed2f4d346487'},
                          {u'_updated': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_links': {u'self': {u'href': u'host/55d46d266376e91e92122262', u'title': u'Host'}}, u'host_name': u'server14', u'_created': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_id': u'55d46d266376e91e92122262', u'_etag': u'd11555491b14a4b22ac8f5e67229aced12e716c1'},
                          {u'_updated': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_links': {u'self': {u'href': u'host/55d46d296376e91e92122263', u'title': u'Host'}}, u'host_name': u'server15', u'_created': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_id': u'55d46d296376e91e92122263', u'_etag': u'b797745641f488e7ca3da0c5d51aac31d36facc6'},
                          {u'_updated': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_links': {u'self': {u'href': u'host/55d46d426376e91e92122264', u'title': u'Host'}}, u'host_name': u'server16', u'_created': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_id': u'55d46d426376e91e92122264', u'_etag': u'0e2dac8de36579b7b61a0d0d365a3fa9faccc6db'},
                          {u'_updated': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_links': {u'self': {u'href': u'host/55d46d456376e91e92122265', u'title': u'Host'}}, u'host_name': u'server17', u'_created': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_id': u'55d46d456376e91e92122265', u'_etag': u'884a23470eb052e612df725a54b63064c8ca9fe7'},
                          {u'_updated': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_links': {u'self': {u'href': u'host/55d46d486376e91e92122266', u'title': u'Host'}}, u'host_name': u'server18', u'_created': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_id': u'55d46d486376e91e92122266', u'_etag': u'78662a6072789a6982287d58039bf15c54b5739b'},
                          {u'_updated': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_links': {u'self': {u'href': u'host/55d46d516376e91e92122267', u'title': u'Host'}}, u'host_name': u'server19', u'_created': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_id': u'55d46d516376e91e92122267', u'_etag': u'04f6f13e381fc82ed4018e3484e545ff165934fc'},
                          {u'_updated': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_links': {u'self': {u'href': u'host/55d46d546376e91e92122268', u'title': u'Host'}}, u'host_name': u'server20', u'_created': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_id': u'55d46d546376e91e92122268', u'_etag': u'a00f93873ec96dfaf3e45b851acbc5c82108f90d'},
                          {u'_updated': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_links': {u'self': {u'href': u'host/55d46d596376e91e92122269', u'title': u'Host'}}, u'host_name': u'server21', u'_created': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_id': u'55d46d596376e91e92122269', u'_etag': u'84027fc4a76e8d8d50fe69d0a49bcf34f5dd42f3'},
                          {u'_updated': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_links': {u'self': {u'href': u'host/55d46d5b6376e91e9212226a', u'title': u'Host'}}, u'host_name': u'server22', u'_created': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_id': u'55d46d5b6376e91e9212226a', u'_etag': u'4a4adadb580c94636c8943312a04d20cabc70471'},
                          {u'_updated': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_links': {u'self': {u'href': u'host/55d46d5e6376e91e9212226b', u'title': u'Host'}}, u'host_name': u'server23', u'_created': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_id': u'55d46d5e6376e91e9212226b', u'_etag': u'ec85cdca4528ad2657df327b0058cfc68aa7c6fa'},
                          {u'_updated': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_links': {u'self': {u'href': u'host/55d46d616376e91e9212226c', u'title': u'Host'}}, u'host_name': u'server24', u'_created': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_id': u'55d46d616376e91e9212226c', u'_etag': u'cda5b137acfd300f675963bdb6ac8b46b5fe8d59'},
                          {u'_updated': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_links': {u'self': {u'href': u'host/55d46d646376e91e9212226d', u'title': u'Host'}}, u'host_name': u'server25', u'_created': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_id': u'55d46d646376e91e9212226d', u'_etag': u'32fc9289abd81fa345883b44ac117237519f5a91'},
                          {u'_updated': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_links': {u'self': {u'href': u'host/55d47cfe6376e91e9212226e', u'title': u'Host'}}, u'host_name': u'server26', u'_created': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_id': u'55d47cfe6376e91e9212226e', u'_etag': u'bfc5f9da6336d8e8a1c17ae5f228264b2062d565'},
                          {u'_updated': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_links': {u'self': {u'href': u'host/55d47d016376e91e9212226f', u'title': u'Host'}}, u'host_name': u'server27', u'_created': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_id': u'55d47d016376e91e9212226f', u'_etag': u'0a4996bf381d3be0ae61ea0c455a265abe7a9960'},
                          {u'_updated': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_links': {u'self': {u'href': u'host/55d47d056376e91e92122270', u'title': u'Host'}}, u'host_name': u'server28', u'_created': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_id': u'55d47d056376e91e92122270', u'_etag': u'ef89a0be3a45988caeb68e32dd0ae21a7d00b1d8'},
                          {u'_updated': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_links': {u'self': {u'href': u'host/55d47d086376e91e92122271', u'title': u'Host'}}, u'host_name': u'server29', u'_created': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_id': u'55d47d086376e91e92122271', u'_etag': u'81608b4ae41afbb836c7d9cd8650a8fd50587201'},
                          {u'_updated': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_links': {u'self': {u'href': u'host/55d47d0c6376e91e92122272', u'title': u'Host'}}, u'host_name': u'server30', u'_created': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_id': u'55d47d0c6376e91e92122272', u'_etag': u'aa919f8d5afcf0c3d7a638479a59e1eb809c2f10'},
                          {u'_updated': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_links': {u'self': {u'href': u'host/55d47d0f6376e91e92122273', u'title': u'Host'}}, u'host_name': u'server31', u'_created': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_id': u'55d47d0f6376e91e92122273', u'_etag': u'cfe25f480a904d05eae1cbd0a6b0f9cdfa9c6443'},
                          {u'_updated': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_links': {u'self': {u'href': u'host/55d47d126376e91e92122274', u'title': u'Host'}}, u'host_name': u'server32', u'_created': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_id': u'55d47d126376e91e92122274', u'_etag': u'9a27a68d51fbc84b0443a59ee07e26395cad722d'},
                          {u'_updated': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_links': {u'self': {u'href': u'host/55d47d156376e91e92122275', u'title': u'Host'}}, u'host_name': u'server33', u'_created': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_id': u'55d47d156376e91e92122275', u'_etag': u'764407415bb9b87d509d66d6142dcb428dad4ea3'},
                          {u'_updated': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_links': {u'self': {u'href': u'host/55d47d186376e91e92122276', u'title': u'Host'}}, u'host_name': u'server34', u'_created': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_id': u'55d47d186376e91e92122276', u'_etag': u'84ffb5738f819c4a381d9c12784c0e6032cea74c'},
                          {u'_updated': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_links': {u'self': {u'href': u'host/55d47d1b6376e91e92122277', u'title': u'Host'}}, u'host_name': u'server35', u'_created': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_id': u'55d47d1b6376e91e92122277', u'_etag': u'9521ab30c0e565bbf4543c85a22439e816f6830b'},
                          {u'_updated': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_links': {u'self': {u'href': u'host/55d47d1d6376e91e92122278', u'title': u'Host'}}, u'host_name': u'server36', u'_created': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_id': u'55d47d1d6376e91e92122278', u'_etag': u'55af38bd28e1289c91634215006aee785765e662'},
                          {u'_updated': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_links': {u'self': {u'href': u'host/55d47d206376e91e92122279', u'title': u'Host'}}, u'host_name': u'server37', u'_created': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_id': u'55d47d206376e91e92122279', u'_etag': u'225de7e80b085999951d8b86adfe9b01ea683770'},
                          {u'_updated': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_links': {u'self': {u'href': u'host/55d47d246376e91e9212227a', u'title': u'Host'}}, u'host_name': u'server38', u'_created': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_id': u'55d47d246376e91e9212227a', u'_etag': u'720c0f01d2d454d0962c0a17f18e583d69b03c0f'},
                          {u'_updated': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_links': {u'self': {u'href': u'host/55d47d276376e91e9212227b', u'title': u'Host'}}, u'host_name': u'server39', u'_created': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_id': u'55d47d276376e91e9212227b', u'_etag': u'3abe3f2d07499f565019b0826d383521970961b0'},
                          {u'_updated': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_links': {u'self': {u'href': u'host/55d47d2b6376e91e9212227c', u'title': u'Host'}}, u'host_name': u'server40', u'_created': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_id': u'55d47d2b6376e91e9212227c', u'_etag': u'6cdc05a513aeaeba8a89b9ab97cafcdb3b91c5e9'},
                          {u'_updated': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_links': {u'self': {u'href': u'host/55d47d2e6376e91e9212227d', u'title': u'Host'}}, u'host_name': u'server41', u'_created': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_id': u'55d47d2e6376e91e9212227d', u'_etag': u'fe357b1b97523d020ca16c5643051cacc988308e'},
                          {u'_updated': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_links': {u'self': {u'href': u'host/55d47d316376e91e9212227e', u'title': u'Host'}}, u'host_name': u'server42', u'_created': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_id': u'55d47d316376e91e9212227e', u'_etag': u'8cc3200148fef2e053c94a2e6b3d8ea03a7dd613'},
                          {u'_updated': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_links': {u'self': {u'href': u'host/55d47d346376e91e9212227f', u'title': u'Host'}}, u'host_name': u'server43', u'_created': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_id': u'55d47d346376e91e9212227f', u'_etag': u'f0a036e10318450a32a71710c7005fd32982170f'},
                          {u'_updated': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_links': {u'self': {u'href': u'host/55d47d386376e91e92122280', u'title': u'Host'}}, u'host_name': u'server44', u'_created': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_id': u'55d47d386376e91e92122280', u'_etag': u'566d4dd11200b9f20253d7af87141b6790a21d83'},
                          {u'_updated': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_links': {u'self': {u'href': u'host/55d47d3b6376e91e92122281', u'title': u'Host'}}, u'host_name': u'server45', u'_created': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_id': u'55d47d3b6376e91e92122281', u'_etag': u'31871f63eeb39bf959341655509298e7ca18e686'},
                          {u'_updated': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_links': {u'self': {u'href': u'host/55d47d3e6376e91e92122282', u'title': u'Host'}}, u'host_name': u'server46', u'_created': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_id': u'55d47d3e6376e91e92122282', u'_etag': u'0779793b441b124b091442ae4d1ff9b239ee1f72'},
                          {u'_updated': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_links': {u'self': {u'href': u'host/55d47d416376e91e92122283', u'title': u'Host'}}, u'host_name': u'server47', u'_created': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_id': u'55d47d416376e91e92122283', u'_etag': u'7c5b90f1b17355f6314ffd8d2f3cd0a542ac6b66'},
                          {u'_updated': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_links': {u'self': {u'href': u'host/55d47d446376e91e92122284', u'title': u'Host'}}, u'host_name': u'server48', u'_created': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_id': u'55d47d446376e91e92122284', u'_etag': u'6f34c822f611d67381630f3bdf5649a4c3299c89'},
                          {u'_updated': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_links': {u'self': {u'href': u'host/55d47d466376e91e92122285', u'title': u'Host'}}, u'host_name': u'server49', u'_created': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_id': u'55d47d466376e91e92122285', u'_etag': u'7b5b44f5396b123983e032ee1ef34482b0201099'},
                          {u'_updated': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_links': {u'self': {u'href': u'host/55d47d4a6376e91e92122286', u'title': u'Host'}}, u'host_name': u'server50', u'_created': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_id': u'55d47d4a6376e91e92122286', u'_etag': u'23c4ca0c74a16e9e3ada2a03161440afb1ada8c6'},
                          {u'_updated': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_links': {u'self': {u'href': u'host/55d47d4d6376e91e92122287', u'title': u'Host'}}, u'host_name': u'server51', u'_created': u'Thu, 01 Jan 1970 00:00:00 GMT', u'_id': u'55d47d4d6376e91e92122287', u'_etag': u'6d9263cf5917bc9a40495820fd1dac245e9243c7'}
                          ],
                          resp)