def get_view(self): view = View() view.title = self.title.data view.link_name = self.link_name.data view.datasource = self.datasource.data view.buttontext = self.buttontext.data view.reload_intervall = self.reload_intervall.data view.layout_number_columns = self.layout_number_columns.data return view
def get_view(self): view = View() view.title = self.title.data view.link_name = self.link_name.data view.datasource = self.datasource.data view.description = self.description.data view.link_title = self.link_title.data view.buttontext = self.buttontext.data view.reload_intervall = self.reload_intervall.data view.layout_number_columns = self.layout_number_columns.data view.basic_layout = self.basic_layout.data return view
def create_default_views(): ####################### # All hosts view filters = ViewFilters() setattr(filters, 'host_regex_option', 'show') setattr(filters, 'host_option', 'show') setattr(filters, 'host_state_option', 'show') db_session.add(filters) db_session.commit() filters = ViewFilters.query.first() view = View() view.title = 'All hosts' view.link_name = 'allhosts' view.description = 'Overall state of allhosts, with counts of services in the various states.' view.datasource = 'hosts' view.filters_id = filters.id view.layout_number_columns = 2 db_session.add(view) db_session.commit() view = (View.query.filter_by(link_name=view.link_name).first()) __add_column('host_name', view, 'host') __add_column('host_state', view) __add_column('last_check', view) ####################### # All services view filters = ViewFilters() setattr(filters, 'host_regex_option', 'show') setattr(filters, 'host_option', 'show') setattr(filters, 'host_state_option', 'show') setattr(filters, 'service_state_option', 'show') db_session.add(filters) db_session.commit() filters = ViewFilters.query.all()[1] view = View() view.title = 'All services' view.link_name = 'allservices' view.description = _('All services grouped\r\nby hosts.') view.datasource = 'services' view.layout_number_columns = 1 view.filters_id = filters.id db_session.add(view) db_session.commit() __add_column('service_description', view, 'service') __add_column('service_state', view) __add_group_by('site', view) __add_group_by('host_name', view) ########################## # Host view filters = ViewFilters() setattr(filters, 'host_option', 'hide') setattr(filters, 'site_option', 'hide') db_session.add(filters) db_session.commit() filters = ViewFilters.query.all()[2] view = View() view.title = 'Services of Host' view.link_name = 'host' view.datasource = 'services' view.description = _('All services of a given host.') view.link_title = _('Services') view.layout_number_columns = 1 view.basic_layout = 'table' view.filters_id = filters.id db_session.add(view) db_session.commit() __add_column('service_state', view) __add_column('service_description', view) __add_column('service_plugin_output', view) __add_column('check_command', view) ########################## # Service view filters = ViewFilters() setattr(filters, 'service_option', 'hide') setattr(filters, 'host_option', 'hide') setattr(filters, 'site_option', 'hide') db_session.add(filters) db_session.commit() filters = ViewFilters.query.all()[3] view = View() view.title = 'Service' view.link_name = 'service' view.link_title = 'Service details' view.datasource = 'services' view.description = 'Status of a single service, to be used for linking' view.layout_number_columns = 1 view.basic_layout = 'single' view.filters_id = filters.id db_session.add(view) db_session.commit() # add all columns for a service for column in get_columns_name('services'): if column: __add_column(column, view) ########################################## # CRIT Services of host filters = ViewFilters() setattr(filters, 'service_state_option', 'hard') setattr(filters, 'service_state_ok', False) setattr(filters, 'service_state_warning', False) setattr(filters, 'service_state_critical', True) setattr(filters, 'service_state_unknown', False) setattr(filters, 'site_option', 'hide') setattr(filters, 'host_option', 'hide') db_session.add(filters) db_session.commit() filters = ViewFilters.query.all()[4] view = View() view.title = 'CRIT Services of host' view.link_name = 'host_crit' view.link_title = 'Services: CRIT' view.datasource = 'services' view.description = 'All services of a given host that are in state CRIT' view.layout_number_columns = 2 view.filters_id = filters.id db_session.add(view) db_session.commit() __add_column('service_state', view) __add_column('service_description', view) __add_column('service_plugin_output', view) __add_column('last_check', view) ########################################## # Host problems filters = ViewFilters() setattr(filters, 'host_regex_option', 'show') setattr(filters, 'host_state_option', 'hard') setattr(filters, 'host_state_up', False) setattr(filters, 'host_state_down', True) setattr(filters, 'host_state_unreach', True) setattr(filters, 'host_state_pending', False) setattr(filters, 'is_host_scheduled_downtime_depth_option', 'hard') setattr(filters, 'is_host_scheduled_downtime_depth', '0') setattr(filters, 'is_host_acknowledged_option', 'show') setattr(filters, 'is_summary_host_option', 'show') setattr(filters, 'is_summary_host', '0') setattr(filters, 'is_host_in_notification_period_option', 'show') db_session.add(filters) db_session.commit() filters = ViewFilters.query.all()[5] view = View() view.title = 'Host problems' view.link_name = 'hostproblems' view.datasource = 'hosts' view.description = 'A complete list of all host problems with a search form for selecting handled and unhandled' view.layout_number_columns = 1 view.filters_id = filters.id db_session.add(view) db_session.commit() __add_column('host_name', view, 'host') __add_column('host_state', view) __add_column('plugin_output', view) __add_column('num_services_ok', view) __add_column('num_services_warn', view) __add_column('num_services_crit', view) __add_column('num_services_unknown', view) __add_column('num_services_pending', view) ########################################## # Services problems filters = ViewFilters() setattr(filters, 'host_regex_option', 'show') setattr(filters, 'host_state_option', 'show') setattr(filters, 'host_state_up', True) setattr(filters, 'host_state_down', False) setattr(filters, 'host_state_unreach', False) setattr(filters, 'host_state_pending', True) setattr(filters, 'service_state_option', 'hard') setattr(filters, 'service_state_ok', False) setattr(filters, 'service_state_warning', True) setattr(filters, 'service_state_critical', True) setattr(filters, 'service_state_unknown', True) setattr(filters, 'service_state_pending', False) setattr(filters, 'is_host_scheduled_downtime_depth_option', 'hard') setattr(filters, 'is_host_scheduled_downtime_depth', '0') setattr(filters, 'is_service_acknowledged_option', 'show') setattr(filters, 'is_service_acknowledged', '-1') setattr(filters, 'is_summary_host_option', 'show') setattr(filters, 'is_summary_host', '0') setattr(filters, 'is_service_in_notification_period_option', 'show') db_session.add(filters) db_session.commit() filters = ViewFilters.query.all()[6] view = View() view.title = _('Service problems') view.link_name = 'svcproblems' view.datasource = 'services' view.description = 'All problems of services not currently in a downtime.' view.layout_number_columns = 1 view.filters_id = filters.id db_session.add(view) db_session.commit() __add_column('host_name', view, 'host') __add_column('service_description', view, 'service') __add_column('service_plugin_output', view) __add_column('last_check', view)
def create_default_views(): filters = ViewFilters() for option, col_names in cache_columns.iteritems(): setattr(filters, option, 'show') db_session.add(filters) db_session.commit() filters = ViewFilters.query.first() view1 = View() view1.title = 'All hosts' view1.link_name = 'allhosts' view1.datasource = 'hosts' view1.filters_id = filters.id view1.layout_number_columns = 2 db_session.add(view1) db_session.commit() view1 = (View.query.filter_by(link_name=view1.link_name).first()) col1 = ViewColumn() col1.column = 'host_name' col1.parent_id = view1.id db_session.add(col1) col2 = ViewColumn() col2.column = 'host_state' col2.parent_id = view1.id db_session.add(col2) col3 = ViewColumn() col3.column = 'last_check' col3.parent_id = view1.id db_session.add(col3) db_session.commit() sort1 = ViewSorter() sort1.column = 'host_name' sort1.sorter_option = '1' sort1.parent_id = view1.id db_session.add(sort1) db_session.commit() group1 = ViewGrouper() group1.column = 'site' group1.parent_id = view1.id db_session.add(group1) db_session.commit() filters = ViewFilters() for option, col_names in cache_columns.iteritems(): setattr(filters, option, 'show') db_session.add(filters) db_session.commit() filters = ViewFilters.query.all()[1] view2 = View() view2.title = 'All services' view2.link_name = 'allservices' view2.datasource = 'services' view2.layout_number_columns = 1 view2.filters_id = filters.id db_session.add(view2) db_session.commit() col4 = ViewColumn() col4.column = 'service_description' col4.parent_id = view2.id db_session.add(col4) db_session.commit() col5 = ViewColumn() col5.column = 'service_state' col5.parent_id = view2.id db_session.add(col5) db_session.commit()