Example #1
0
 def filter_host_labels(self, hosts: List[BIHostData], required_labels):
     if not required_labels:
         return hosts
     matched_hosts = []
     for host in hosts:
         if matches_labels(host.labels, required_labels):
             matched_hosts.append(host)
     return matched_hosts
Example #2
0
    def filter_service_labels(self, services: List[BIServiceSearchMatch], required_labels):
        if not required_labels:
            return services

        matched_services = []
        for service in services:
            service_data = service.host.services[service.service_description]
            if matches_labels(service_data.labels, required_labels):
                matched_services.append(service)
        return matched_services
Example #3
0
 def filter_host_labels(self, hosts: Iterable[BIHostData],
                        required_labels) -> Iterable[BIHostData]:
     if not required_labels:
         return hosts
     return (x for x in hosts if matches_labels(x.labels, required_labels))