예제 #1
0
def create_dashboards():
    grafana_api = GrafanaFace(auth=(settings.GF_SECURITY_ADMIN_USER,
                                    settings.GF_SECURITY_ADMIN_PASSWORD),
                              host='grafana:3000')

    create_source_in_grafana(grafana_api)
    dashboards = []

    for db in source_dbs:
        monitored_tables = MonitoredTable.get_monitored_tables(db.name)
        for table in monitored_tables:
            dash_data = create_dashboard_for_table(grafana_api, db, table)
            dashboards.append(dash_data)

    create_home_dashboard(grafana_api, dashboards)
예제 #2
0
def create_dashboards():
    grafana_api = GrafanaFace(
        auth=(settings.GF_SECURITY_ADMIN_USER, settings.GF_SECURITY_ADMIN_PASSWORD),
        host=f'{settings.GRAFANA_WEB_HOST}:{settings.GRAFANA_WEB_PORT}'
    )

    create_source_in_grafana(grafana_api)
    dashboards = []

    for db in source_dbs:
        monitored_tables = MonitoredTable.get_monitored_tables(db.name)
        for table in monitored_tables:
            dash_data = create_dashboard_for_table(grafana_api, db, table)
            dashboards.append(dash_data)

    home_response = create_home_dashboard(grafana_api, dashboards)
    star_home_dashboard(grafana_api, home_response)
예제 #3
0
def create_dashboards():
    grafana_api = GrafanaFace(
        auth=(settings.GF_SECURITY_ADMIN_USER,
              settings.GF_SECURITY_ADMIN_PASSWORD),
        host=f'{settings.GRAFANA_WEB_HOST}:{settings.GRAFANA_WEB_PORT}')

    create_source_in_grafana(grafana_api)
    create_notifcation_channels(grafana_api)
    dashboards = []

    for db in DataSource.source_dbs():
        monitored_tables = MonitoredTable.get_monitored_tables(db.name)
        for table in monitored_tables:
            dash_data = create_dashboard_for_table(grafana_api, db, table)
            table.grafana_url = dash_data['dashboard']['url']
            dashboards.append(dash_data)

    metrics_session.commit()
    home_response = create_home_dashboard(grafana_api, dashboards)
    star_home_dashboard(grafana_api, home_response)