def __get_menu_entries(self, kibiter_major): """ Get the menu entries from the panel definition """ menu_entries = [] for entry in self.panels_menu: if entry['source'] not in self.data_sources: continue parent_menu_item = { 'name': entry['name'], 'title': entry['name'], 'description': "", 'type': "menu", 'dashboards': [] } for subentry in entry['menu']: try: dash_name = get_dashboard_name(subentry['panel']) except FileNotFoundError: logging.error("Can't open dashboard file %s", subentry['panel']) continue # The name for the entry is in self.panels_menu child_item = { "name": subentry['name'], "title": subentry['name'], "description": "", "type": "entry", "panel_id": dash_name } parent_menu_item['dashboards'].append(child_item) menu_entries.append(parent_menu_item) return menu_entries
def create_dashboard(self, panel_file, data_sources=None): """Upload a panel to Elasticsearch if it does not exist yet. If a list of data sources is specified, upload only those elements (visualizations, searches) that match that data source. :param panel_file: file name of panel (dashobard) to upload :param data_sources: list of data sources """ es_enrich = self.conf['es_enrichment']['url'] # If the panel (dashboard) already exists, don't load it dash_id = get_dashboard_name(panel_file) if exists_dashboard(es_enrich, dash_id): logger.info("Not creating a panel that exists already: %s", dash_id) else: logger.info("Creating the panel: %s", dash_id) if data_sources and ('pipermail' in data_sources or 'hyperkitty' in data_sources): # the dashboard for mbox and pipermail and hyperkitty are the same data_sources = list(data_sources) data_sources.append('mbox') if data_sources and 'stackexchange' in data_sources: # stackexchange is called stackoverflow in panels data_sources = list(data_sources) data_sources.append('stackoverflow') import_dashboard(es_enrich, panel_file, data_sources=data_sources)
def create_dashboard(self, panel_file, data_sources=None): """Upload a panel to Elasticsearch if it does not exist yet. If a list of data sources is specified, upload only those elements (visualizations, searches) that match that data source. :param panel_file: file name of panel (dashobard) to upload :param data_sources: list of data sources """ es_enrich = self.conf['es_enrichment']['url'] # If the panel (dashboard) already exists, don't load it dash_id = get_dashboard_name(panel_file) if exists_dashboard(es_enrich, dash_id): logger.info("Not creating a panel that exists already: %s", dash_id) else: logger.info("Creating the panel: %s", dash_id) if data_sources and ('pipermail' in data_sources or 'hyperkitty' in data_sources): # the dashboard for mbox and pipermail and hyperkitty are the same data_sources = list(data_sources) data_sources.append('mbox') if data_sources and 'stackexchange' in data_sources: # stackexchange is called stackoverflow in panels data_sources = list(data_sources) data_sources.append('stackoverflow') import_dashboard(es_enrich, panel_file, data_sources=data_sources)
def __get_menu_entries(self, kibiter_major): """ Get the menu entries from the panel definition """ menu_entries = OrderedDict() for entry in self.panels_menu: if entry['source'] not in self.data_sources: continue menu_entries[entry['name']] = OrderedDict() for subentry in entry['menu']: try: dash_name = get_dashboard_name(subentry['panel']) except FileNotFoundError: logging.error("Can't open dashboard file %s", subentry['panel']) continue # The name for the entry is in self.panels_menu menu_entries[entry['name']][subentry['name']] = dash_name return menu_entries
def __get_menu_entries(self, kibiter_major): """ Get the menu entries from the panel definition """ menu_entries = OrderedDict() for entry in self.panels_menu: if entry['source'] not in self.data_sources: continue if kibiter_major != '4': menu_entries[entry['name']] = OrderedDict() for subentry in entry['menu']: try: dash_name = get_dashboard_name(subentry['panel']) except FileNotFoundError: logging.error("Can't open dashboard file %s", subentry['panel']) continue # The name for the entry is in self.panels_menu if kibiter_major == '4': menu_entries[dash_name] = dash_name else: menu_entries[entry['name']][subentry['name']] = dash_name return menu_entries
def __get_menu_entries(self): """ Get the menu entries from the panel definition """ menu_entries = OrderedDict() for entry in self.panels_menu: if entry['source'] not in self.data_sources: continue if self.conf['general']['kibana'] != '4': menu_entries[entry['name']] = OrderedDict() for subentry in entry['menu']: try: dash_name = get_dashboard_name(subentry['panel']) except FileNotFoundError: logging.error("Can't open dashboard file %s", subentry['panel']) continue # The name for the entry is in self.panels_menu if self.conf['general']['kibana'] == '4': menu_entries[dash_name] = dash_name else: menu_entries[entry['name']][subentry['name']] = dash_name return menu_entries