Ejemplo n.º 1
0
    def create_bi_status_data(
            cls,
            rows: LivestatusResponse,
            extra_columns: Optional[List[LivestatusColumn]] = None) -> BIStatusInfo:
        response = {}
        bi_data_end = len(cls.get_status_columns())
        idx_svc_full_state = cls.get_index_services_with_fullstate()
        for row in rows:
            # Convert services_with_fullstate to dict
            services_with_fullstate = {
                e[0]: BIServiceWithFullState(*e[1:]) for e in row[idx_svc_full_state]
            }
            remaining_row_keys = {}
            if extra_columns:
                remaining_row_keys = dict(zip(extra_columns, row[-len(extra_columns):]))

            args = row[2:bi_data_end] + [services_with_fullstate] + [remaining_row_keys]
            response[BIHostSpec(row[0], row[1])] = BIHostStatusInfoRow(*args)
        return response
Ejemplo n.º 2
0
 def get_required_hosts(self) -> Set[BIHostSpec]:
     return {
         BIHostSpec(element.site_id, element.host_name)
         for element in self.required_elements()
     }